use of net.minecraft.world.Explosion in project LogisticsPipes by RS485.
the class PipeMultiBlockTransportLogistics method handleTileReachedClient.
@Override
protected void handleTileReachedClient(LPTravelingItemClient arrivingItem, TileEntity tile, ForgeDirection dir) {
if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).pipe instanceof CoreMultiBlockPipe) {
passToNextPipe(arrivingItem, tile);
return;
} else if (tile instanceof LogisticsTileGenericSubMultiBlock) {
List<LogisticsTileGenericPipe> masterTile = ((LogisticsTileGenericSubMultiBlock) tile).getMainPipe();
if (!masterTile.isEmpty()) {
if (masterTile.size() > 1) {
throw new UnsupportedOperationException();
}
passToNextPipe(arrivingItem, masterTile.get(0));
return;
}
}
Explosion explosion = new Explosion(this.getWorld(), null, this.getPipe().getX(), this.getPipe().getY(), this.getPipe().getZ(), 4.0F);
explosion.isFlaming = false;
explosion.isSmoking = true;
explosion.doExplosionB(true);
}
use of net.minecraft.world.Explosion in project ArsMagica2 by Mithion.
the class Explosions method processCommand.
@Override
public void processCommand(ICommandSender icommandsender, String[] astring) {
EntityPlayer player = getCommandSenderAsPlayer(icommandsender);
if (player.getCommandSenderName().equals("Moridrex") || player.getCommandSenderName().equals("Mithion")) {
if (player.worldObj.rand.nextInt(10) < 5 || !player.worldObj.canBlockSeeTheSky((int) player.posX, (int) player.posY, (int) player.posZ)) {
Explosion explosion = player.worldObj.newExplosion(null, player.posX, player.posY, player.posZ, 10, true, true);
player.attackEntityFrom(DamageSource.setExplosionSource(explosion), 5000);
} else {
if (!player.worldObj.isRemote) {
for (int i = 0; i < 25; ++i) {
EntityCreeper creeper = new EntityCreeper(player.worldObj);
creeper.setPosition(player.posX + player.worldObj.rand.nextInt(4) - 2, player.posY + 20, player.posZ + player.worldObj.rand.nextInt(4) - 2);
player.worldObj.spawnEntityInWorld(creeper);
}
}
}
} else {
player.addChatMessage(new ChatComponentText("You aren't Moridrex..."));
}
}
use of net.minecraft.world.Explosion in project NetherEx by LogicTechCorp.
the class EntitySporeCreeper method explode.
private void explode() {
dead = true;
Explosion explosion = new ExplosionSpore(world, this, posX, posY, posZ, (float) explosionRadius, true, true);
explosion.doExplosionA();
explosion.doExplosionB(true);
setDead();
spawnLingeringCloud();
}
use of net.minecraft.world.Explosion in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class CallRunner method onExplosionA.
public static void onExplosionA(Explosion e) {
Vector center = new Vector(e.explosionX, e.explosionY, e.explosionZ);
World worldIn = e.worldObj;
float radius = e.explosionSize;
AxisAlignedBB toCheck = new AxisAlignedBB(center.X - radius, center.Y - radius, center.Z - radius, center.X + radius, center.Y + radius, center.Z + radius);
List<PhysicsWrapperEntity> shipsNear = ValkyrienWarfareMod.physicsManager.getManagerForWorld(e.worldObj).getNearbyPhysObjects(toCheck);
e.doExplosionA();
// TODO: Make this compatible and shit!
for (PhysicsWrapperEntity ship : shipsNear) {
Vector inLocal = new Vector(center);
RotationMatrices.applyTransform(ship.wrapping.coordTransform.wToLTransform, inLocal);
// inLocal.roundToWhole();
Explosion expl = new Explosion(ship.worldObj, null, inLocal.X, inLocal.Y, inLocal.Z, radius, false, false);
double waterRange = .6D;
boolean cancelDueToWater = false;
for (int x = (int) Math.floor(expl.explosionX - waterRange); x <= Math.ceil(expl.explosionX + waterRange); x++) {
for (int y = (int) Math.floor(expl.explosionY - waterRange); y <= Math.ceil(expl.explosionY + waterRange); y++) {
for (int z = (int) Math.floor(expl.explosionZ - waterRange); z <= Math.ceil(expl.explosionZ + waterRange); z++) {
if (!cancelDueToWater) {
IBlockState state = e.worldObj.getBlockState(new BlockPos(x, y, z));
if (state.getBlock() instanceof BlockLiquid) {
cancelDueToWater = true;
}
}
}
}
}
expl.doExplosionA();
double affectedPositions = 0D;
for (Object o : expl.affectedBlockPositions) {
BlockPos pos = (BlockPos) o;
IBlockState state = ship.worldObj.getBlockState(pos);
Block block = state.getBlock();
if (!block.isAir(state, worldIn, (BlockPos) o) || ship.wrapping.explodedPositionsThisTick.contains((BlockPos) o)) {
affectedPositions++;
}
}
if (!cancelDueToWater) {
for (Object o : expl.affectedBlockPositions) {
BlockPos pos = (BlockPos) o;
IBlockState state = ship.worldObj.getBlockState(pos);
Block block = state.getBlock();
if (!block.isAir(state, worldIn, (BlockPos) o) || ship.wrapping.explodedPositionsThisTick.contains((BlockPos) o)) {
if (block.canDropFromExplosion(expl)) {
block.dropBlockAsItemWithChance(ship.worldObj, pos, state, 1.0F / expl.explosionSize, 0);
}
block.onBlockExploded(ship.worldObj, pos, expl);
if (!worldIn.isRemote) {
Vector posVector = new Vector(pos.getX() + .5, pos.getY() + .5, pos.getZ() + .5);
ship.wrapping.coordTransform.fromLocalToGlobal(posVector);
double mass = BlockMass.basicMass.getMassFromState(state, pos, ship.worldObj);
double explosionForce = Math.sqrt(e.explosionSize) * 1000D * mass;
Vector forceVector = new Vector(pos.getX() + .5 - expl.explosionX, pos.getY() + .5 - expl.explosionY, pos.getZ() + .5 - expl.explosionZ);
double vectorDist = forceVector.length();
forceVector.normalize();
forceVector.multiply(explosionForce / vectorDist);
RotationMatrices.doRotationOnly(ship.wrapping.coordTransform.lToWRotation, forceVector);
PhysicsQueuedForce queuedForce = new PhysicsQueuedForce(forceVector, posVector, false, 1);
if (!ship.wrapping.explodedPositionsThisTick.contains(pos)) {
ship.wrapping.explodedPositionsThisTick.add(pos);
}
ship.wrapping.queueForce(queuedForce);
}
}
}
}
}
}
Aggregations