use of org.terasology.world.chunks.pipeline.AbstractChunkTask in project Terasology by MovingBlocks.
the class LocalChunkProvider method createOrLoadChunk.
private void createOrLoadChunk(Vector3i chunkPos) {
Chunk chunk = chunkCache.get(chunkPos);
if (chunk == null && !preparingChunks.contains(chunkPos)) {
preparingChunks.add(chunkPos);
pipeline.doTask(new AbstractChunkTask(chunkPos) {
@Override
public String getName() {
return "Create or Load Chunk";
}
@Override
public void run() {
ChunkStore chunkStore = storageManager.loadChunkStore(getPosition());
Chunk chunk;
EntityBufferImpl buffer = new EntityBufferImpl();
if (chunkStore == null) {
chunk = new ChunkImpl(getPosition(), blockManager, biomeManager);
generator.createChunk(chunk, buffer);
} else {
chunk = chunkStore.getChunk();
}
InternalLightProcessor.generateInternalLighting(chunk);
chunk.deflate();
TShortObjectMap<TIntList> mappings = createBatchBlockEventMappings(chunk);
readyChunks.offer(new ReadyChunkInfo(chunk, mappings, chunkStore, buffer.getAll()));
}
});
}
}
Aggregations