ProtocolLib

3M Downloads

FieldAccessException with packet GAME_STATE_CHANGE

PrinceBunBun981 opened this issue · 4 comments

commented

Describe the bug
When attempting to set the bytes for the packet GAME_STATE_CHANGE it returns a FieldAccessException.

I've tried using:

PacketContainer packet = new PacketContainer(PacketType.Play.Server.GAME_STATE_CHANGE);
packet.getBytes().write(0, (byte) 4);
packet.getFloat().write(0, 1F);

To set the bytes for the GameState.

Screenshots
image
image

Version Info
ProtocolLib build 524
Dump: https://paste.helpch.at/epotetaqis.pl

commented

Looks like Mojang made an internal pseudo-enum for this. The packet is encoded to/from a byte, which is why it's represented that way on wiki.vg. I'll look into a good way to read those

commented

Actually you should be able to access it with packet.getGameStateIDs()

commented

Actually you should be able to access it with packet.getGameStateIDs()

How exactly would it be done with that?

commented

int stateId packet.getGameStateIDs().read(0);
packet.getGameStateIDs().write(0, stateId);