diff --git a/src/main/java/com/hbm/blocks/bomb/BombFlameWar.java b/src/main/java/com/hbm/blocks/bomb/BombFlameWar.java index 6cc36770b..0fef1c854 100644 --- a/src/main/java/com/hbm/blocks/bomb/BombFlameWar.java +++ b/src/main/java/com/hbm/blocks/bomb/BombFlameWar.java @@ -1,7 +1,13 @@ package com.hbm.blocks.bomb; -import com.hbm.explosion.ExplosionChaos; +import com.hbm.explosion.vanillant.ExplosionVNT; +import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard; +import com.hbm.explosion.vanillant.standard.BlockProcessorStandard; +import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth; +import com.hbm.explosion.vanillant.standard.ExplosionEffectTiny; +import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; import com.hbm.interfaces.IBomb; +import com.hbm.particle.helper.ExplosionCreator; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -17,9 +23,7 @@ public class BombFlameWar extends Block implements IBomb { public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { if(world.isBlockIndirectlyGettingPowered(x, y, z)) { - ExplosionChaos.explode(world, x, y, z, 15); - ExplosionChaos.spawnExplosion(world, x, y, z, 75); - ExplosionChaos.flameDeath(world, x, y, z, 100); + explode(world, x, y, z); } } @@ -27,9 +31,24 @@ public class BombFlameWar extends Block implements IBomb { public BombReturnCode explode(World world, int x, int y, int z) { if(!world.isRemote) { - ExplosionChaos.explode(world, x, y, z, 15); - ExplosionChaos.spawnExplosion(world, x, y, z, 75); - ExplosionChaos.flameDeath(world, x, y, z, 100); + + world.func_147480_a(x, y, z, false); + + for(int i = 0; i < 150; i++) { + ExplosionVNT vnt = new ExplosionVNT(world, x + world.rand.nextInt(51) - 25, y + world.rand.nextInt(11) - 5, z + world.rand.nextInt(51) - 25, 4, null); + vnt.setEntityProcessor(new EntityProcessorCrossSmooth(1, 25)); + vnt.setPlayerProcessor(new PlayerProcessorStandard()); + vnt.setSFX(new ExplosionEffectTiny()); + vnt.explode(); + } + + ExplosionVNT xnt = new ExplosionVNT(world, x + 0.5, y + 0.5, z + 0.5, 15F); + xnt.setBlockAllocator(new BlockAllocatorStandard(32)); + xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop()); + xnt.setEntityProcessor(new EntityProcessorCrossSmooth(2, 200)); + xnt.setPlayerProcessor(new PlayerProcessorStandard()); + xnt.explode(); + ExplosionCreator.composeEffectSmall(world, x + 0.5, y + 0.5, z + 0.5); } return BombReturnCode.DETONATED; diff --git a/src/main/java/com/hbm/blocks/bomb/BombMulti.java b/src/main/java/com/hbm/blocks/bomb/BombMulti.java index b6496f164..1691f119a 100644 --- a/src/main/java/com/hbm/blocks/bomb/BombMulti.java +++ b/src/main/java/com/hbm/blocks/bomb/BombMulti.java @@ -18,10 +18,12 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import com.hbm.blocks.ModBlocks; +import com.hbm.entity.effect.EntityMist; import com.hbm.explosion.ExplosionChaos; import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionNukeGeneric; import com.hbm.interfaces.IBomb; +import com.hbm.inventory.fluid.Fluids; import com.hbm.main.MainRegistry; import com.hbm.tileentity.bomb.TileEntityBombMulti; @@ -169,7 +171,11 @@ public class BombMulti extends BlockContainer implements IBomb { } if(gasCloud > 0) { - ExplosionChaos.spawnChlorine(world, x, y, z, gasCloud, gasCloud / 50, 0); + EntityMist mist = new EntityMist(world); + mist.setType(Fluids.CHLORINE); + mist.setPosition(x + 0.5, y + 0.5, z + 0.5); + mist.setArea(gasCloud * 15F / 50F, gasCloud * 7.5F / 50F); + world.spawnEntityInWorld(mist); } return BombReturnCode.DETONATED; diff --git a/src/main/java/com/hbm/blocks/bomb/ExplosiveCharge.java b/src/main/java/com/hbm/blocks/bomb/ExplosiveCharge.java index dae6e61d4..b2885a531 100644 --- a/src/main/java/com/hbm/blocks/bomb/ExplosiveCharge.java +++ b/src/main/java/com/hbm/blocks/bomb/ExplosiveCharge.java @@ -69,7 +69,7 @@ public class ExplosiveCharge extends BlockDetonatable implements IBomb, IDetConn } if(this == ModBlocks.det_nuke) { world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.missileRadius, x + 0.5, y + 0.5, z + 0.5)); - EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.missileRadius); + EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.missileRadius); } } diff --git a/src/main/java/com/hbm/blocks/bomb/NukeCustom.java b/src/main/java/com/hbm/blocks/bomb/NukeCustom.java index ebc21403e..766c2baee 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeCustom.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeCustom.java @@ -179,7 +179,7 @@ public class NukeCustom extends BlockContainer implements IBomb { dirty *= 0.25F; worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int)hydro, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).moreFallout((int)dirty)); - EntityNukeTorex.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, hydro); + EntityNukeTorex.statFacStandard(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, hydro); /// NUCLEAR /// } else if(nuke > 0) { @@ -188,7 +188,7 @@ public class NukeCustom extends BlockContainer implements IBomb { nuke = Math.min(nuke, maxNuke); worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int)nuke, xCoord + 0.5, yCoord + 5, zCoord + 0.5).moreFallout((int)dirty)); - EntityNukeTorex.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, nuke); + EntityNukeTorex.statFacStandard(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, nuke); /// NON-NUCLEAR /// } else if(tnt >= 75) { @@ -196,7 +196,7 @@ public class NukeCustom extends BlockContainer implements IBomb { tnt = Math.min(tnt, maxTnt); worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(worldObj, (int)tnt, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5)); - EntityNukeTorex.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, tnt); + EntityNukeTorex.statFacStandard(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, tnt); } else if(tnt > 0) { ExplosionLarge.explode(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, tnt, true, true, true); diff --git a/src/main/java/com/hbm/blocks/bomb/NukeGadget.java b/src/main/java/com/hbm/blocks/bomb/NukeGadget.java index a09d7c31f..3e55cd5d5 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeGadget.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeGadget.java @@ -131,7 +131,7 @@ public class NukeGadget extends BlockContainer implements IBomb { world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.gadgetRadius, x + 0.5, y + 0.5, z + 0.5)); - EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.gadgetRadius); + EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.gadgetRadius); } return false; diff --git a/src/main/java/com/hbm/blocks/bomb/NukeMan.java b/src/main/java/com/hbm/blocks/bomb/NukeMan.java index d9fc4f1a5..7030d1a5a 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeMan.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeMan.java @@ -124,7 +124,7 @@ public class NukeMan extends BlockContainer implements IBomb { world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.manRadius, x + 0.5, y + 0.5, z + 0.5)); - EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.manRadius); + EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.manRadius); } return false; diff --git a/src/main/java/com/hbm/blocks/bomb/NukeMike.java b/src/main/java/com/hbm/blocks/bomb/NukeMike.java index 84e178758..3a7935503 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeMike.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeMike.java @@ -131,7 +131,7 @@ public class NukeMike extends BlockContainer implements IBomb { world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.mikeRadius, x + 0.5, y + 0.5, z + 0.5)); - EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.mikeRadius); + EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.mikeRadius); } return false; diff --git a/src/main/java/com/hbm/blocks/bomb/NukeN2.java b/src/main/java/com/hbm/blocks/bomb/NukeN2.java index c65eef0f7..197471386 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeN2.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeN2.java @@ -120,7 +120,7 @@ public class NukeN2 extends BlockContainer implements IBomb { world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(world, r, x + 0.5, y + 0.5, z + 0.5)); - EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, r); + EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, r); } return false; diff --git a/src/main/java/com/hbm/blocks/bomb/NukeTsar.java b/src/main/java/com/hbm/blocks/bomb/NukeTsar.java index f064a053a..1fea0c9d2 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeTsar.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeTsar.java @@ -129,7 +129,7 @@ public class NukeTsar extends BlockContainer implements IBomb { tetn.clearSlots(); world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, r, x + 0.5, y + 0.5, z + 0.5)); - EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, r); + EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, r); } return false; diff --git a/src/main/java/com/hbm/blocks/test/TestCore.java b/src/main/java/com/hbm/blocks/test/TestCore.java index 049f7eae9..7b3b60380 100644 --- a/src/main/java/com/hbm/blocks/test/TestCore.java +++ b/src/main/java/com/hbm/blocks/test/TestCore.java @@ -27,7 +27,7 @@ public class TestCore extends Block { world.setBlockToAir(x, y, z); world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, BombConfig.missileRadius, x + 0.5, y + 0.5, z + 0.5)); - EntityNukeTorex.statFac(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.missileRadius); + EntityNukeTorex.statFacStandard(world, x + 0.5, y + 0.5, z + 0.5, BombConfig.missileRadius); } else if(meta > 0) { diff --git a/src/main/java/com/hbm/entity/effect/EntityNukeTorex.java b/src/main/java/com/hbm/entity/effect/EntityNukeTorex.java index 0c8f7b843..6d2e03597 100644 --- a/src/main/java/com/hbm/entity/effect/EntityNukeTorex.java +++ b/src/main/java/com/hbm/entity/effect/EntityNukeTorex.java @@ -45,16 +45,8 @@ public class EntityNukeTorex extends Entity { this.dataWatcher.addObject(11, new Integer(0)); } - @Override - @SideOnly(Side.CLIENT) - public int getBrightnessForRender(float p_70070_1_) { - return 15728880; - } - - @Override - public float getBrightness(float p_70013_1_) { - return 1.0F; - } + @Override @SideOnly(Side.CLIENT) public int getBrightnessForRender(float interp) { return 15728880; } + @Override public float getBrightness(float interp) { return 1.0F; } @Override public void onUpdate() { @@ -574,16 +566,12 @@ public class EntityNukeTorex extends Entity { return true; } - public static void statFac(World world, double x, double y, double z, float scale) { - EntityNukeTorex torex = new EntityNukeTorex(world).setScale(MathHelper.clamp_float((float) BobMathUtil.squirt(scale * 0.01) * 1.5F, 0.5F, 5F)); - torex.setPosition(x, y, z); - torex.forceSpawn = true; - world.spawnEntityInWorld(torex); - TrackerUtil.setTrackingRange(world, torex, 1000); - } + public static void statFacStandard(World world, double x, double y, double z, float scale) { statFac(world, x, y, z, scale, 0); } + public static void statFacBale(World world, double x, double y, double z, float scale) { statFac(world, x, y, z, scale, 1); } - public static void statFacBale(World world, double x, double y, double z, float scale) { - EntityNukeTorex torex = new EntityNukeTorex(world).setScale(MathHelper.clamp_float((float) BobMathUtil.squirt(scale * 0.01) * 1.5F, 0.5F, 5F)).setType(1); + public static void statFac(World world, double x, double y, double z, float scale, int type) { + EntityNukeTorex torex = new EntityNukeTorex(world).setScale(MathHelper.clamp_float((float) BobMathUtil.squirt(scale * 0.01) * 1.5F, 0.5F, 5F)); + torex.setType(type); torex.setPosition(x, y, z); torex.forceSpawn = true; world.spawnEntityInWorld(torex); diff --git a/src/main/java/com/hbm/entity/grenade/EntityGrenadeCloud.java b/src/main/java/com/hbm/entity/grenade/EntityGrenadeCloud.java index d58cfe18c..084f50b36 100644 --- a/src/main/java/com/hbm/entity/grenade/EntityGrenadeCloud.java +++ b/src/main/java/com/hbm/entity/grenade/EntityGrenadeCloud.java @@ -26,7 +26,7 @@ public class EntityGrenadeCloud extends EntityGrenadeBase { this.setDead(); this.worldObj.playAuxSFX(2002, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), 0); - ExplosionChaos.spawnChlorine(worldObj, posX, posY, posZ, 250, 1.5, 1); + ExplosionChaos.spawnPoisonCloud(worldObj, posX, posY, posZ, 250, 1.5, 1); } } } diff --git a/src/main/java/com/hbm/entity/grenade/EntityGrenadeIFToxic.java b/src/main/java/com/hbm/entity/grenade/EntityGrenadeIFToxic.java index d17910734..83d04ad89 100644 --- a/src/main/java/com/hbm/entity/grenade/EntityGrenadeIFToxic.java +++ b/src/main/java/com/hbm/entity/grenade/EntityGrenadeIFToxic.java @@ -37,7 +37,6 @@ public class EntityGrenadeIFToxic extends EntityGrenadeBouncyBase { ExplosionLarge.explode(worldObj, posX, posY, posZ, 2, true, true, true); ExplosionChaos.poison(worldObj, (int)posX, (int)posY, (int)posZ, 12); ExplosionNukeGeneric.waste(worldObj, (int)posX, (int)posY, (int)posZ, 12); - ExplosionChaos.spawnChlorine(worldObj, posX, posY, posZ, 50, 1.5, 0); } } diff --git a/src/main/java/com/hbm/entity/grenade/EntityGrenadePC.java b/src/main/java/com/hbm/entity/grenade/EntityGrenadePC.java index 34b2068a3..9136b287a 100644 --- a/src/main/java/com/hbm/entity/grenade/EntityGrenadePC.java +++ b/src/main/java/com/hbm/entity/grenade/EntityGrenadePC.java @@ -26,7 +26,7 @@ public class EntityGrenadePC extends EntityGrenadeBase { this.setDead(); this.worldObj.playAuxSFX(2002, (int)Math.round(this.posX), (int)Math.round(this.posY), (int)Math.round(this.posZ), 0); - ExplosionChaos.spawnChlorine(worldObj, posX, posY, posZ, 500, 2, 2); + ExplosionChaos.spawnPoisonCloud(worldObj, posX, posY, posZ, 500, 2, 2); } } } diff --git a/src/main/java/com/hbm/entity/logic/EntityBomber.java b/src/main/java/com/hbm/entity/logic/EntityBomber.java index 911a09e28..3270d701e 100644 --- a/src/main/java/com/hbm/entity/logic/EntityBomber.java +++ b/src/main/java/com/hbm/entity/logic/EntityBomber.java @@ -61,7 +61,7 @@ public class EntityBomber extends EntityPlaneBase { if(type == 3) { worldObj.playSoundEffect((double) (posX + 0.5F), (double) (posY + 0.5F), (double) (posZ + 0.5F), "random.fizz", 5.0F, 2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F); - ExplosionChaos.spawnChlorine(worldObj, this.posX, this.posY - 1F, this.posZ, 10, 0.5, 3); + ExplosionChaos.spawnPoisonCloud(worldObj, this.posX, this.posY - 1F, this.posZ, 10, 0.5, 3); } else if(type == 5) { @@ -75,7 +75,7 @@ public class EntityBomber extends EntityPlaneBase { } else if(type == 7) { worldObj.playSoundEffect((double) (posX + 0.5F), (double) (posY + 0.5F), (double) (posZ + 0.5F), "random.fizz", 5.0F, 2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F); - ExplosionChaos.spawnChlorine(worldObj, this.posX, worldObj.getHeightValue((int) this.posX, (int) this.posZ) + 2, this.posZ, 10, 1, 2); + ExplosionChaos.spawnPoisonCloud(worldObj, this.posX, worldObj.getHeightValue((int) this.posX, (int) this.posZ) + 2, this.posZ, 10, 1, 2); } else { worldObj.playSoundEffect((double) (posX + 0.5F), (double) (posY + 0.5F), (double) (posZ + 0.5F), "hbm:entity.bombWhistle", 10.0F, 0.9F + rand.nextFloat() * 0.2F); diff --git a/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java b/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java index e929e2fe2..0bfe4efb6 100644 --- a/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java +++ b/src/main/java/com/hbm/entity/missile/EntityMissileCustom.java @@ -190,7 +190,7 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo case NUCLEAR: case TX: worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int) strength, posX, posY, posZ)); - EntityNukeTorex.statFac(worldObj, posX, posY, posZ, strength); + EntityNukeTorex.statFacStandard(worldObj, posX, posY, posZ, strength); break; case BALEFIRE: EntityBalefire bf = new EntityBalefire(worldObj); @@ -203,7 +203,7 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo break; case N2: worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFacNoRad(worldObj, (int) strength, posX, posY, posZ)); - EntityNukeTorex.statFac(worldObj, posX, posY, posZ, strength); + EntityNukeTorex.statFacStandard(worldObj, posX, posY, posZ, strength); break; case TAINT: int r = (int) strength; @@ -219,7 +219,7 @@ public class EntityMissileCustom extends EntityMissileBaseNT implements IChunkLo break; case CLOUD: this.worldObj.playAuxSFX(2002, (int) Math.round(this.posX), (int) Math.round(this.posY), (int) Math.round(this.posZ), 0); - ExplosionChaos.spawnChlorine(worldObj, posX - motionX, posY - motionY, posZ - motionZ, 750, 2.5, 2); + ExplosionChaos.spawnPoisonCloud(worldObj, posX - motionX, posY - motionY, posZ - motionZ, 750, 2.5, 2); break; case TURBINE: ExplosionLarge.explode(worldObj, posX, posY, posZ, 10, true, false, true); diff --git a/src/main/java/com/hbm/entity/missile/EntityMissileTier4.java b/src/main/java/com/hbm/entity/missile/EntityMissileTier4.java index ab284113f..dfdfe9b8e 100644 --- a/src/main/java/com/hbm/entity/missile/EntityMissileTier4.java +++ b/src/main/java/com/hbm/entity/missile/EntityMissileTier4.java @@ -65,7 +65,7 @@ public abstract class EntityMissileTier4 extends EntityMissileBaseNT { public EntityMissileNuclear(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); } @Override public void onImpact() { this.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius, posX, posY, posZ)); - EntityNukeTorex.statFac(worldObj, posX, posY, posZ, BombConfig.missileRadius); + EntityNukeTorex.statFacStandard(worldObj, posX, posY, posZ, BombConfig.missileRadius); } @Override public ItemStack getDebrisRareDrop() { return new ItemStack(ModItems.warhead_nuclear); } @Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_nuclear); } @@ -76,7 +76,7 @@ public abstract class EntityMissileTier4 extends EntityMissileBaseNT { public EntityMissileMirv(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); } @Override public void onImpact() { worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius * 2, posX, posY, posZ)); - EntityNukeTorex.statFac(worldObj, posX, posY, posZ, BombConfig.missileRadius * 2); + EntityNukeTorex.statFacStandard(worldObj, posX, posY, posZ, BombConfig.missileRadius * 2); } @Override public List getDebris() { List list = new ArrayList(); @@ -107,7 +107,7 @@ public abstract class EntityMissileTier4 extends EntityMissileBaseNT { public EntityMissileDoomsday(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); } @Override public void onImpact() { this.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius * 2, posX, posY, posZ).moreFallout(100)); - EntityNukeTorex.statFac(worldObj, posX, posY, posZ, BombConfig.missileRadius * 2); + EntityNukeTorex.statFacStandard(worldObj, posX, posY, posZ, BombConfig.missileRadius * 2); } @Override public List getDebris() { return null; } @Override public ItemStack getDebrisRareDrop() { return null; } @@ -120,7 +120,7 @@ public abstract class EntityMissileTier4 extends EntityMissileBaseNT { public EntityMissileDoomsdayRusted(World world, float x, float y, float z, int a, int b) { super(world, x, y, z, a, b); } @Override public void onImpact() { this.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.missileRadius, posX, posY, posZ).moreFallout(100)); - EntityNukeTorex.statFac(worldObj, posX, posY, posZ, BombConfig.missileRadius); + EntityNukeTorex.statFacStandard(worldObj, posX, posY, posZ, BombConfig.missileRadius); } @Override public ItemStack getMissileItemForInfo() { return new ItemStack(ModItems.missile_doomsday_rusted); } } diff --git a/src/main/java/com/hbm/entity/projectile/EntityBombletZeta.java b/src/main/java/com/hbm/entity/projectile/EntityBombletZeta.java index e6b3f672c..eb870b398 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityBombletZeta.java +++ b/src/main/java/com/hbm/entity/projectile/EntityBombletZeta.java @@ -1,8 +1,8 @@ package com.hbm.entity.projectile; import com.hbm.config.BombConfig; +import com.hbm.entity.effect.EntityMist; import com.hbm.entity.logic.EntityNukeExplosionMK5; -import com.hbm.explosion.ExplosionChaos; import com.hbm.explosion.vanillant.ExplosionVNT; import com.hbm.explosion.vanillant.standard.BlockAllocatorStandard; import com.hbm.explosion.vanillant.standard.BlockMutatorFire; @@ -11,6 +11,7 @@ import com.hbm.explosion.vanillant.standard.EntityProcessorCrossSmooth; import com.hbm.explosion.vanillant.standard.ExplosionEffectWeapon; import com.hbm.explosion.vanillant.standard.PlayerProcessorStandard; import com.hbm.handler.threading.PacketThreading; +import com.hbm.inventory.fluid.Fluids; import com.hbm.packet.toclient.AuxParticlePacketNT; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; @@ -70,7 +71,11 @@ public class EntityBombletZeta extends EntityThrowable { } if(type == 2) { worldObj.playSoundEffect((double) (posX + 0.5F), (double) (posY + 0.5F), (double) (posZ + 0.5F), "random.fizz", 5.0F, 2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F); - ExplosionChaos.spawnChlorine(worldObj, this.posX + 0.5F - motionX, this.posY + 0.5F - motionY, this.posZ + 0.5F - motionZ, 75, 2, 0); + EntityMist mist = new EntityMist(worldObj); + mist.setType(Fluids.CHLORINE); + mist.setPosition(this.posX - motionX, this.posY - motionY, this.posZ - motionZ); + mist.setArea(15, 7.5F); + worldObj.spawnEntityInWorld(mist); } if(type == 4) { worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, (int) (BombConfig.fatmanRadius * 1.5), posX, posY, posZ)); diff --git a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java index 2ada3ea35..728c2d1ad 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java +++ b/src/main/java/com/hbm/entity/projectile/EntityBulletBaseNT.java @@ -9,7 +9,6 @@ import com.hbm.entity.effect.EntityCloudFleijaRainbow; import com.hbm.entity.effect.EntityEMPBlast; import com.hbm.entity.logic.EntityNukeExplosionMK3; import com.hbm.entity.logic.EntityNukeExplosionMK5; -import com.hbm.explosion.ExplosionChaos; import com.hbm.explosion.ExplosionLarge; import com.hbm.explosion.ExplosionNukeGeneric; import com.hbm.explosion.vanillant.ExplosionVNT; @@ -447,11 +446,6 @@ public class EntityBulletBaseNT extends EntityThrowableInterp implements IBullet if(config.shrapnel > 0 && !worldObj.isRemote) ExplosionLarge.spawnShrapnels(worldObj, posX, posY, posZ, config.shrapnel); - if(config.chlorine > 0 && !worldObj.isRemote) { - ExplosionChaos.spawnChlorine(worldObj, posX, posY, posZ, config.chlorine, 1.5, 0); - worldObj.playSoundEffect((double)(posX + 0.5F), (double)(posY + 0.5F), (double)(posZ + 0.5F), "random.fizz", 5.0F, 2.6F + (rand.nextFloat() - rand.nextFloat()) * 0.8F); - } - if(config.rainbow > 0 && !worldObj.isRemote) { EntityNukeExplosionMK3 ex = EntityNukeExplosionMK3.statFacFleija(worldObj, posX, posY, posZ, config.rainbow); if(!ex.isDead) { diff --git a/src/main/java/com/hbm/entity/projectile/EntityModBeam.java b/src/main/java/com/hbm/entity/projectile/EntityModBeam.java index f8a2e6be7..60193ba8b 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityModBeam.java +++ b/src/main/java/com/hbm/entity/projectile/EntityModBeam.java @@ -490,7 +490,7 @@ public class EntityModBeam extends Entity implements IProjectile { this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "random.explode", 100.0f, this.worldObj.rand.nextFloat() * 0.1F + 0.9F); this.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(worldObj, BombConfig.gadgetRadius, posX, posY, posZ)); - EntityNukeTorex.statFac(worldObj, posX, posY, posZ, BombConfig.gadgetRadius); + EntityNukeTorex.statFacStandard(worldObj, posX, posY, posZ, BombConfig.gadgetRadius); } } } diff --git a/src/main/java/com/hbm/explosion/ExplosionChaos.java b/src/main/java/com/hbm/explosion/ExplosionChaos.java index dd15674cf..a3a249089 100644 --- a/src/main/java/com/hbm/explosion/ExplosionChaos.java +++ b/src/main/java/com/hbm/explosion/ExplosionChaos.java @@ -7,7 +7,6 @@ import com.hbm.blocks.ModBlocks; import com.hbm.entity.grenade.EntityGrenadeTau; import com.hbm.entity.grenade.EntityGrenadeZOMG; import com.hbm.entity.item.EntityFallingBlockNT; -import com.hbm.entity.particle.EntityChlorineFX; import com.hbm.entity.particle.EntityCloudFX; import com.hbm.entity.particle.EntityModFX; import com.hbm.entity.particle.EntityOrangeFX; @@ -28,7 +27,6 @@ import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; @@ -40,34 +38,13 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +@Deprecated @Spaghetti("my eyes are bleeding") -public class ExplosionChaos { +public class ExplosionChaos { //TODO: destroy this entire class private final static Random random = new Random(); private static Random rand = new Random(); - public static void explode(World world, int x, int y, int z, int bombStartStrength) { - - int r = bombStartStrength; - int r2 = r * r; - int r22 = r2 / 2; - for (int xx = -r; xx < r; xx++) { - int X = xx + x; - int XX = xx * xx; - for (int yy = -r; yy < r; yy++) { - int Y = yy + y; - int YY = XX + yy * yy; - for (int zz = -r; zz < r; zz++) { - int Z = zz + z; - int ZZ = YY + zz * zz; - if (ZZ < r22) { - destruction(world, X, Y, Z); - } - } - } - } - } - public static void hardenVirus(World world, int x, int y, int z, int bombStartStrength) { int r = bombStartStrength; @@ -130,8 +107,10 @@ public class ExplosionChaos { int ZZ = YY + zz * zz; if (ZZ < r22) { - if(world.getBlock(X, Y, Z).getExplosionResistance(null) <= 70) - pDestruction(world, X, Y, Z); + if(world.getBlock(X, Y, Z).getExplosionResistance(null) <= 70) { + EntityFallingBlockNT entityfallingblock = new EntityFallingBlockNT(world, X + 0.5, Y + 0.5, Z + 0.5, world.getBlock(X, Y, Z), world.getBlockMetadata(X, Y, Z)); + world.spawnEntityInWorld(entityfallingblock); + } } } } @@ -183,79 +162,6 @@ public class ExplosionChaos { } } - public static void spawnExplosion(World world, int x, int y, int z, int bound) { - - int randX; - int randY; - int randZ; - - for (int i = 0; i < 25; i++) { - - randX = random.nextInt(bound); - randY = random.nextInt(bound); - randZ = random.nextInt(bound); - - world.createExplosion(null, x + randX, y + randY, z + randZ, 10.0F, true); - // ExplosionChaos.explode(world, x + randX, y + randY, z + randZ, - // 5); - - randX = random.nextInt(bound); - randY = random.nextInt(bound); - randZ = random.nextInt(bound); - - world.createExplosion(null, x + randX, y - randY, z + randZ, 10.0F, true); - // ExplosionChaos.explode(world, x - randX, y + randY, z + randZ, - // 5); - - randX = random.nextInt(bound); - randY = random.nextInt(bound); - randZ = random.nextInt(bound); - - world.createExplosion(null, x + randX, y + randY, z - randZ, 10.0F, true); - // ExplosionChaos.explode(world, x + randX, y - randY, z + randZ, - // 5); - - randX = random.nextInt(bound); - randY = random.nextInt(bound); - randZ = random.nextInt(bound); - - world.createExplosion(null, x - randX, y + randY, z + randZ, 10.0F, true); - // ExplosionChaos.explode(world, x + randX, y + randY, z - randZ, - // 5); - randX = random.nextInt(bound); - randY = random.nextInt(bound); - randZ = random.nextInt(bound); - - world.createExplosion(null, x - randX, y - randY, z + randZ, 10.0F, true); - // ExplosionChaos.explode(world, x - randX, y - randY, z + randZ, - // 5); - - randX = random.nextInt(bound); - randY = random.nextInt(bound); - randZ = random.nextInt(bound); - - world.createExplosion(null, x - randX, y + randY, z - randZ, 10.0F, true); - // ExplosionChaos.explode(world, x - randX, y + randY, z - randZ, - // 5); - - randX = random.nextInt(bound); - randY = random.nextInt(bound); - randZ = random.nextInt(bound); - - world.createExplosion(null, x + randX, y - randY, z - randZ, 10.0F, true); - // ExplosionChaos.explode(world, x + randX, y - randY, z - randZ, - // 5); - - randX = random.nextInt(bound); - randY = random.nextInt(bound); - randZ = random.nextInt(bound); - - world.createExplosion(null, x - randX, y - randY, z - randZ, 10.0F, true); - // ExplosionChaos.explode(world, x - randX, y - randY, z - randZ, - // 5); - } - } - /** * Sets all flammable blocks on fire * @@ -327,15 +233,13 @@ public class ExplosionChaos { } - public static void spawnChlorine(World world, double x, double y, double z, int count, double speed, int type) { + @Deprecated public static void spawnPoisonCloud(World world, double x, double y, double z, int count, double speed, int type) { for(int i = 0; i < count; i++) { EntityModFX fx = null; - if(type == 0) { - fx = new EntityChlorineFX(world, x, y, z, 0.0, 0.0, 0.0); - } else if(type == 1) { + if(type == 1) { fx = new EntityCloudFX(world, x, y, z, 0.0, 0.0, 0.0); } else if(type == 2) { fx = new EntityPinkCloudFX(world, x, y, z, 0.0, 0.0, 0.0); @@ -365,25 +269,6 @@ public class ExplosionChaos { } } - public static void destruction(World world, int x, int y, int z) { - - if (world.getBlock(x, y, z) == Blocks.bedrock || world.getBlock(x, y, z) == ModBlocks.reinforced_brick - || world.getBlock(x, y, z) == ModBlocks.reinforced_sand - || world.getBlock(x, y, z) == ModBlocks.reinforced_glass - || world.getBlock(x, y, z) == ModBlocks.reinforced_lamp_on - || world.getBlock(x, y, z) == ModBlocks.reinforced_lamp_off) { - - } else { - world.setBlock(x, y, z, Blocks.air); - } - - } - - public static void pDestruction(World world, int x, int y, int z) { - EntityFallingBlockNT entityfallingblock = new EntityFallingBlockNT(world, (double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), world.getBlock(x, y, z), world.getBlockMetadata(x, y, z)); - world.spawnEntityInWorld(entityfallingblock); - } - public static void cluster(World world, int x, int y, int z, int count, int gravity) { double d1 = 0; @@ -436,35 +321,6 @@ public class ExplosionChaos { } } - public static void nuke(World world, int x, int y, int z, int count) { - - double d1 = 0; - double d2 = 0; - double d3 = 0; - EntityTNTPrimed fragment; - - for (int i = 0; i < 5; i++) { - d1 = rand.nextDouble(); - d2 = rand.nextDouble(); - d3 = rand.nextDouble(); - - if (rand.nextInt(2) == 0) { - d1 *= -1; - } - - if (rand.nextInt(2) == 0) { - d3 *= -1; - } - - fragment = new EntityTNTPrimed(world); - fragment.motionX = d1; - fragment.motionY = d2; - fragment.motionZ = d3; - - world.spawnEntityInWorld(fragment); - } - } - public static void frag(World world, int x, int y, int z, int count, boolean flame, Entity shooter) { double d1 = 0; diff --git a/src/main/java/com/hbm/items/machine/ItemLens.java b/src/main/java/com/hbm/items/machine/ItemLens.java index 93ebb1f86..905af7c05 100644 --- a/src/main/java/com/hbm/items/machine/ItemLens.java +++ b/src/main/java/com/hbm/items/machine/ItemLens.java @@ -43,15 +43,14 @@ public class ItemLens extends Item { stack.stackTagCompound.setLong("damage", damage); } - - public double getDurabilityForDisplay(ItemStack stack) - { - return (double)getLensDamage(stack) / (double)maxDamage; - } - - public boolean showDurabilityBar(ItemStack stack) - { - return getDurabilityForDisplay(stack) != 0; - } + @Override + public double getDurabilityForDisplay(ItemStack stack) { + return (double) getLensDamage(stack) / (double) maxDamage; + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return getDurabilityForDisplay(stack) != 0; + } } diff --git a/src/main/java/com/hbm/items/tool/WeaponSpecial.java b/src/main/java/com/hbm/items/tool/WeaponSpecial.java index c59daa016..49041e842 100644 --- a/src/main/java/com/hbm/items/tool/WeaponSpecial.java +++ b/src/main/java/com/hbm/items/tool/WeaponSpecial.java @@ -152,7 +152,7 @@ public class WeaponSpecial extends ItemSword { if(entityPlayer.fallDistance >= 20 && !((EntityPlayer)entityPlayer).capabilities.isCreativeMode) { if(!world.isRemote) { world.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(world, 100, entity.posX, entity.posY, entity.posZ)); - EntityNukeTorex.statFac(world, entity.posX, entity.posY, entity.posZ, 100); + EntityNukeTorex.statFacStandard(world, entity.posX, entity.posY, entity.posZ, 100); } } } diff --git a/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java b/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java index ff3bb0829..6d968fcfd 100644 --- a/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java +++ b/src/main/java/com/hbm/items/weapon/ItemAmmoArty.java @@ -262,7 +262,7 @@ public class ItemAmmoArty extends Item { this.itemTypes[NUKE] = new ArtilleryShell("ammo_arty_nuke", SpentCasing.COLOR_CASE_16INCH_NUKE) { public void onImpact(EntityArtilleryShell shell, MovingObjectPosition mop) { shell.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(shell.worldObj, BombConfig.missileRadius, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord)); - EntityNukeTorex.statFac(shell.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, BombConfig.missileRadius); + EntityNukeTorex.statFacStandard(shell.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, BombConfig.missileRadius); shell.setDead(); } }; diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFolly.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFolly.java index 86461c4ee..793284b3d 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFolly.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryFolly.java @@ -93,7 +93,7 @@ public class XFactoryFolly { if(bullet.isDead) return; bullet.setDead(); bullet.worldObj.spawnEntityInWorld(EntityNukeExplosionMK5.statFac(bullet.worldObj, 100, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord)); - EntityNukeTorex.statFac(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 100); + EntityNukeTorex.statFacStandard(bullet.worldObj, mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord, 100); }; public static void init() { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java index 3a6712af9..6acc2532f 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreEmitter.java @@ -3,6 +3,7 @@ package com.hbm.tileentity.machine; import api.hbm.block.ILaserable; import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardReceiver; +import api.hbm.redstoneoverradio.IRORInteractive; import api.hbm.tile.IInfoProviderEC; import com.hbm.handler.CompatHandler; @@ -38,7 +39,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.List; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) -public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEnergyReceiverMK2, ILaserable, IFluidStandardReceiver, SimpleComponent, IGUIProvider, IInfoProviderEC, CompatHandler.OCComponent { +public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEnergyReceiverMK2, ILaserable, IFluidStandardReceiver, SimpleComponent, IGUIProvider, IInfoProviderEC, CompatHandler.OCComponent, IRORInteractive { public long power; public static final long maxPower = 1000000000L; @@ -336,4 +337,46 @@ public class TileEntityCoreEmitter extends TileEntityMachineBase implements IEne data.setDouble(CompatEnergyControl.D_CONSUMPTION_MB, joules > 0 || prev > 0 ? 20 : 0); data.setDouble(CompatEnergyControl.D_CONSUMPTION_HE, maxPower * watts / 2000); } + + @Override + public String[] getFunctionInfo() { + return new String[] { + PREFIX_FUNCTION + "setpower" + NAME_SEPARATOR + "percent", + PREFIX_FUNCTION + "toggle", + PREFIX_FUNCTION + "switch" + NAME_SEPARATOR + "on/off", + }; + } + + @Override + public String runRORFunction(String name, String[] params) { + + if((PREFIX_FUNCTION + "setpower").equals(name) && params.length > 0) { + int watts = IRORInteractive.parseInt(params[0], 0, 100); + this.watts = watts; + this.markChanged(); + return null; + } + + if((PREFIX_FUNCTION + "toggle").equals(name)) { + this.isOn = !this.isOn; + this.markChanged(); + return null; + } + + + if((PREFIX_FUNCTION + "switch").equals(name) && params.length > 0) { + if("on".equals(params[0])) { + this.isOn = true; + this.markChanged(); + return null; + } + if("off".equals(params[0])) { + this.isOn = false; + this.markChanged(); + return null; + } + } + + return null; + } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java index 2647d4c6e..df1890191 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreStabilizer.java @@ -10,6 +10,8 @@ import com.hbm.tileentity.TileEntityMachineBase; import com.hbm.util.CompatEnergyControl; import api.hbm.energymk2.IEnergyReceiverMK2; +import api.hbm.redstoneoverradio.IRORInteractive; +import api.hbm.redstoneoverradio.IRORValueProvider; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; @@ -29,7 +31,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) -public class TileEntityCoreStabilizer extends TileEntityMachineBase implements IEnergyReceiverMK2, SimpleComponent, IGUIProvider, IInfoProviderEC, CompatHandler.OCComponent { +public class TileEntityCoreStabilizer extends TileEntityMachineBase implements IEnergyReceiverMK2, SimpleComponent, IGUIProvider, IInfoProviderEC, CompatHandler.OCComponent, IRORValueProvider, IRORInteractive { public long power; public static final long maxPower = 2500000000L; @@ -245,4 +247,33 @@ public class TileEntityCoreStabilizer extends TileEntityMachineBase implements I else data.setDouble(CompatEnergyControl.D_CONSUMPTION_HE, 0); } + + @Override + public String[] getFunctionInfo() { + return new String[] { + PREFIX_VALUE + "durability", + PREFIX_VALUE + "durabilitypercent", + PREFIX_FUNCTION + "setpower" + NAME_SEPARATOR + "percent", + }; + } + + @Override + public String provideRORValue(String name) { + if((PREFIX_VALUE + "durability").equals(name)) return (slots[0] != null && slots[0].getItem() == ModItems.ams_lens) ? "" + (((ItemLens) slots[0].getItem()).maxDamage - ItemLens.getLensDamage(slots[0])) : "0"; + if((PREFIX_VALUE + "durabilitypercent").equals(name)) return (slots[0] != null && slots[0].getItem() == ModItems.ams_lens) ? "" + ((((ItemLens) slots[0].getItem()).maxDamage - ItemLens.getLensDamage(slots[0])) * 100 / ((ItemLens) slots[0].getItem()).maxDamage) : "0"; + return null; + } + + @Override + public String runRORFunction(String name, String[] params) { + + if((PREFIX_FUNCTION + "setpower").equals(name) && params.length > 0) { + int watts = IRORInteractive.parseInt(params[0], 0, 100); + this.watts = watts; + this.markChanged(); + return null; + } + + return null; + } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java b/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java index fd92fb157..1b75df130 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java @@ -32,6 +32,8 @@ import com.hbm.util.fauxpointtwelve.DirPos; import api.hbm.energymk2.IEnergyReceiverMK2; import api.hbm.fluid.IFluidStandardTransceiver; +import api.hbm.redstoneoverradio.IRORInteractive; +import api.hbm.redstoneoverradio.IRORValueProvider; import api.hbm.tile.IInfoProviderEC; import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; @@ -52,7 +54,7 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "OpenComputers")}) -public class TileEntityITER extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiver, IGUIProvider, IInfoProviderEC, SimpleComponent, CompatHandler.OCComponent, IFluidCopiable { +public class TileEntityITER extends TileEntityMachineBase implements IEnergyReceiverMK2, IFluidStandardTransceiver, IGUIProvider, IInfoProviderEC, SimpleComponent, CompatHandler.OCComponent, IFluidCopiable, IRORValueProvider, IRORInteractive { public long power; public static final long maxPower = 10000000; @@ -657,4 +659,47 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece public FluidTank getTankToPaste() { return null; } + + @Override + public String[] getFunctionInfo() { + return new String[] { + PREFIX_VALUE + "durability", + PREFIX_VALUE + "durabilitypercent", + PREFIX_FUNCTION + "toggle", + PREFIX_FUNCTION + "switch" + NAME_SEPARATOR + "on/off", + }; + } + + @Override + public String provideRORValue(String name) { + if((PREFIX_VALUE + "durability").equals(name)) return (slots[3] != null && slots[3].getItem() instanceof ItemFusionShield) ? "" + (((ItemFusionShield) slots[3].getItem()).maxDamage - ItemFusionShield.getShieldDamage(slots[3])) : "0"; + if((PREFIX_VALUE + "durabilitypercent").equals(name)) return (slots[3] != null && slots[3].getItem() instanceof ItemFusionShield) ? "" + ((((ItemFusionShield) slots[3].getItem()).maxDamage - ItemFusionShield.getShieldDamage(slots[3])) * 100 / ((ItemFusionShield) slots[3].getItem()).maxDamage) : "0"; + return null; + } + + @Override + public String runRORFunction(String name, String[] params) { + + if((PREFIX_FUNCTION + "toggle").equals(name)) { + this.isOn = !this.isOn; + this.markChanged(); + return null; + } + + + if((PREFIX_FUNCTION + "switch").equals(name) && params.length > 0) { + if("on".equals(params[0])) { + this.isOn = true; + this.markChanged(); + return null; + } + if("off".equals(params[0])) { + this.isOn = false; + this.markChanged(); + return null; + } + } + + return null; + } }