Search in sources :

Example 1 with EnumBlockBasicMoon

use of micdoodle8.mods.galacticraft.core.blocks.BlockBasicMoon.EnumBlockBasicMoon in project Galacticraft by micdoodle8.

the class BlockBasicMoon method breakBlock.

@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
    super.breakBlock(worldIn, pos, state);
    EnumBlockBasicMoon type = ((EnumBlockBasicMoon) state.getValue(BASIC_TYPE_MOON));
    if (!worldIn.isRemote && type == EnumBlockBasicMoon.MOON_TURF) {
        Map<Long, List<Footprint>> footprintChunkMap = TickHandlerServer.serverFootprintMap.get(GCCoreUtil.getDimensionID(worldIn));
        if (footprintChunkMap != null) {
            long chunkKey = ChunkCoordIntPair.chunkXZ2Int(pos.getX() >> 4, pos.getZ() >> 4);
            List<Footprint> footprintList = footprintChunkMap.get(chunkKey);
            if (footprintList != null && !footprintList.isEmpty()) {
                List<Footprint> toRemove = new ArrayList<Footprint>();
                for (Footprint footprint : footprintList) {
                    if (footprint.position.x > pos.getX() && footprint.position.x < pos.getX() + 1 && footprint.position.z > pos.getZ() && footprint.position.z < pos.getZ() + 1) {
                        toRemove.add(footprint);
                    }
                }
                if (!toRemove.isEmpty()) {
                    footprintList.removeAll(toRemove);
                }
            }
        }
        TickHandlerServer.footprintBlockChanges.add(new BlockVec3Dim(pos, GCCoreUtil.getDimensionID(worldIn)));
    }
}
Also used : Footprint(micdoodle8.mods.galacticraft.core.wrappers.Footprint) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) BlockVec3Dim(micdoodle8.mods.galacticraft.api.vector.BlockVec3Dim)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 BlockVec3Dim (micdoodle8.mods.galacticraft.api.vector.BlockVec3Dim)1 Footprint (micdoodle8.mods.galacticraft.core.wrappers.Footprint)1