package ljfa.tntutils.handlers;

import java.util.ArrayList;
import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.world.ChunkPosition;
import net.minecraftforge.event.world.ExplosionEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class ExplosionHandler {
    @SubscribeEvent
    public void onExplosionStart(ExplosionEvent.Start event) {
        
    }
    
    @SubscribeEvent
    public void onExplosionDetonate(final ExplosionEvent.Detonate event) {
        if(event.world.isRemote)
            return;
        List<ChunkPosition> oldList = event.getAffectedBlocks();
        List<ChunkPosition> newList = new ArrayList<ChunkPosition>(oldList.size());
        for(ChunkPosition pos: oldList) {
            Block block = event.world.getBlock(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);
            int meta = event.world.getBlockMetadata(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);
            if(!block.hasTileEntity(meta))
                newList.add(pos);
        }
        event.explosion.affectedBlockPositions = newList;
        /*blocks.removeIf(new Predicate<ChunkPosition>() {
            @Override
            public boolean test(ChunkPosition pos) {
                Block block = event.world.getBlock(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);
                int meta = event.world.getBlockMetadata(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);
                return block.hasTileEntity(meta);
            }
        });*/
    }
}

@@ -1079,419 +1079,8 @@
 st;%0A
-        /*blocks.removeIf(new Predicate%3CChunkPosition%3E() %7B%0A            @Override%0A            public boolean test(ChunkPosition pos) %7B%0A                Block block = event.world.getBlock(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);%0A                int meta = event.world.getBlockMetadata(pos.chunkPosX, pos.chunkPosY, pos.chunkPosZ);%0A                return block.hasTileEntity(meta);%0A            %7D%0A        %7D);*/%0A
     

Remove comment