use of gnu.trove.map.TShortObjectMap 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()));
}
});
}
}
use of gnu.trove.map.TShortObjectMap in project Terasology by MovingBlocks.
the class LocalChunkProvider method deactivateBlocks.
private void deactivateBlocks() {
List<TShortObjectMap<TIntList>> deactivatedBlockSets = Lists.newArrayListWithExpectedSize(deactivateBlocksQueue.size());
deactivateBlocksQueue.drainTo(deactivatedBlockSets);
for (TShortObjectMap<TIntList> deactivatedBlockSet : deactivatedBlockSets) {
deactivatedBlockSet.forEachEntry((id, positions) -> {
if (positions.size() > 0) {
blockManager.getBlock(id).getEntity().send(new BeforeDeactivateBlocks(positions, registry));
}
return true;
});
}
}
use of gnu.trove.map.TShortObjectMap in project Terasology by MovingBlocks.
the class LocalChunkProvider method deactivateBlocks.
private void deactivateBlocks() {
List<TShortObjectMap<TIntList>> deactivatedBlockSets = Lists.newArrayListWithExpectedSize(deactivateBlocksQueue.size());
deactivateBlocksQueue.drainTo(deactivatedBlockSets);
for (TShortObjectMap<TIntList> deactivatedBlockSet : deactivatedBlockSets) {
deactivatedBlockSet.forEachEntry((id, positions) -> {
if (positions.size() > 0) {
blockManager.getBlock(id).getEntity().send(new BeforeDeactivateBlocks(positions, registry));
}
return true;
});
}
}
Aggregations