List of usage examples for net.minecraftforge.event ForgeEventFactory onExplosionStart
public static boolean onExplosionStart(World world, Explosion explosion)
From source file:blusunrize.immersiveengineering.common.entities.EntityIEExplosive.java
@Override public void onUpdate() { if (world.isRemote && this.block == null) this.getBlockSynced(); this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; this.motionY -= 0.03999999910593033D; this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ); this.motionX *= 0.9800000190734863D; this.motionY *= 0.9800000190734863D; this.motionZ *= 0.9800000190734863D; if (this.onGround) { this.motionX *= 0.699999988079071D; this.motionZ *= 0.699999988079071D; this.motionY *= -0.5D; }/*www. jav a 2 s . c o m*/ int newFuse = this.getFuse() - 1; this.setFuse(newFuse); if (newFuse-- <= 0) { this.setDead(); if (!this.world.isRemote) { Explosion explosion = new IEExplosion(world, this, posX, posY + (height / 16f), posZ, explosionPower, explosionFire, explosionSmoke).setDropChance(explosionDropChance); if (!ForgeEventFactory.onExplosionStart(world, explosion)) { explosion.doExplosionA(); explosion.doExplosionB(true); } } } else { this.handleWaterMovement(); this.world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D); } }
From source file:com.crowsofwar.avatar.common.entity.EntityFireball.java
License:Open Source License
@Override public void onCollideWithSolid() { Explosion explosion = new Explosion(worldObj, this, posX, posY, posZ, STATS_CONFIG.fireballSettings.explosionSize, !worldObj.isRemote, STATS_CONFIG.fireballSettings.damageBlocks); if (!ForgeEventFactory.onExplosionStart(worldObj, explosion)) { explosion.doExplosionA();/* w w w .ja va2s . com*/ explosion.doExplosionB(true); } }
From source file:com.elytradev.libasplod.BigExplosion.java
License:Open Source License
public int tick(World w) { if (w.isRemote) return 0; //it should NEVER come to this, but let's guard against malicious calls. if (curRadius > radius * 2) { dead = true;/*ww w.j av a2 s . c o m*/ return 0; } int r2 = radius * radius; if (dummyExplosion == null) { dummyExplosion = new Explosion(w, null, epicenter.x + 0.5D, epicenter.y + 0.5D, epicenter.z + 0.5D, radius, true, true); List<Entity> entitiesAffected = w.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(epicenter.x - radius, epicenter.y - radius, epicenter.z - radius, epicenter.x + radius, epicenter.y + radius, epicenter.z + radius)); boolean deny = ForgeEventFactory.onExplosionStart(w, dummyExplosion); if (deny) { dead = true; return 0; } } if (cursor == null) cursor = new MutableVector(); int exploded = 0; ManhattanMath.getHullLocation(curRadius, stepInRadius, epicenter, cursor); //We've got our column //for(int i=radius; i>=-radius; i--) { for (int i = 0; i < (radius * 2 + 1); i++) { int targetY = epicenter.y + ManhattanMath.wiggle(i); //int targetY = epicenter.y + i; if (targetY < 0 || targetY > 255) continue; cursor.y = targetY; int dx = Math.abs(epicenter.x - cursor.x); int dy = Math.abs(epicenter.y - cursor.y); int dz = Math.abs(epicenter.z - cursor.z); if ((dx * dx + dy * dy + dz * dz) > r2) continue; //float powerHere = sampleCylinderMap(epicenter, cursor); float powerHere = power; //System.out.println("Cylindermap sampled:"+powerHere); if (powerHere <= 0) continue; float powerRemaining = raycast(w, epicenter, cursor, powerHere); //System.out.println("Power remaining after raycast:"+powerRemaining); setCylinderMap(epicenter, cursor, powerRemaining); //float powerRemaining = explodeBlock(w, new BlockPos(cursor.x,cursor.y,cursor.z), powerHere); exploded++; } //System.out.println(explainCylinderMap()); stepInRadius++; if (!ManhattanMath.isWithinHull(curRadius, stepInRadius)) { curRadius++; stepInRadius = 0; } lifetime++; //if (exploded==0) this.dead = true; return exploded; }