use of icbm.classic.content.entity.EntityExplosive in project ICBM-Classic by BuiltBrokenModding.
the class BlockExplosive method triggerExplosive.
/*
* Called to detonate the TNT. Args: world, x, y, z, metaData, CauseOfExplosion (0, intentional,
* 1, exploded, 2 burned)
*/
public static void triggerExplosive(World world, int x, int y, int z, Explosives explosiveID, int causeOfExplosion) {
if (!world.isRemote) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity != null) {
if (tileEntity instanceof TileEntityExplosive) {
ExplosivePreDetonationEvent evt = new ExplosivePreDetonationEvent(world, x, y, z, ExplosiveType.BLOCK, ((TileEntityExplosive) tileEntity).explosive.handler);
MinecraftForge.EVENT_BUS.post(evt);
if (!evt.isCanceled()) {
((TileEntityExplosive) tileEntity).exploding = true;
EntityExplosive eZhaDan = new EntityExplosive(world, new Pos(x, y, z).add(0.5), ((TileEntityExplosive) tileEntity).explosive, (byte) world.getBlockMetadata(x, y, z), ((TileEntityExplosive) tileEntity).nbtData);
switch(causeOfExplosion) {
case 2:
eZhaDan.setFire(100);
break;
}
world.spawnEntityInWorld(eZhaDan);
world.setBlockToAir(x, y, z);
}
}
}
}
}
Aggregations