ProtocolLib icon indicating copy to clipboard operation
ProtocolLib copied to clipboard

Inconsistent packet handlers with ProtocolLib versions

Open Olzie-12 opened this issue 1 year ago • 6 comments

  • [ ] This issue is not solved in a development build

Describe the bug Very inconsistent packet containers, upon using 5.2.0. The OPEN_SIGN_EDITOR works just fine. I used some debug and this is what it prints in console.

PacketContainer[type=OPEN_SIGN_EDITOR[class=PacketPlayOutOpenSignEditor, id=50], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@3c483959, com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@7f3fd91f]]]
[00:09:28 INFO]: net.minecraft.network.protocol.game.PacketPlayOutOpenSignEditor@2b10a187
[00:09:28 INFO]: OPEN_SIGN_EDITOR[class=PacketPlayOutOpenSignEditor, id=50]

with code:

   PacketContainer openSign = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.OPEN_SIGN_EDITOR);
                System.out.println(openSign);
                System.out.println(openSign.getHandle());
                System.out.println(openSign.getType());

The sign opens just fine. Now when I switch over to the dev build: 5.3.0 # 720 build, the console prints this.

PacketContainer[type=OPEN_SIGN_EDITOR[class=PacketStatusOutPong, id=52], structureModifier=StructureModifier[fieldType=class java.lang.Object, data=[com.comphenix.protocol.reflect.accessors.DefaultFieldAccessor@707c35ec]]]
[00:07:21 INFO]: net.minecraft.network.protocol.status.PacketStatusOutPong@372b5dfb
[00:07:21 INFO]: OPEN_SIGN_EDITOR[class=PacketStatusOutPong, id=52]

Now the issue with this is, for some reason the handle is PacketStatusOutPong? I am using server version 1.20.4, Paper. It won't let me send the sign editor because its saying:

[23:27:44 WARN]: FieldAccessException: Field index 0 is out of bounds for length 0
[23:27:44 WARN]:        at ProtocolLib.jar//com.comphenix.protocol.reflect.FieldAccessException.fromFormat(FieldAccessException.java:49)
[23:27:44 WARN]:        at ProtocolLib.jar//com.comphenix.protocol.reflect.StructureModifier.write(StructureModifier.java:315)

When trying to write the block position modifier, I assume its because its not using the right handler.

Olzie-12 avatar Jun 15 '24 00:06 Olzie-12

interesting. does this happen in listeners or just when creating?

dmulloy2 avatar Jun 15 '24 01:06 dmulloy2

interesting. does this happen in listeners or just when creating?

well as far as i know it’s just from creating, it’s when i’m creating packet container and then applying correct meta to it

Olzie-12 avatar Jun 15 '24 01:06 Olzie-12

makes sense. was just wondering if you'd seen it in the listeners as well. would point to a larger issue. i'll look into this. have a few theories as to what's going on here

dmulloy2 avatar Jun 15 '24 02:06 dmulloy2

i was able to reproduce this and thankfully it's specific to OPEN_SIGN_EDITOR in 1.20.4. now to figure out exactly why

dmulloy2 avatar Jun 15 '24 03:06 dmulloy2

Any updates on this, is this still an ongoing issue?

Olzie-12 avatar Jun 20 '24 21:06 Olzie-12

The error seems like it’s coming up again.

Olzie-12 avatar Nov 27 '24 12:11 Olzie-12