Search in sources :

Example 1 with BeforeDeactivateBlocks

use of org.terasology.world.block.BeforeDeactivateBlocks 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;
        });
    }
}
Also used : TShortObjectMap(gnu.trove.map.TShortObjectMap) TIntList(gnu.trove.list.TIntList) BeforeDeactivateBlocks(org.terasology.world.block.BeforeDeactivateBlocks)

Aggregations

TIntList (gnu.trove.list.TIntList)1 TShortObjectMap (gnu.trove.map.TShortObjectMap)1 BeforeDeactivateBlocks (org.terasology.world.block.BeforeDeactivateBlocks)1