use of cn.nukkit.level.format.generic.BaseFullChunk in project Nukkit by Nukkit.
the class Anvil method loadChunk.
@Override
public BaseFullChunk loadChunk(long index, int chunkX, int chunkZ, boolean create) {
int regionX = getRegionIndexX(chunkX);
int regionZ = getRegionIndexZ(chunkZ);
BaseRegionLoader region = this.loadRegion(regionX, regionZ);
this.level.timings.syncChunkLoadDataTimer.startTiming();
BaseFullChunk chunk;
try {
chunk = region.readChunk(chunkX - regionX * 32, chunkZ - regionZ * 32);
} catch (IOException e) {
throw new RuntimeException(e);
}
if (chunk == null) {
if (create) {
chunk = this.getEmptyChunk(chunkX, chunkZ);
putChunk(index, chunk);
}
} else {
putChunk(index, chunk);
}
this.level.timings.syncChunkLoadDataTimer.stopTiming();
return chunk;
}
Aggregations