Synchronize chunk packet creation

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-09-17 16:58:50 +02:00
parent 380f5a5a67
commit 5376b8af76

View File

@ -164,7 +164,7 @@ public class DynamicChunk extends Chunk {
this.entries.clear(); this.entries.clear();
} }
private @NotNull ChunkDataPacket createChunkPacket() { private synchronized @NotNull ChunkDataPacket createChunkPacket() {
ChunkDataPacket packet = new ChunkDataPacket(); ChunkDataPacket packet = new ChunkDataPacket();
packet.biomes = biomes; packet.biomes = biomes;
packet.chunkX = chunkX; packet.chunkX = chunkX;
@ -174,7 +174,7 @@ public class DynamicChunk extends Chunk {
return packet; return packet;
} }
private @NotNull UpdateLightPacket createLightPacket() { private synchronized @NotNull UpdateLightPacket createLightPacket() {
long skyMask = 0; long skyMask = 0;
long blockMask = 0; long blockMask = 0;
List<byte[]> skyLights = new ArrayList<>(); List<byte[]> skyLights = new ArrayList<>();