Search in sources :

Example 1 with BlockEntityRecipeData

use of top.theillusivec4.polymorph.api.common.component.BlockEntityRecipeData in project Polymorph by TheIllusiveC4.

the class CommonEventsListener method worldTick.

private static void worldTick(final ServerWorld serverWorld) {
    List<BlockEntity> toRemove = new ArrayList<>();
    for (Map.Entry<BlockEntity, BlockEntityRecipeData> entry : TICKABLE_BLOCKS.entrySet()) {
        BlockEntity be = entry.getKey();
        World beWorld = be.getWorld();
        if (be.isRemoved() || beWorld == null || beWorld.isClient()) {
            toRemove.add(be);
        } else {
            entry.getValue().tick();
        }
    }
    for (BlockEntity be : toRemove) {
        TICKABLE_BLOCKS.remove(be);
    }
}
Also used : ArrayList(java.util.ArrayList) BlockEntityRecipeData(top.theillusivec4.polymorph.api.common.component.BlockEntityRecipeData) World(net.minecraft.world.World) ServerWorld(net.minecraft.server.world.ServerWorld) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Map(java.util.Map) BlockEntity(net.minecraft.block.entity.BlockEntity)

Aggregations

ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 BlockEntity (net.minecraft.block.entity.BlockEntity)1 ServerWorld (net.minecraft.server.world.ServerWorld)1 World (net.minecraft.world.World)1 BlockEntityRecipeData (top.theillusivec4.polymorph.api.common.component.BlockEntityRecipeData)1