diff --git a/src/main/java/net/minestom/server/network/packet/server/login/JoinGamePacket.java b/src/main/java/net/minestom/server/network/packet/server/login/JoinGamePacket.java index acac7ccd1..575e9597b 100644 --- a/src/main/java/net/minestom/server/network/packet/server/login/JoinGamePacket.java +++ b/src/main/java/net/minestom/server/network/packet/server/login/JoinGamePacket.java @@ -11,56 +11,52 @@ import org.jglrxavpok.hephaistos.nbt.NBTCompound; public class JoinGamePacket implements ServerPacket { - public int entityId; - public GameMode gameMode = GameMode.SURVIVAL; - public DimensionType dimensionType = DimensionType.OVERWORLD; - public long hashedSeed; - public byte maxPlayers = 0; // Unused - public LevelType levelType; - public int viewDistance; - public boolean reducedDebugInfo = false; - public boolean enableRespawnScreen = true; + public int entityId; + public GameMode gameMode = GameMode.SURVIVAL; + public DimensionType dimensionType = DimensionType.OVERWORLD; + public long hashedSeed; + public byte maxPlayers = 0; // Unused + public LevelType levelType; + public int viewDistance; + public boolean reducedDebugInfo = false; + public boolean enableRespawnScreen = true; - @Override - public void write(BinaryWriter writer) { - int gameModeId = gameMode.getId(); - if (gameMode.isHardcore()) - gameModeId |= 8; + @Override + public void write(BinaryWriter writer) { + writer.writeInt(entityId); + writer.writeBoolean(MinecraftServer.isHardcoreLook()); + writer.writeByte(gameMode.getId()); + //Previous Gamemode + writer.writeByte(gameMode.getId()); - writer.writeInt(entityId); - writer.writeBoolean(MinecraftServer.isHardcoreLook()); - writer.writeByte((byte) gameModeId); - //Previous Gamemode - writer.writeByte((byte) gameModeId); + //array of worlds + writer.writeVarInt(1); + writer.writeSizedString("minestom:world"); + NBTCompound nbt = new NBTCompound(); + NBTCompound dimensions = MinecraftServer.getDimensionTypeManager().toNBT(); + NBTCompound biomes = MinecraftServer.getBiomeManager().toNBT(); - //array of worlds - writer.writeVarInt(1); - writer.writeSizedString("minestom:world"); - NBTCompound nbt = new NBTCompound(); - NBTCompound dimensions = MinecraftServer.getDimensionTypeManager().toNBT(); - NBTCompound biomes = MinecraftServer.getBiomeManager().toNBT(); + nbt.set("minecraft:dimension_type", dimensions); + nbt.set("minecraft:worldgen/biome", biomes); - nbt.set("minecraft:dimension_type", dimensions); - nbt.set("minecraft:worldgen/biome", biomes); + writer.writeNBT("", nbt); + writer.writeNBT("", dimensionType.toNBT()); - writer.writeNBT("", nbt); - writer.writeNBT("", dimensionType.toNBT()); + writer.writeSizedString(dimensionType.getName().toString()); + writer.writeLong(hashedSeed); + writer.writeVarInt(maxPlayers); + writer.writeVarInt(viewDistance); + writer.writeBoolean(reducedDebugInfo); + writer.writeBoolean(enableRespawnScreen); + //debug + writer.writeBoolean(false); + //is flat + writer.writeBoolean(levelType == LevelType.FLAT); + } - writer.writeSizedString(dimensionType.getName().toString()); - writer.writeLong(hashedSeed); - writer.writeVarInt(maxPlayers); - writer.writeVarInt(viewDistance); - writer.writeBoolean(reducedDebugInfo); - writer.writeBoolean(enableRespawnScreen); - //debug - writer.writeBoolean(false); - //is flat - writer.writeBoolean(levelType == LevelType.FLAT); - } - - @Override - public int getId() { - return ServerPacketIdentifier.JOIN_GAME; - } + @Override + public int getId() { + return ServerPacketIdentifier.JOIN_GAME; + } }