reworked custom nuke

Right foot two stomps <dun dun>
Left foot two stomps <dun dun>
Slide to the left <dun>
Slide to the right <dun>
Criss cross  <dun dun>
Criss cross <dun dun>
Cha cha real smooth
<dun dada da dun dududada>
Let's go to work
This commit is contained in:
Boblet 2020-08-07 10:39:39 +02:00
parent fcdc2e7db3
commit 7af43a14fa
5 changed files with 326 additions and 553 deletions

View File

@ -8,6 +8,9 @@ import com.hbm.entity.effect.EntityNukeCloudBig;
import com.hbm.entity.effect.EntityNukeCloudNoShroom; import com.hbm.entity.effect.EntityNukeCloudNoShroom;
import com.hbm.entity.effect.EntityNukeCloudSmall; import com.hbm.entity.effect.EntityNukeCloudSmall;
import com.hbm.entity.grenade.EntityGrenadeZOMG; import com.hbm.entity.grenade.EntityGrenadeZOMG;
import com.hbm.entity.logic.EntityBalefire;
import com.hbm.entity.logic.EntityNukeExplosionMK3;
import com.hbm.entity.logic.EntityNukeExplosionMK4;
import com.hbm.entity.logic.EntityNukeExplosionPlus; import com.hbm.entity.logic.EntityNukeExplosionPlus;
import com.hbm.entity.projectile.EntityFallingNuke; import com.hbm.entity.projectile.EntityFallingNuke;
import com.hbm.explosion.ExplosionChaos; import com.hbm.explosion.ExplosionChaos;
@ -15,6 +18,7 @@ import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionParticle; import com.hbm.explosion.ExplosionParticle;
import com.hbm.explosion.ExplosionParticleB; import com.hbm.explosion.ExplosionParticleB;
import com.hbm.interfaces.IBomb; import com.hbm.interfaces.IBomb;
import com.hbm.interfaces.Untested;
import com.hbm.main.MainRegistry; import com.hbm.main.MainRegistry;
import com.hbm.tileentity.bomb.TileEntityNukeCustom; import com.hbm.tileentity.bomb.TileEntityNukeCustom;
@ -32,13 +36,13 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
@Untested
public class NukeCustom extends BlockContainer implements IBomb { public class NukeCustom extends BlockContainer implements IBomb {
public TileEntityNukeCustom tetn = new TileEntityNukeCustom(); public TileEntityNukeCustom tetn = new TileEntityNukeCustom();
private static boolean keepInventory = false; private static boolean keepInventory = false;
private final static Random field_149933_a = new Random(); private final static Random field_149933_a = new Random();
private boolean isExploding = false;
public NukeCustom(Material p_i45386_1_) { public NukeCustom(Material p_i45386_1_) {
super(p_i45386_1_); super(p_i45386_1_);
@ -55,8 +59,8 @@ public class NukeCustom extends BlockContainer implements IBomb {
} }
@Override @Override
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_) {
int p_149749_6_) {
if (!keepInventory) { if (!keepInventory) {
TileEntityNukeCustom tileentityfurnace = (TileEntityNukeCustom) p_149749_1_.getTileEntity(p_149749_2_, TileEntityNukeCustom tileentityfurnace = (TileEntityNukeCustom) p_149749_1_.getTileEntity(p_149749_2_,
p_149749_3_, p_149749_4_); p_149749_3_, p_149749_4_);
@ -104,253 +108,100 @@ public class NukeCustom extends BlockContainer implements IBomb {
} }
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
float hitY, float hitZ) {
if (world.isRemote) { if (world.isRemote) {
return true; return true;
} else if (!player.isSneaking()) { } else if (!player.isSneaking()) {
TileEntityNukeCustom entity = (TileEntityNukeCustom) world.getTileEntity(x, y, z); TileEntityNukeCustom entity = (TileEntityNukeCustom) world.getTileEntity(x, y, z);
if (entity != null) { if (entity != null) {
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_custom, world, x, y, z); FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_custom, world, x, y, z);
} }
return true; return true;
} else { } else {
return false; return false;
} }
} }
@Override @Override
public void onNeighborBlockChange(World p_149695_1_, int x, int y, int z, Block p_149695_5_) { public void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
TileEntityNukeCustom entity = (TileEntityNukeCustom) p_149695_1_.getTileEntity(x, y, z);
if (p_149695_1_.isBlockIndirectlyGettingPowered(x, y, z) && !p_149695_1_.isRemote) { TileEntityNukeCustom entity = (TileEntityNukeCustom) world.getTileEntity(x, y, z);
if (entity.isReady()) { if (world.isBlockIndirectlyGettingPowered(x, y, z) && !world.isRemote) {
float[] f = entity.returnAllValues(); this.explode(world, x, y, z);
boolean fall = entity.falls;
int meta = p_149695_1_.getBlockMetadata(x, y, z);
this.onBlockDestroyedByPlayer(p_149695_1_, x, y, z, 1);
entity.clearSlots();
p_149695_1_.setBlockToAir(x, y, z);
igniteTestBomb(p_149695_1_, x, y, z, f, fall, meta);
}
} }
} }
public boolean igniteTestBomb(World world, int x, int y, int z, float[] f, boolean fall, int meta) { public static void explodeCustom(World worldObj, double xCoord, double yCoord, double zCoord, float tnt, float nuke, float hydro, float amat, float dirty, float schrab, float euph) {
if (!world.isRemote) {
float tnt = f[0];
float nuke = f[1];
float hydro = f[2];
float amat = f[3];
float dirty = f[4];
float schrab = f[5];
float euph = f[6];
if(!fall) {
explodeCustom(world, x + 0.5, y + 0.5, z + 0.5, tnt, nuke, hydro, amat, dirty, schrab, euph);
world.playSoundEffect(x, y, z, "random.explode", 1.0f, world.rand.nextFloat() * 0.1F + 0.9F);
} else {
EntityFallingNuke bomb = new EntityFallingNuke(world, tnt, nuke, hydro, amat, dirty, schrab, euph);
bomb.getDataWatcher().updateObject(20, (byte)meta);
bomb.setPositionAndRotation(x + 0.5, y, z + 0.5, 0, 0);
world.spawnEntityInWorld(bomb);
}
}
return false;
}
public static void explodeCustom(World world, double posX, double posY, double posZ, float tnt, float nuke, float hydro, float amat, float dirty, float schrab, float euph) {
/// EUPHEMIUM ///
if(euph > 0) { if(euph > 0) {
EntityGrenadeZOMG zomg = new EntityGrenadeZOMG(world);
zomg.posX = posX; EntityGrenadeZOMG zomg = new EntityGrenadeZOMG(worldObj, xCoord, yCoord, zCoord);
zomg.posY = posY; ExplosionChaos.zomgMeSinPi(worldObj, xCoord, yCoord, zCoord, 1000, null, zomg);
zomg.posZ = posZ;
ExplosionChaos.zomgMeSinPi(world, posX, posY, posZ, 1000, null, zomg); // SCHRABIDIUM ///
} else if(schrab > 0) { } else if(schrab > 0) {
nuke += (tnt/2);
hydro += (nuke/2);
amat += (hydro/2);
schrab += (amat/2);
if(schrab > 300) schrab += amat / 2 + hydro / 4 + nuke / 8 + tnt / 16;
schrab = 300; schrab = Math.min(schrab, 250);
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world); EntityNukeExplosionMK3 entity = new EntityNukeExplosionMK3(worldObj);
entity.posX = posX; entity.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
entity.posY = posY; entity.destructionRange = (int) schrab;
entity.posZ = posZ; entity.speed = MainRegistry.blastSpeed;
entity.destructionRange = (int)schrab; entity.coefficient = 1.0F;
entity.speed = MainRegistry.blastSpeed; entity.waste = false;
entity.coefficient = 1.0F; worldObj.spawnEntityInWorld(entity);
entity.waste = false;
world.spawnEntityInWorld(entity); EntityCloudFleija cloud = new EntityCloudFleija(worldObj, (int)schrab);
cloud.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
worldObj.spawnEntityInWorld(cloud);
EntityCloudFleija cloud = new EntityCloudFleija(world, (int)schrab); /// ANTIMATTER ///
cloud.posX = posX; } else if(amat > 0) {
cloud.posY = posY;
cloud.posZ = posZ;
world.spawnEntityInWorld(cloud);
} else if (amat > 0) { amat += hydro / 2 + nuke / 4 + tnt / 8;
nuke += (tnt/2); amat = Math.min(amat, 350);
hydro += (nuke/2);
amat += (hydro/2);
if(amat > 350) EntityBalefire bf = new EntityBalefire(worldObj);
amat = 350; bf.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
bf.destructionRange = (int) amat;
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world); worldObj.spawnEntityInWorld(bf);
entity.posX = posX; worldObj.spawnEntityInWorld(EntityNukeCloudSmall.statFacBale(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, amat * 1.5F, 1000));
entity.posY = posY;
entity.posZ = posZ;
entity.destructionRange = (int)amat;
entity.speed = 25;
entity.coefficient = 10.0F;
entity.wasteRange = (int) (amat * 1.4) + (int) dirty;
world.spawnEntityInWorld(entity);
if(amat < 75) {
ExplosionParticleB.spawnMush(world, posX, posY, posZ);
} else if(amat < 200) {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, amat * 0.005F);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
} else {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudBig entity2 = new EntityNukeCloudBig(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
}
/// HYDROGEN ///
} else if(hydro > 0) { } else if(hydro > 0) {
nuke += (tnt/2);
hydro += (nuke/2);
if(hydro > 350) hydro += nuke / 2 + tnt / 4;
hydro = 350; hydro = Math.min(hydro, 350);
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world); worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(worldObj, (int)hydro, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5));
entity.posX = posX; worldObj.spawnEntityInWorld(EntityNukeCloudSmall.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, hydro));
entity.posY = posY;
entity.posZ = posZ;
entity.destructionRange = (int)hydro;
entity.speed = 25;
entity.coefficient = 10.0F;
entity.wasteRange = (int) (hydro * 1.4) + (int) dirty;
world.spawnEntityInWorld(entity);
if(hydro < 75) {
ExplosionParticle.spawnMush(world, posX, posY, posZ);
} else if(hydro < 200) {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, hydro * 0.005F);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
} else {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudBig entity2 = new EntityNukeCloudBig(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
}
/// NUCLEAR ///
} else if(nuke > 0) { } else if(nuke > 0) {
nuke += (tnt/2);
if(nuke > 350) nuke += tnt / 2;
nuke = 350; nuke = Math.min(nuke, 200);
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world); worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(worldObj, (int)nuke, xCoord + 0.5, yCoord + 5, zCoord + 0.5));
entity.posX = posX; worldObj.spawnEntityInWorld(EntityNukeCloudSmall.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, nuke));
entity.posY = posY;
entity.posZ = posZ;
entity.destructionRange = (int)nuke;
entity.speed = 25;
entity.coefficient = 10.0F;
entity.wasteRange = (int) (nuke * 1.4) + (int) dirty;
world.spawnEntityInWorld(entity); /// NON-NUCLEAR ///
} else if(tnt >= 75) {
if(nuke < 75) { tnt = Math.min(tnt, 150);
ExplosionParticle.spawnMush(world, posX, posY, posZ);
} else if(nuke < 200) {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudSmall entity2 = new EntityNukeCloudSmall(world, 1000, nuke * 0.005F);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
} else {
if(MainRegistry.enableNukeClouds) {
EntityNukeCloudBig entity2 = new EntityNukeCloudBig(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
} else {
EntityNukeCloudSmall entity2 = new EntityNukeCloudNoShroom(world, 1000);
entity2.posX = posX;
entity2.posY = posY;
entity2.posZ = posZ;
world.spawnEntityInWorld(entity2);
}
}
worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFacNoRad(worldObj, (int)tnt, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5));
worldObj.spawnEntityInWorld(EntityNukeCloudSmall.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, tnt));
} else if(tnt > 0) { } else if(tnt > 0) {
if(tnt > 100) ExplosionLarge.explode(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, tnt, true, true, true);
tnt = 100;
ExplosionLarge.explode(world, posX, posY, posZ, tnt, true, true, true);
} }
} }
@ -389,17 +240,23 @@ public class NukeCustom extends BlockContainer implements IBomb {
@Override @Override
public void explode(World world, int x, int y, int z) { public void explode(World world, int x, int y, int z) {
TileEntityNukeCustom entity = (TileEntityNukeCustom) world.getTileEntity(x, y, z); TileEntityNukeCustom entity = (TileEntityNukeCustom) world.getTileEntity(x, y, z);
{
if (entity.isReady()) { if(!entity.isFalling()) {
float[] f = entity.returnAllValues();
boolean fall = entity.falls; entity.destruct();
int meta = world.getBlockMetadata(x, y, z); NukeCustom.explodeCustom(world, x + 0.5, y + 0.5, z + 0.5, entity.tnt, entity.nuke, entity.hydro, entity.amat, entity.dirty, entity.schrab, entity.euph);
this.onBlockDestroyedByPlayer(world, x, y, z, 1);
entity.clearSlots(); } else {
world.setBlockToAir(x, y, z);
igniteTestBomb(world, x, y, z, f, fall, meta); EntityFallingNuke bomb = new EntityFallingNuke(world, entity.tnt, entity.nuke, entity.hydro, entity.amat, entity.dirty, entity.schrab, entity.euph);
} bomb.getDataWatcher().updateObject(20, (byte)world.getBlockMetadata(x, y, z));
bomb.setPositionAndRotation(x + 0.5, y, z + 0.5, 0, 0);
entity.clearSlots();
world.setBlockToAir(x, y, z);
world.spawnEntityInWorld(bomb);
} }
} }
} }

View File

@ -12,7 +12,7 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
public class GUINukeCustom extends GuiContainer { public class GUINukeCustom extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/weapon/gunBombSchematic.png"); private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/weapon/gunBombSchematic.png");
private TileEntityNukeCustom testNuke; private TileEntityNukeCustom testNuke;
@ -39,33 +39,24 @@ public class GUINukeCustom extends GuiContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture); Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(this.testNuke.tntStrength > 0) if(this.testNuke.euph > 0)
{
drawTexturedModalRect(guiLeft + 16, guiTop + 89, 176, 0, 18, 18);
}
if(this.testNuke.nukeStrength > 0)
{
drawTexturedModalRect(guiLeft + 34, guiTop + 89, 176, 18, 18, 18);
}
if(this.testNuke.hydroStrength > 0)
{
drawTexturedModalRect(guiLeft + 52, guiTop + 89, 176, 36, 18, 18);
}
if(this.testNuke.amatStrength > 0)
{
drawTexturedModalRect(guiLeft + 70, guiTop + 89, 176, 54, 18, 18);
}
if(this.testNuke.dirtyStrength > 0)
{
drawTexturedModalRect(guiLeft + 88, guiTop + 89, 176, 72, 18, 18);
}
if(this.testNuke.schrabStrength > 0)
{
drawTexturedModalRect(guiLeft + 106, guiTop + 89, 176, 90, 18, 18);
}
if(this.testNuke.euphStrength > 0)
{
drawTexturedModalRect(guiLeft + 142, guiTop + 89, 176, 108, 18, 18); drawTexturedModalRect(guiLeft + 142, guiTop + 89, 176, 108, 18, 18);
} else if(this.testNuke.schrab > 0)
drawTexturedModalRect(guiLeft + 106, guiTop + 89, 176, 90, 18, 18);
else if(this.testNuke.amat > 0)
drawTexturedModalRect(guiLeft + 70, guiTop + 89, 176, 54, 18, 18);
else if(this.testNuke.hydro > 0)
drawTexturedModalRect(guiLeft + 52, guiTop + 89, 176, 36, 18, 18);
else if(this.testNuke.nuke > 0)
drawTexturedModalRect(guiLeft + 34, guiTop + 89, 176, 18, 18, 18);
else if(this.testNuke.tnt > 0)
drawTexturedModalRect(guiLeft + 16, guiTop + 89, 176, 0, 18, 18);
if(this.testNuke.dirty > 0 &&
this.testNuke.nuke > 0 &&
this.testNuke.amat == 0 &&
this.testNuke.schrab == 0 &&
this.testNuke.euph == 0)
drawTexturedModalRect(guiLeft + 88, guiTop + 89, 176, 72, 18, 18);
} }
} }

View File

@ -10,6 +10,7 @@ import com.hbm.handler.GunConfiguration;
import com.hbm.handler.HazmatRegistry; import com.hbm.handler.HazmatRegistry;
import com.hbm.interfaces.IHoldableWeapon; import com.hbm.interfaces.IHoldableWeapon;
import com.hbm.interfaces.Spaghetti; import com.hbm.interfaces.Spaghetti;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.items.weapon.ItemGunBase; import com.hbm.items.weapon.ItemGunBase;
import com.hbm.lib.Library; import com.hbm.lib.Library;
@ -25,6 +26,9 @@ import com.hbm.sound.MovingSoundChopperMine;
import com.hbm.sound.MovingSoundCrashing; import com.hbm.sound.MovingSoundCrashing;
import com.hbm.sound.MovingSoundPlayerLoop; import com.hbm.sound.MovingSoundPlayerLoop;
import com.hbm.sound.MovingSoundXVL1456; import com.hbm.sound.MovingSoundXVL1456;
import com.hbm.tileentity.bomb.TileEntityNukeCustom;
import com.hbm.tileentity.bomb.TileEntityNukeCustom.CustomNukeEntry;
import com.hbm.tileentity.bomb.TileEntityNukeCustom.EnumEntryType;
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type; import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
import com.hbm.sound.MovingSoundPlayerLoop.EnumHbmSound; import com.hbm.sound.MovingSoundPlayerLoop.EnumHbmSound;
@ -267,6 +271,22 @@ public class ModEventHandlerClient {
if(rad > 0) if(rad > 0)
list.add(EnumChatFormatting.YELLOW + "Radiation resistance: " + rad); list.add(EnumChatFormatting.YELLOW + "Radiation resistance: " + rad);
ComparableStack comp = new ComparableStack(stack).makeSingular();
CustomNukeEntry entry = TileEntityNukeCustom.entries.get(comp);
if(entry != null) {
if(!list.isEmpty())
list.add("");
if(entry.entry == EnumEntryType.ADD)
list.add(EnumChatFormatting.GOLD + "Adds " + entry.value + " to the custom nuke stage " + entry.type);
if(entry.entry == EnumEntryType.MULT)
list.add(EnumChatFormatting.GOLD + "Adds multiplier " + entry.value + " to the custom nuke stage " + entry.type);
}
} }
public static IIcon particleBase; public static IIcon particleBase;

View File

@ -212,11 +212,6 @@ public class AuxGaugePacket implements IMessage {
if(m.id == 0) if(m.id == 0)
boiler.heat = m.value; boiler.heat = m.value;
} }
if (te instanceof TileEntityNukeCustom) {
TileEntityNukeCustom nuke = (TileEntityNukeCustom)te;
nuke.falls = m.value == 1;
}
if (te instanceof TileEntityNukeN45) { if (te instanceof TileEntityNukeN45) {
TileEntityNukeN45 nuke = (TileEntityNukeN45)te; TileEntityNukeN45 nuke = (TileEntityNukeN45)te;

View File

@ -1,7 +1,20 @@
package com.hbm.tileentity.bomb; package com.hbm.tileentity.bomb;
import java.util.HashMap;
import com.hbm.blocks.ModBlocks; import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.bomb.NukeCustom;
import com.hbm.entity.effect.EntityCloudFleija;
import com.hbm.entity.effect.EntityNukeCloudSmall;
import com.hbm.entity.grenade.EntityGrenadeZOMG;
import com.hbm.entity.logic.EntityBalefire;
import com.hbm.entity.logic.EntityNukeExplosionMK3;
import com.hbm.entity.logic.EntityNukeExplosionMK4;
import com.hbm.explosion.ExplosionChaos;
import com.hbm.explosion.ExplosionLarge;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems; import com.hbm.items.ModItems;
import com.hbm.main.MainRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -20,25 +33,9 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
public ItemStack slots[]; public ItemStack slots[];
private String customName; private String customName;
public float tntStrength;
public float nukeStrength;
public float hydroStrength;
public float amatStrength;
public float dirtyStrength;
public float schrabStrength;
public float euphStrength;
public boolean falls;
public TileEntityNukeCustom() { public TileEntityNukeCustom() {
slots = new ItemStack[27]; slots = new ItemStack[27];
tntStrength = 0;
nukeStrength = 0;
hydroStrength = 0;
amatStrength = 0;
dirtyStrength = 0;
schrabStrength = 0;
euphStrength = 0;
falls = false;
} }
@Override @Override
@ -150,12 +147,13 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
@Override @Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) { public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return j != 0 || i != 1 || itemStack.getItem() == Items.bucket; return false;
} }
@Override @Override
public void readFromNBT(NBTTagCompound nbt) { public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt); super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10); NBTTagList list = nbt.getTagList("items", 10);
slots = new ItemStack[getSizeInventory()]; slots = new ItemStack[getSizeInventory()];
@ -173,6 +171,7 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
@Override @Override
public void writeToNBT(NBTTagCompound nbt) { public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt); super.writeToNBT(nbt);
NBTTagList list = new NBTTagList(); NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++) for(int i = 0; i < slots.length; i++)
@ -188,298 +187,165 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
nbt.setTag("items", list); nbt.setTag("items", list);
} }
public static HashMap<ComparableStack, CustomNukeEntry> entries = new HashMap();
public static void registerBombItems() {
entries.put(new ComparableStack(Items.gunpowder), new CustomNukeEntry(EnumBombType.TNT, 0.8F));
entries.put(new ComparableStack(Blocks.tnt), new CustomNukeEntry(EnumBombType.TNT, 4F));
entries.put(new ComparableStack(ModBlocks.det_cord), new CustomNukeEntry(EnumBombType.TNT, 1.5F));
entries.put(new ComparableStack(ModBlocks.det_charge), new CustomNukeEntry(EnumBombType.TNT, 15F));
entries.put(new ComparableStack(ModItems.canister_fuel), new CustomNukeEntry(EnumBombType.TNT, 0.5F));
entries.put(new ComparableStack(ModItems.canister_napalm), new CustomNukeEntry(EnumBombType.TNT, 2.5F));
entries.put(new ComparableStack(ModItems.canister_kerosene), new CustomNukeEntry(EnumBombType.TNT, 0.8F));
entries.put(new ComparableStack(ModBlocks.red_barrel), new CustomNukeEntry(EnumBombType.TNT, 2.5F));
entries.put(new ComparableStack(ModBlocks.pink_barrel), new CustomNukeEntry(EnumBombType.TNT, 4F));
entries.put(new ComparableStack(ModItems.custom_tnt), new CustomNukeEntry(EnumBombType.TNT, 10F));
entries.put(new ComparableStack(ModItems.ingot_u235), new CustomNukeEntry(EnumBombType.NUKE, 15F));
entries.put(new ComparableStack(ModItems.ingot_pu239), new CustomNukeEntry(EnumBombType.NUKE, 25F));
entries.put(new ComparableStack(ModItems.ingot_neptunium), new CustomNukeEntry(EnumBombType.NUKE, 30F));
entries.put(new ComparableStack(ModItems.nugget_u235), new CustomNukeEntry(EnumBombType.NUKE, 1.5F));
entries.put(new ComparableStack(ModItems.nugget_pu239), new CustomNukeEntry(EnumBombType.NUKE, 2.5F));
entries.put(new ComparableStack(ModItems.nugget_neptunium), new CustomNukeEntry(EnumBombType.NUKE, 3.0F));
entries.put(new ComparableStack(ModItems.powder_neptunium), new CustomNukeEntry(EnumBombType.NUKE, 30F));
entries.put(new ComparableStack(ModItems.cell_deuterium), new CustomNukeEntry(EnumBombType.HYDRO, 20F));
entries.put(new ComparableStack(ModItems.cell_tritium), new CustomNukeEntry(EnumBombType.HYDRO, 30F));
entries.put(new ComparableStack(ModItems.lithium), new CustomNukeEntry(EnumBombType.HYDRO, 20F));
entries.put(new ComparableStack(ModItems.tritium_deuterium_cake), new CustomNukeEntry(EnumBombType.HYDRO, 200F));
entries.put(new ComparableStack(ModItems.custom_hydro), new CustomNukeEntry(EnumBombType.HYDRO, 30F));
entries.put(new ComparableStack(ModItems.cell_antimatter), new CustomNukeEntry(EnumBombType.AMAT, 5F));
entries.put(new ComparableStack(ModItems.custom_amat), new CustomNukeEntry(EnumBombType.AMAT, 15F));
entries.put(new ComparableStack(ModItems.egg_balefire_shard), new CustomNukeEntry(EnumBombType.AMAT, 25F));
entries.put(new ComparableStack(ModItems.egg_balefire), new CustomNukeEntry(EnumBombType.AMAT, 250F));
entries.put(new ComparableStack(ModItems.ingot_tungsten), new CustomNukeEntry(EnumBombType.DIRTY, 1F));
entries.put(new ComparableStack(ModItems.custom_dirty), new CustomNukeEntry(EnumBombType.DIRTY, 10F));
entries.put(new ComparableStack(ModItems.ingot_schrabidium), new CustomNukeEntry(EnumBombType.SCHRAB, 5F));
entries.put(new ComparableStack(ModBlocks.block_schrabidium), new CustomNukeEntry(EnumBombType.SCHRAB, 50F));
entries.put(new ComparableStack(ModItems.nugget_schrabidium), new CustomNukeEntry(EnumBombType.SCHRAB, 0.5F));
entries.put(new ComparableStack(ModItems.powder_schrabidium), new CustomNukeEntry(EnumBombType.SCHRAB, 5F));
entries.put(new ComparableStack(ModItems.cell_sas3), new CustomNukeEntry(EnumBombType.SCHRAB, 7.5F));
entries.put(new ComparableStack(ModItems.cell_anti_schrabidium), new CustomNukeEntry(EnumBombType.SCHRAB, 15F));
entries.put(new ComparableStack(ModItems.custom_schrab), new CustomNukeEntry(EnumBombType.SCHRAB, 15F));
entries.put(new ComparableStack(ModItems.custom_schrab), new CustomNukeEntry(EnumBombType.EUPH, 1F));
entries.put(new ComparableStack(ModItems.ingot_euphemium), new CustomNukeEntry(EnumBombType.EUPH, 1F));
entries.put(new ComparableStack(Items.redstone), new CustomNukeEntry(EnumBombType.TNT, 1.005F, EnumEntryType.MULT));
entries.put(new ComparableStack(Blocks.redstone_block), new CustomNukeEntry(EnumBombType.TNT, 1.05F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.ingot_uranium), new CustomNukeEntry(EnumBombType.NUKE, 1.05F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.ingot_plutonium), new CustomNukeEntry(EnumBombType.NUKE, 1.15F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.ingot_u238), new CustomNukeEntry(EnumBombType.NUKE, 1.1F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.ingot_pu238), new CustomNukeEntry(EnumBombType.NUKE, 1.15F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.nugget_uranium), new CustomNukeEntry(EnumBombType.NUKE, 1.005F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.nugget_plutonium), new CustomNukeEntry(EnumBombType.NUKE, 1.15F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.nugget_u238), new CustomNukeEntry(EnumBombType.NUKE, 1.01F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.nugget_pu238), new CustomNukeEntry(EnumBombType.NUKE, 1.015F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.powder_uranium), new CustomNukeEntry(EnumBombType.NUKE, 1.05F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.powder_plutonium), new CustomNukeEntry(EnumBombType.NUKE, 1.15F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.ingot_pu240), new CustomNukeEntry(EnumBombType.DIRTY, 1.05F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModItems.nuclear_waste), new CustomNukeEntry(EnumBombType.DIRTY, 1.025F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModBlocks.block_waste), new CustomNukeEntry(EnumBombType.DIRTY, 1.25F, EnumEntryType.MULT));
entries.put(new ComparableStack(ModBlocks.yellow_barrel), new CustomNukeEntry(EnumBombType.DIRTY, 1.2F, EnumEntryType.MULT));
}
public float tnt;
public float nuke;
public float hydro;
public float amat;
public float dirty;
public float schrab;
public float euph;
@SuppressWarnings("incomplete-switch")
@Override @Override
public void updateEntity() { public void updateEntity() {
this.tntStrength = 0; float tnt = 0F, tntMod = 1F;
this.nukeStrength = 0; float nuke = 0F, nukeMod = 1F;
this.hydroStrength = 0; float hydro = 0F, hydroMod = 1F;
this.amatStrength = 0; float amat = 0F, amatMod = 1F;
this.dirtyStrength = 0; float dirty = 0F, dirtyMod = 1F;
this.schrabStrength = 0; float schrab = 0F, schrabMod = 1F;
this.euphStrength = 0; float euph = 0F;
for(int i = 0; i < slots.length; i++) { for(ItemStack stack : slots) {
if(slots[i] != null) {
setValues(slots[i]); if(stack == null)
} continue;
if(slots[i] != null) {
setMultipliers(slots[i]); ComparableStack comp = new ComparableStack(stack).makeSingular();
CustomNukeEntry ent = entries.get(comp);
if(ent.entry == EnumEntryType.ADD) {
switch(ent.type) {
case TNT: tnt += ent.value; break;
case NUKE: nuke += ent.value; break;
case HYDRO: hydro += ent.value; break;
case AMAT: amat += ent.value; break;
case DIRTY: dirty += ent.value; break;
case SCHRAB: schrab += ent.value; break;
case EUPH: euph += ent.value; break;
}
} else if(ent.entry == EnumEntryType.MULT) {
switch(ent.type) {
case TNT: tntMod *= ent.value; break;
case NUKE: nukeMod *= ent.value; break;
case HYDRO: hydroMod *= ent.value; break;
case AMAT: amatMod *= ent.value; break;
case DIRTY: dirtyMod *= ent.value; break;
case SCHRAB: schrabMod *= ent.value; break;
}
} }
} }
if(this.nukeStrength > 0 && this.tntStrength < 16) tnt *= tntMod;
this.nukeStrength = 0; nuke *= nukeMod;
if(this.hydroStrength > 0 && this.nukeStrength < 100) hydro *= hydroMod;
this.hydroStrength = 0; amat *= amatMod;
if(this.amatStrength > 0 && this.nukeStrength < 15) dirty *= dirtyMod;
this.amatStrength = 0; schrab *= schrabMod;
if(this.dirtyStrength > 0 && this.nukeStrength == 0)
this.dirtyStrength = 0; dirty = Math.min(dirty, 100);
if(this.schrabStrength > 0 && this.nukeStrength < 50)
this.schrabStrength = 0; if(tnt < 16) nuke = 0;
if(this.euphStrength > 0 && this.schrabStrength == 0) if(nuke < 100) hydro = 0;
this.euphStrength = 0; if(nuke < 50) amat = 0;
if(nuke < 50) schrab = 0;
if(schrab == 0) euph = 0;
this.tnt = tnt;
this.nuke = nuke;
this.hydro = hydro;
this.amat = amat;
this.dirty = dirty;
this.schrab = schrab;
this.euph = euph;
} }
public void setValues(ItemStack stack) { public boolean isFalling() {
Item item = stack.getItem(); for(ItemStack stack : slots) {
if(stack != null && stack.getItem() == ModItems.custom_fall)
for(int i = 0; i < stack.stackSize; i++) { return true;
if(item == Items.gunpowder) {
this.tntStrength += 0.8F;
}
if(item == Item.getItemFromBlock(Blocks.tnt)) {
this.tntStrength += 4;
}
if(item == Item.getItemFromBlock(ModBlocks.det_cord)) {
this.tntStrength += 1.5F;
}
if(item == Item.getItemFromBlock(ModBlocks.det_charge)) {
this.tntStrength += 15F;
}
if(item == ModItems.canister_fuel) {
this.tntStrength += 0.3F;
}
if(item == ModItems.canister_fuel) {
this.tntStrength += 0.5F;
}
if(item == Item.getItemFromBlock(ModBlocks.red_barrel)) {
this.tntStrength += 2.5F;
}
if(item == ModItems.gun_immolator_ammo) {
this.tntStrength += 0.055F;
}
if(item == ModItems.clip_immolator) {
this.tntStrength += 3.5F;
}
if(item == ModItems.custom_tnt) {
this.tntStrength += 10F;
}
//
if(item == ModItems.ingot_u235) {
this.nukeStrength += 15F;
}
if(item == ModItems.ingot_pu239) {
this.nukeStrength += 25F;
}
if(item == ModItems.ingot_neptunium) {
this.nukeStrength += 30F;
}
if(item == ModItems.nugget_u235) {
this.nukeStrength += 1.5F;
}
if(item == ModItems.nugget_pu239) {
this.nukeStrength += 2.5F;
}
if(item == ModItems.nugget_neptunium) {
this.nukeStrength += 3.0F;
}
if(item == ModItems.powder_neptunium) {
this.nukeStrength += 30F;
}
if(item == ModItems.custom_nuke) {
this.nukeStrength += 30F;
}
//
if(item == ModItems.cell_deuterium) {
this.hydroStrength += 20F;
}
if(item == ModItems.cell_tritium) {
this.hydroStrength += 30F;
}
if(item == ModItems.lithium) {
this.hydroStrength += 20F;
}
if(item == ModItems.tritium_deuterium_cake) {
this.hydroStrength += 200F;
}
if(item == ModItems.custom_hydro) {
this.hydroStrength += 30F;
}
//
if(item == ModItems.cell_antimatter) {
this.amatStrength += 5F;
}
if(item == ModItems.custom_amat) {
this.amatStrength += 15F;
}
//
if(item == ModItems.ingot_tungsten) {
this.dirtyStrength += 10F;
}
if(item == ModItems.nuclear_waste) {
this.dirtyStrength += 2.5F;
}
if(item == Item.getItemFromBlock(ModBlocks.yellow_barrel)) {
this.dirtyStrength += 20F;
}
if(item == Item.getItemFromBlock(ModBlocks.block_waste)) {
this.dirtyStrength += 25F;
}
if(item == ModItems.custom_dirty) {
this.dirtyStrength += 10F;
}
//
if(item == ModItems.ingot_schrabidium) {
this.schrabStrength += 5F;
}
if(item == Item.getItemFromBlock(ModBlocks.block_schrabidium)) {
this.schrabStrength += 50F;
}
if(item == ModItems.plate_schrabidium) {
this.schrabStrength += 1.25F;
}
if(item == ModItems.nugget_schrabidium) {
this.schrabStrength += 0.5F;
}
if(item == ModItems.cell_sas3) {
this.schrabStrength += 7.5F;
}
if(item == ModItems.cell_anti_schrabidium) {
this.schrabStrength += 15F;
}
if(item == ModItems.custom_schrab) {
this.schrabStrength += 15F;
}
//
if(item == ModItems.nugget_euphemium) {
this.euphStrength += 1F;
}
if(item == ModItems.ingot_euphemium) {
this.euphStrength += 1F;
}
if(item == ModItems.custom_fall) {
this.falls = true;
}
}
}
public void setMultipliers(ItemStack stack) {
Item item = stack.getItem();
for(int i = 0; i < stack.stackSize; i++) {
if(item == Items.redstone) {
this.tntStrength *= 1.005F;
}
if(item == Item.getItemFromBlock(Blocks.redstone_block)) {
this.tntStrength *= 1.05F;
}
if(item == ModItems.canister_fuel) {
this.tntStrength *= 1.025F;
}
if(item == ModItems.canister_napalm) {
this.tntStrength *= 1.035F;
}
if(item == Item.getItemFromBlock(ModBlocks.red_barrel)) {
this.tntStrength *= 1.2F;
}
if(item == ModItems.gun_immolator_ammo) {
this.tntStrength *= 1.0004F;
}
if(item == ModItems.clip_immolator) {
this.tntStrength *= 1.025F;
}
//
if(item == ModItems.ingot_u238) {
this.nukeStrength *= 1.1F;
this.hydroStrength *= 1.1F;
this.dirtyStrength *= 1.1F;
}
if(item == ModItems.ingot_pu238) {
this.nukeStrength *= 1.25F;
}
if(item == ModItems.ingot_pu240) {
this.nukeStrength *= 1.05F;
this.dirtyStrength *= 1.15F;
}
if(item == ModItems.ingot_neptunium) {
this.nukeStrength *= 1.35F;
this.dirtyStrength *= 1.15F;
}
if(item == ModItems.nugget_u238) {
this.nukeStrength *= 1.01F;
this.hydroStrength *= 1.01F;
}
if(item == ModItems.nugget_pu238) {
this.nukeStrength *= 1.025F;
}
if(item == ModItems.nugget_pu240) {
this.nukeStrength *= 1.005F;
this.dirtyStrength *= 1.015F;
}
if(item == ModItems.nugget_neptunium) {
this.nukeStrength *= 1.035F;
this.dirtyStrength *= 1.015F;
}
if(item == ModItems.powder_neptunium) {
this.nukeStrength *= 1.35F;
this.dirtyStrength *= 1.15F;
}
if(item == ModItems.ingot_uranium) {
this.nukeStrength *= 1.085F;
}
if(item == Item.getItemFromBlock(ModBlocks.block_uranium)) {
this.nukeStrength *= 1.85F;
}
if(item == ModItems.ingot_plutonium) {
this.nukeStrength *= 1.075F;
}
if(item == ModItems.nugget_uranium) {
this.nukeStrength *= 1.0085F;
}
if(item == ModItems.nugget_plutonium) {
this.nukeStrength *= 1.0075F;
}
if(item == ModItems.powder_uranium) {
this.nukeStrength *= 1.085F;
this.dirtyStrength *= 1.15F;
}
if(item == ModItems.powder_plutonium) {
this.nukeStrength *= 1.075F;
this.dirtyStrength *= 1.15F;
}
//
if(item == ModItems.cell_antimatter) {
this.amatStrength *= 1.1F;
}
//
if(item == ModItems.nuclear_waste) {
this.dirtyStrength *= 1.05F;
}
if(item == Item.getItemFromBlock(ModBlocks.yellow_barrel)) {
this.dirtyStrength *= 1.05F;
this.dirtyStrength *= 1.05F;
this.dirtyStrength *= 1.05F;
this.dirtyStrength *= 1.05F;
this.dirtyStrength *= 1.05F;
this.dirtyStrength *= 1.05F;
this.dirtyStrength *= 1.05F;
this.dirtyStrength *= 1.05F;
}
}
}
public boolean isReady() {
if(this.tntStrength > 0)
{
return true;
} }
return false; return false;
} }
public float[] returnAllValues() { public void destruct() {
return new float[] { this.tntStrength, this.nukeStrength, this.hydroStrength, this.amatStrength, this.dirtyStrength, this.schrabStrength, this.euphStrength };
clearSlots();
worldObj.func_147480_a(xCoord, yCoord, xCoord, false);
} }
public void clearSlots() { public void clearSlots() {
@ -500,4 +366,48 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
{ {
return 65536.0D; return 65536.0D;
} }
public static enum EnumBombType {
TNT("TNT"),
NUKE("Nuclear"),
HYDRO("Hydrogen"),
AMAT("Antimatter"),
DIRTY("Salted"),
SCHRAB("Schrabidium"),
EUPH("Anti Mass");
String name;
EnumBombType(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}
public static enum EnumEntryType {
ADD,
MULT
}
public static class CustomNukeEntry {
public EnumBombType type;
public EnumEntryType entry;
public float value;
public CustomNukeEntry(EnumBombType type, float value) {
this.type = type;
this.entry = EnumEntryType.ADD;
this.value = value;
}
public CustomNukeEntry(EnumBombType type, float value, EnumEntryType entry) {
this(type, value);
this.entry = entry;
}
}
} }