}
@Override
@Declare
public void cacheChunkInternal(int x, int z) {
AnvilChunkLoader anvilChunkLoader = (AnvilChunkLoader) loader;
if (anvilChunkLoader.isChunkCacheFull()) {
return;
}
long key = key(x, z);
final AtomicInteger lock = getLock(key);
try {
synchronized (lock) {
if (chunks.containsItem(key) || loadingChunks.containsItem(key) || unloadingChunks.containsItem(key)) {
return;
}
anvilChunkLoader.cacheChunk(world, x, z);
}
} finally {
if (lock.decrementAndGet() == 0) {
loadingChunks.remove(key);
}