Search in sources :

Example 1 with EntityBufferImpl

use of org.terasology.engine.world.generation.impl.EntityBufferImpl in project Terasology by MovingBlocks.

the class LocalChunkProvider method createOrLoadChunk.

protected ListenableFuture<Chunk> createOrLoadChunk(Vector3ic chunkPos) {
    Vector3i pos = new Vector3i(chunkPos);
    return loadingPipeline.invokeGeneratorTask(pos, () -> {
        ChunkStore chunkStore = storageManager.loadChunkStore(pos);
        Chunk chunk;
        EntityBufferImpl buffer = new EntityBufferImpl();
        if (chunkStore == null) {
            chunk = new ChunkImpl(pos, blockManager, extraDataManager);
            generator.createChunk(chunk, buffer);
            generateQueuedEntities.put(chunk.getPosition(new Vector3i()), buffer.getAll());
        } else {
            chunk = chunkStore.getChunk();
        }
        return chunk;
    });
}
Also used : ChunkImpl(org.terasology.engine.world.chunks.internal.ChunkImpl) Vector3i(org.joml.Vector3i) EntityBufferImpl(org.terasology.engine.world.generation.impl.EntityBufferImpl) Chunk(org.terasology.engine.world.chunks.Chunk) ChunkStore(org.terasology.engine.persistence.ChunkStore)

Aggregations

Vector3i (org.joml.Vector3i)1 ChunkStore (org.terasology.engine.persistence.ChunkStore)1 Chunk (org.terasology.engine.world.chunks.Chunk)1 ChunkImpl (org.terasology.engine.world.chunks.internal.ChunkImpl)1 EntityBufferImpl (org.terasology.engine.world.generation.impl.EntityBufferImpl)1