PacketWrapper icon indicating copy to clipboard operation
PacketWrapper copied to clipboard

com.comphenix.protocol.reflect.FieldAccessException: No field with type net.minecraft.server.v1_16_R2.ItemStack exists in class PacketPlayOutEntityEquipment.

Open alexandrage opened this issue 4 years ago • 3 comments

com.comphenix.protocol.reflect.FieldAccessException: No field with type net.minecraft.server.v1_16_R2.ItemStack exists in class PacketPlayOutEntityEquipment. at com.comphenix.protocol.reflect.StructureModifier.writeInternal(StructureModifier.java:363) ~[?:?] at com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:343) ~[?:?] at com.comphenix.packetwrapper.WrapperPlayServerEntityEquipment.setItem(WrapperPlayServerEntityEquipment.java:109) ~[?:?]

alexandrage avatar Aug 17 '20 06:08 alexandrage

Actually, I get a different error: No field with type net.minecraft.server.v1_16_R2.EnumItemSlot exists in class PacketPlayOutEntityEquipment.

And indeed, the protocl has changed:

private int a;
private final List<Pair<EnumItemSlot, ItemStack>> b;

Not sure if ProtocolLib supports Pair at all, I'll check that

Edit: okay, we need to wait that https://github.com/dmulloy2/ProtocolLib/commit/f19bfc613e589ead899891e4100b77de2100f76e is deployed as a Snapshot. The other question is, whether the regeneration script should be ran or whether this code change should be done manually?

MeFisto94 avatar Aug 29 '20 15:08 MeFisto94

This works for block setting yes getSlotStackPairLists

alexandrage avatar Sep 18 '20 13:09 alexandrage

The other question is, whether the regeneration script should be ran or whether this code change should be done manually?

As I am aware, the work on new format support is done manually.

This exact fix is partly available here: https://github.com/dmulloy2/PacketWrapper/pull/78 (although the PR seems to be incorrect as write operations seem to be missing).

Also it should be available as part of this changeset: https://github.com/dmulloy2/PacketWrapper/pull/60 (lazily, but I am working on it as I now have some sponsoring for it).

As a temporary workaround you can either do these operations directly by modifying the underlying PacketContainer manually or either add the Draft-PR branch as a git submodule and use it for building.

JarvisCraft avatar Jan 20 '21 17:01 JarvisCraft