Fix chunk packet read

This commit is contained in:
TheMode 2021-06-11 15:41:02 +02:00
parent 97d17f9b8b
commit 72bf894162

View File

@ -39,8 +39,8 @@ public class ChunkDataPacket implements ServerPacket, CacheablePacket {
public Biome[] biomes; public Biome[] biomes;
public int chunkX, chunkZ; public int chunkX, chunkZ;
public PaletteStorage paletteStorage; public PaletteStorage paletteStorage = new PaletteStorage(8, 2);
public PaletteStorage customBlockPaletteStorage; public PaletteStorage customBlockPaletteStorage = new PaletteStorage(8, 2);
public IntSet blockEntities; public IntSet blockEntities;
public Int2ObjectMap<Data> blocksData; public Int2ObjectMap<Data> blocksData;
@ -189,6 +189,7 @@ public class ChunkDataPacket implements ServerPacket, CacheablePacket {
// Data // Data
this.paletteStorage = new PaletteStorage(8, 1); this.paletteStorage = new PaletteStorage(8, 1);
int blockArrayLength = reader.readVarInt(); int blockArrayLength = reader.readVarInt();
if (maskCount > 0) {
final long mask = masks[0]; // TODO support for variable size final long mask = masks[0]; // TODO support for variable size
for (int section = 0; section < CHUNK_SECTION_COUNT; section++) { for (int section = 0; section < CHUNK_SECTION_COUNT; section++) {
boolean hasSection = (mask & 1 << section) != 0; boolean hasSection = (mask & 1 << section) != 0;
@ -219,6 +220,7 @@ public class ChunkDataPacket implements ServerPacket, CacheablePacket {
data[i] = reader.readLong(); data[i] = reader.readLong();
} }
} }
}
// Block entities // Block entities
int blockEntityCount = reader.readVarInt(); int blockEntityCount = reader.readVarInt();