fix: #297 index out of bounds (#309)

This commit is contained in:
Michael Hillcox authored and GitHub committed 2022-10-10 21:11:34 +03:00
1 parent 03a018080b
commit 32c5ed34c3
1 file changed
+3 -3
@@ -17,7 +17,7 @@ public class ClonedChunkSectionCache {
this.world = world;
}
public ClonedChunkSection acquire(int x, int y, int z) {
public synchronized ClonedChunkSection acquire(int x, int y, int z) {
long key = ChunkSectionPos.asLong(x, y, z);
ClonedChunkSection section = this.byPosition.get(key);
@@ -45,13 +45,13 @@ public class ClonedChunkSectionCache {
ChunkSectionPos pos = ChunkSectionPos.from(x, y, z);
section.init(this.world, pos);
this.byPosition.put(pos.asLong(), section);
return section;
}
public void invalidate(int x, int y, int z) {
public synchronized void invalidate(int x, int y, int z) {
this.byPosition.remove(ChunkSectionPos.asLong(x, y, z));
}