ProtocolLib

3M Downloads

FieldAccessException

DrakMC opened this issue ยท 5 comments

commented

I'm trying to use ProtocolLib to send a packet to a player to open a demo screen. However, it displays an error.

Code: https://pastebin.com/9GVNY5mj
Error: https://pastebin.com/bZDLPPeQ

I also tried this code: https://pastebin.com/dSUURDR3
But it shows me this error: https://pastebin.com/JA2haFzE

ProtocolLib Dump: https://pastebin.com/AVNzydGU

commented

No field with type int exists in class PacketPlayOutGameStateChange, which means your first line packet.getIntegers().write(0, 5); won't work. According to wiki.vg (https://wiki.vg/Protocol#Change_Game_State), the field you're trying to modify is likely a byte.

commented

Yeah, but I've already tried to modify with byte: https://pastebin.com/dSUURDR3

It throwed me this error: https://pastebin.com/JA2haFzE

commented

As far as i know, Since 1.16, net.minecraft.server started using PacketPlayOutGameStateChange.a instead of simple byte or int.

I guess new wrapper should be made to make game state change working.

commented

(Bump)

As far as i know, Since 1.16, net.minecraft.server started using PacketPlayOutGameStateChange.a instead of simple byte or int.

I guess new wrapper should be made to make game state change working.

Been trying to do this myself, and I'd rather use ProtocolLib than have to use a more complicated thing to have cross version compatibility.

Tried to figure out an alternative with some people on the SpigotMC discord but got back to where I started with using a version checker and just pulling for each version.

I do hope something is implemented into ProtocolLib to make this easier.

commented

They did such a weird thing with that packet. It looks like it's a complicated wrapper just to get a byte. I'll look into it