Add workaround for if previous gamemode is set to 255

This commit is contained in:
DoctorMacc 2020-06-25 10:40:55 -04:00
parent f9d0a142a0
commit c614376c0c

View file

@ -48,7 +48,8 @@ public class ServerJoinGamePacket implements Packet {
int gameMode = in.readUnsignedByte();
this.hardcore = (gameMode & GAMEMODE_FLAG_HARDCORE) != 0;
this.gameMode = MagicValues.key(GameMode.class, gameMode & GAMEMODE_MASK);
this.previousGamemode = MagicValues.key(GameMode.class, in.readUnsignedByte());
int previousGamemode = in.readUnsignedByte();
this.previousGamemode = MagicValues.key(GameMode.class, previousGamemode != 255 ? previousGamemode : 0);
this.worldCount = in.readVarInt();
this.worldNames = new String[this.worldCount];
for (int i = 0; i < this.worldCount; i++) {