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);
}