use of icbm.classic.content.potion.CustomPotionEffect in project ICBM-Classic by BuiltBrokenModding.
the class BlastChemical method doExplode.
@Override
public void doExplode() {
float radius = this.getRadius();
if (this.world().isRemote) {
for (int i = 0; i < 200; i++) {
Pos diDian = new Pos(Math.random() * radius / 2 - radius / 4, Math.random() * radius / 2 - radius / 4, Math.random() * radius / 2 - radius / 4);
diDian = diDian.multiply(Math.min(radius, callCount) / 10);
if (diDian.magnitude() <= radius) {
diDian = diDian.add(this.position);
ICBMClassic.proxy.spawnParticle("smoke", this.world(), diDian, (Math.random() - 0.5) / 2, (Math.random() - 0.5) / 2, (Math.random() - 0.5) / 2, this.red, this.green, this.blue, 7.0F, 8);
}
}
}
AxisAlignedBB bounds = AxisAlignedBB.getBoundingBox(position.x() - radius, position.y() - radius, position.z() - radius, position.x() + radius, position.y() + radius, position.z() + radius);
List<EntityLivingBase> allEntities = world().getEntitiesWithinAABB(EntityLivingBase.class, bounds);
for (EntityLivingBase entity : allEntities) {
if (this.isContagious) {
ICBMClassic.contagios_potion.poisonEntity(position.toPos(), entity);
}
if (this.isPoisonous) {
ICBMClassic.poisonous_potion.poisonEntity(position.toPos(), entity);
}
if (this.isConfuse) {
entity.addPotionEffect(new CustomPotionEffect(Potion.confusion.id, 18 * 20, 0));
entity.addPotionEffect(new CustomPotionEffect(Potion.digSlowdown.id, 20 * 60, 0));
entity.addPotionEffect(new CustomPotionEffect(Potion.moveSlowdown.id, 20 * 60, 2));
}
}
if (this.isMutate) {
new BlastMutation(world(), this.exploder, position.x(), position.y(), position.z(), this.getRadius()).explode();
}
if (this.playShortSoundFX) {
world().playSoundEffect(position.x() + 0.5D, position.y() + 0.5D, position.z() + 0.5D, ICBMClassic.PREFIX + "gasleak", 4.0F, (1.0F + (world().rand.nextFloat() - world().rand.nextFloat()) * 0.2F) * 1F);
}
if (this.callCount > this.duration) {
this.controller.endExplosion();
}
}
use of icbm.classic.content.potion.CustomPotionEffect in project ICBM-Classic by BuiltBrokenModding.
the class BlastEndothermic method doPostExplode.
@Override
public void doPostExplode() {
super.doPostExplode();
if (!this.world().isRemote) {
if (this.canFocusBeam(this.world(), position) && this.thread.isComplete) {
/*
* Freeze all nearby entities.
*/
List<EntityLiving> livingEntities = world().getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(position.x() - getRadius(), position.y() - getRadius(), position.z() - getRadius(), position.x() + getRadius(), position.y() + getRadius(), position.z() + getRadius()));
if (livingEntities != null && !livingEntities.isEmpty()) {
Iterator<EntityLiving> it = livingEntities.iterator();
while (it.hasNext()) {
EntityLiving entity = it.next();
if (entity != null && entity.isEntityAlive()) {
entity.addPotionEffect(new CustomPotionEffect(PoisonFrostBite.INSTANCE.getId(), 60 * 20, 1, null));
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 10 * 20, 2));
entity.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, 120 * 20, 2));
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 120 * 20, 4));
}
}
}
for (Pos targetPosition : this.thread.results) {
double distanceFromCenter = position.distance(targetPosition);
if (distanceFromCenter > this.getRadius()) {
continue;
}
/*
* Reduce the chance of setting blocks on fire based on distance from center.
*/
double chance = this.getRadius() - (Math.random() * distanceFromCenter);
if (chance > distanceFromCenter * 0.55) {
/*
* Place down ice blocks.
*/
Block blockID = this.world().getBlock(targetPosition.xi(), targetPosition.yi(), targetPosition.zi());
if (blockID.blockMaterial == Material.water) {
this.world().setBlock(targetPosition.xi(), targetPosition.yi(), targetPosition.zi(), Blocks.ice, 0, 3);
} else if (blockID == Blocks.fire || blockID == Blocks.flowing_lava || blockID == Blocks.lava) {
this.world().setBlock(targetPosition.xi(), targetPosition.yi(), targetPosition.zi(), Blocks.snow, 0, 3);
} else {
Block blockBellow = world().getBlock(targetPosition.xi(), targetPosition.yi() - 1, targetPosition.zi());
if ((blockID.isReplaceable(world(), targetPosition.xi(), targetPosition.yi(), targetPosition.zi())) && blockBellow.getMaterial().isSolid() && blockBellow.isSideSolid(world(), targetPosition.xi(), targetPosition.yi() - 1, targetPosition.zi(), ForgeDirection.UP)) {
if (MathUtility.rand.nextBoolean()) {
this.world().setBlock(targetPosition.xi(), targetPosition.yi(), targetPosition.zi(), Blocks.ice, 0, 3);
} else {
this.world().setBlock(targetPosition.xi(), targetPosition.yi(), targetPosition.zi(), Blocks.snow, 0, 3);
}
}
}
}
}
this.world().playSoundEffect(position.x() + 0.5D, position.y() + 0.5D, position.z() + 0.5D, ICBMClassic.PREFIX + "redmatter", 6.0F, (1.0F + (world().rand.nextFloat() - world().rand.nextFloat()) * 0.2F) * 1F);
}
if (!world().getGameRules().getGameRuleBooleanValue("doDaylightCycle")) {
this.world().setWorldTime(1200);
}
}
}
Aggregations