use of icbm.classic.content.explosive.thread.ThreadLargeExplosion in project ICBM-Classic by BuiltBrokenModding.
the class BlastRot method doPreExplode.
@Override
public void doPreExplode() {
if (!this.world().isRemote) {
this.thread = new ThreadLargeExplosion(this.position, (int) this.getRadius(), this.nengLiang, this.exploder);
this.thread.start();
}
}
use of icbm.classic.content.explosive.thread.ThreadLargeExplosion in project ICBM-Classic by BuiltBrokenModding.
the class BlastSonic method doPreExplode.
@Override
public void doPreExplode() {
if (!this.world().isRemote) {
if (this.hasShockWave) {
for (int x = (int) (-this.getRadius() * 2); x < this.getRadius() * 2; ++x) {
for (int y = (int) (-this.getRadius() * 2); y < this.getRadius() * 2; ++y) {
for (int z = (int) (-this.getRadius() * 2); z < this.getRadius() * 2; ++z) {
Location targetPosition = position.add(new Pos(x, y, z));
Block blockID = world().getBlock(targetPosition.xi(), targetPosition.yi(), targetPosition.zi());
if (blockID != Blocks.air) {
Material material = blockID.getMaterial();
if (blockID != Blocks.bedrock && !(material.isLiquid()) && (blockID.getExplosionResistance(this.exploder, world(), targetPosition.xi(), targetPosition.yi(), targetPosition.zi(), position.xi(), position.yi(), position.zi()) > this.nengLiang || material == Material.glass)) {
targetPosition.setBlock(world(), Blocks.air);
}
}
}
}
}
}
this.thread = new ThreadLargeExplosion(this.position, (int) this.getRadius(), this.nengLiang, this.exploder, new IThreadCallBack() {
@Override
public float getResistance(World world, IPos3D explosionPosition, IPos3D targetPosition, Entity source, Block block) {
float resistance = 0;
if (block instanceof BlockLiquid || block instanceof IFluidBlock) {
resistance = 1f;
} else {
resistance = block.getExplosionResistance(source, world, (int) targetPosition.x(), (int) targetPosition.y(), (int) targetPosition.z(), explosionPosition.x(), explosionPosition.y(), explosionPosition.z());
}
return resistance;
}
});
this.thread.start();
}
if (this.hasShockWave) {
this.world().playSoundEffect(position.x(), position.y(), position.z(), ICBMClassic.PREFIX + "hypersonic", 4.0F, (1.0F + (this.world().rand.nextFloat() - this.world().rand.nextFloat()) * 0.2F) * 0.7F);
} else {
this.world().playSoundEffect(position.x(), position.y(), position.z(), ICBMClassic.PREFIX + "sonicwave", 4.0F, (1.0F + (this.world().rand.nextFloat() - this.world().rand.nextFloat()) * 0.2F) * 0.7F);
}
}
use of icbm.classic.content.explosive.thread.ThreadLargeExplosion in project ICBM-Classic by BuiltBrokenModding.
the class BlastNuclear method doPreExplode.
@Override
public void doPreExplode() {
if (!this.world().isRemote) {
this.thread = new ThreadLargeExplosion(this.position, (int) this.getRadius(), this.energy, this.exploder);
this.thread.start();
} else if (this.spawnMoreParticles && ICBMClassic.proxy.isGaoQing()) {
// Spawn nuclear cloud.
for (int y = 0; y < 26; y++) {
int r = 4;
if (y < 8) {
r = Math.max(Math.min((8 - y) * 2, 10), 4);
} else if (y > 15) {
r = Math.max(Math.min((y - 15) * 2, 15), 5);
}
for (int x = -r; x < r; x++) {
for (int z = -r; z < r; z++) {
double distance = MathHelper.sqrt_double(x * x + z * z);
if (r > distance && r - 3 < distance) {
Location spawnPosition = position.add(new Pos(x * 2, (y - 2) * 2, z * 2));
float xDiff = (float) (spawnPosition.x() - position.x());
float zDiff = (float) (spawnPosition.z() - position.z());
ICBMClassic.proxy.spawnParticle("smoke", world(), spawnPosition, xDiff * 0.3 * world().rand.nextFloat(), -world().rand.nextFloat(), zDiff * 0.3 * world().rand.nextFloat(), (float) (distance / this.getRadius()) * world().rand.nextFloat(), 0, 0, 8F, 1.2F);
}
}
}
}
}
this.doDamageEntities(this.getRadius(), this.energy * 1000);
this.world().playSoundEffect(this.position.x(), this.position.y(), this.position.z(), ICBMClassic.PREFIX + "explosion", 7.0F, (1.0F + (this.world().rand.nextFloat() - this.world().rand.nextFloat()) * 0.2F) * 0.7F);
}
Aggregations