Remove hardcore bit in JoinGamePacket

This commit is contained in:
themode 2020-10-07 22:26:26 +02:00
parent f811f1efef
commit ec33478cc3

View File

@ -11,56 +11,52 @@ import org.jglrxavpok.hephaistos.nbt.NBTCompound;
public class JoinGamePacket implements ServerPacket { public class JoinGamePacket implements ServerPacket {
public int entityId; public int entityId;
public GameMode gameMode = GameMode.SURVIVAL; public GameMode gameMode = GameMode.SURVIVAL;
public DimensionType dimensionType = DimensionType.OVERWORLD; public DimensionType dimensionType = DimensionType.OVERWORLD;
public long hashedSeed; public long hashedSeed;
public byte maxPlayers = 0; // Unused public byte maxPlayers = 0; // Unused
public LevelType levelType; public LevelType levelType;
public int viewDistance; public int viewDistance;
public boolean reducedDebugInfo = false; public boolean reducedDebugInfo = false;
public boolean enableRespawnScreen = true; public boolean enableRespawnScreen = true;
@Override @Override
public void write(BinaryWriter writer) { public void write(BinaryWriter writer) {
int gameModeId = gameMode.getId(); writer.writeInt(entityId);
if (gameMode.isHardcore()) writer.writeBoolean(MinecraftServer.isHardcoreLook());
gameModeId |= 8; writer.writeByte(gameMode.getId());
//Previous Gamemode
writer.writeByte(gameMode.getId());
writer.writeInt(entityId); //array of worlds
writer.writeBoolean(MinecraftServer.isHardcoreLook()); writer.writeVarInt(1);
writer.writeByte((byte) gameModeId); writer.writeSizedString("minestom:world");
//Previous Gamemode NBTCompound nbt = new NBTCompound();
writer.writeByte((byte) gameModeId); NBTCompound dimensions = MinecraftServer.getDimensionTypeManager().toNBT();
NBTCompound biomes = MinecraftServer.getBiomeManager().toNBT();
//array of worlds nbt.set("minecraft:dimension_type", dimensions);
writer.writeVarInt(1); nbt.set("minecraft:worldgen/biome", biomes);
writer.writeSizedString("minestom:world");
NBTCompound nbt = new NBTCompound();
NBTCompound dimensions = MinecraftServer.getDimensionTypeManager().toNBT();
NBTCompound biomes = MinecraftServer.getBiomeManager().toNBT();
nbt.set("minecraft:dimension_type", dimensions); writer.writeNBT("", nbt);
nbt.set("minecraft:worldgen/biome", biomes); writer.writeNBT("", dimensionType.toNBT());
writer.writeNBT("", nbt); writer.writeSizedString(dimensionType.getName().toString());
writer.writeNBT("", dimensionType.toNBT()); 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()); @Override
writer.writeLong(hashedSeed); public int getId() {
writer.writeVarInt(maxPlayers); return ServerPacketIdentifier.JOIN_GAME;
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;
}
} }