dmulloy2 / ProtocolLib

Provides read and write access to the Minecraft protocol with Bukkit.
GNU General Public License v2.0
1.04k stars 257 forks source link

Different Vector3f (org.joml.Vector3f) for DisplayEntities #3270

Open TheTrueSam opened 1 month ago

TheTrueSam commented 1 month ago

Describe the bug I saw that you are still working on implementing some of the new data types for the display entities like the Quaternionf, however one that isn't mentioned in the comment and you might not be aware of is org.joml.Vector3f, as the display entities use it in favour of the EulerAngle (aka Rotations) used in other places. I am currently not aware of a different Converter / Wrapper than the Vector3F, which fails in this case.

To Reproduce Use the following code

Entity en; //Any existing entity
Vector3F scale = new com.comphenix.protocol.wrappers.Vector3F(1, 1, 1);
WrappedDataValue blockDataObject = new WrappedDataValue(12,
        WrappedDataWatcher.Registry.get(Vector3F.getMinecraftClass()), Vector3F.getConverter().getGeneric(scale));
PacketContainer container = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_METADATA);
container.getIntegers().write(0, entity.getEntityId());
container.getDataValueCollectionModifier().write(0, List.of(blockDataObject));
ProtocolLibrary.getProtocolManager().sendServerPacket(player, container);

Expected behavior Client accepts the packet.

Observed behaviour java.lang.IllegalStateException: Invalid entity data item type for field 11 on entity b['Block Display'/1073741823, l='ClientLevel', x=44.09, y=72.83, z=-62.68]: old=( 0.000E+0 0.000E+0 0.000E+0)(class org.joml.Vector3f), new=ke@a39e8ed(class ke) => Class mismatch

Version Info ProtocolLib Version: ProtocolLib v5.3.0-SNAPSHOT-732 Bukkit Version: 1.21.1-R0.1-SNAPSHOT Server Version: 1.21.1-119-7cd4f2c (MC: 1.21.1) Java Version: 21.0.4 https://pastebin.com/9wtuxxr1