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.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.entity.logic.EntityNukeExplosionPlus;
import com.hbm.entity.projectile.EntityFallingNuke;
import com.hbm.explosion.ExplosionChaos;
@ -15,6 +18,7 @@ import com.hbm.explosion.ExplosionLarge;
import com.hbm.explosion.ExplosionParticle;
import com.hbm.explosion.ExplosionParticleB;
import com.hbm.interfaces.IBomb;
import com.hbm.interfaces.Untested;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.bomb.TileEntityNukeCustom;
@ -32,13 +36,13 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@Untested
public class NukeCustom extends BlockContainer implements IBomb {
public TileEntityNukeCustom tetn = new TileEntityNukeCustom();
private static boolean keepInventory = false;
private final static Random field_149933_a = new Random();
private boolean isExploding = false;
public NukeCustom(Material p_i45386_1_) {
super(p_i45386_1_);
@ -55,8 +59,8 @@ public class NukeCustom extends BlockContainer implements IBomb {
}
@Override
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_) {
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_) {
if (!keepInventory) {
TileEntityNukeCustom tileentityfurnace = (TileEntityNukeCustom) p_149749_1_.getTileEntity(p_149749_2_,
p_149749_3_, p_149749_4_);
@ -104,253 +108,100 @@ public class NukeCustom extends BlockContainer implements IBomb {
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX,
float hitY, float hitZ) {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
if (world.isRemote) {
return true;
} else if (!player.isSneaking()) {
TileEntityNukeCustom entity = (TileEntityNukeCustom) world.getTileEntity(x, y, z);
if (entity != null) {
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_nuke_custom, world, x, y, z);
}
return true;
} else {
return false;
}
}
@Override
public void onNeighborBlockChange(World p_149695_1_, 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) {
if (entity.isReady()) {
float[] f = entity.returnAllValues();
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 void onNeighborBlockChange(World world, int x, int y, int z, Block p_149695_5_) {
TileEntityNukeCustom entity = (TileEntityNukeCustom) world.getTileEntity(x, y, z);
if (world.isBlockIndirectlyGettingPowered(x, y, z) && !world.isRemote) {
this.explode(world, x, y, z);
}
}
public boolean igniteTestBomb(World world, int x, int y, int z, float[] f, boolean fall, int meta) {
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) {
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) {
/// EUPHEMIUM ///
if(euph > 0) {
EntityGrenadeZOMG zomg = new EntityGrenadeZOMG(world);
zomg.posX = posX;
zomg.posY = posY;
zomg.posZ = posZ;
ExplosionChaos.zomgMeSinPi(world, posX, posY, posZ, 1000, null, zomg);
EntityGrenadeZOMG zomg = new EntityGrenadeZOMG(worldObj, xCoord, yCoord, zCoord);
ExplosionChaos.zomgMeSinPi(worldObj, xCoord, yCoord, zCoord, 1000, null, zomg);
// SCHRABIDIUM ///
} else if(schrab > 0) {
nuke += (tnt/2);
hydro += (nuke/2);
amat += (hydro/2);
schrab += (amat/2);
if(schrab > 300)
schrab = 300;
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = posX;
entity.posY = posY;
entity.posZ = posZ;
entity.destructionRange = (int)schrab;
entity.speed = MainRegistry.blastSpeed;
entity.coefficient = 1.0F;
entity.waste = false;
schrab += amat / 2 + hydro / 4 + nuke / 8 + tnt / 16;
schrab = Math.min(schrab, 250);
world.spawnEntityInWorld(entity);
EntityNukeExplosionMK3 entity = new EntityNukeExplosionMK3(worldObj);
entity.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
entity.destructionRange = (int) schrab;
entity.speed = MainRegistry.blastSpeed;
entity.coefficient = 1.0F;
entity.waste = false;
worldObj.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);
cloud.posX = posX;
cloud.posY = posY;
cloud.posZ = posZ;
world.spawnEntityInWorld(cloud);
} else if (amat > 0) {
nuke += (tnt/2);
hydro += (nuke/2);
amat += (hydro/2);
/// ANTIMATTER ///
} else if(amat > 0) {
if(amat > 350)
amat = 350;
amat += hydro / 2 + nuke / 4 + tnt / 8;
amat = Math.min(amat, 350);
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = posX;
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);
}
}
EntityBalefire bf = new EntityBalefire(worldObj);
bf.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
bf.destructionRange = (int) amat;
worldObj.spawnEntityInWorld(bf);
worldObj.spawnEntityInWorld(EntityNukeCloudSmall.statFacBale(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, amat * 1.5F, 1000));
/// HYDROGEN ///
} else if(hydro > 0) {
nuke += (tnt/2);
hydro += (nuke/2);
if(hydro > 350)
hydro = 350;
hydro += nuke / 2 + tnt / 4;
hydro = Math.min(hydro, 350);
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = posX;
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);
}
}
worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(worldObj, (int)hydro, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5));
worldObj.spawnEntityInWorld(EntityNukeCloudSmall.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, hydro));
/// NUCLEAR ///
} else if(nuke > 0) {
nuke += (tnt/2);
if(nuke > 350)
nuke = 350;
EntityNukeExplosionPlus entity = new EntityNukeExplosionPlus(world);
entity.posX = posX;
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);
if(nuke < 75) {
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);
}
}
} else if(tnt > 0) {
nuke += tnt / 2;
nuke = Math.min(nuke, 200);
if(tnt > 100)
tnt = 100;
ExplosionLarge.explode(world, posX, posY, posZ, tnt, true, true, true);
worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(worldObj, (int)nuke, xCoord + 0.5, yCoord + 5, zCoord + 0.5));
worldObj.spawnEntityInWorld(EntityNukeCloudSmall.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, nuke));
/// NON-NUCLEAR ///
} else if(tnt >= 75) {
tnt = Math.min(tnt, 150);
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) {
ExplosionLarge.explode(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, tnt, true, true, true);
}
}
@ -389,17 +240,23 @@ public class NukeCustom extends BlockContainer implements IBomb {
@Override
public void explode(World world, int x, int y, int z) {
TileEntityNukeCustom entity = (TileEntityNukeCustom) world.getTileEntity(x, y, z);
{
if (entity.isReady()) {
float[] f = entity.returnAllValues();
boolean fall = entity.falls;
int meta = world.getBlockMetadata(x, y, z);
this.onBlockDestroyedByPlayer(world, x, y, z, 1);
entity.clearSlots();
world.setBlockToAir(x, y, z);
igniteTestBomb(world, x, y, z, f, fall, meta);
}
if(!entity.isFalling()) {
entity.destruct();
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);
} else {
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.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 TileEntityNukeCustom testNuke;
@ -39,33 +39,24 @@ public class GUINukeCustom extends GuiContainer {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
if(this.testNuke.tntStrength > 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)
{
if(this.testNuke.euph > 0)
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.interfaces.IHoldableWeapon;
import com.hbm.interfaces.Spaghetti;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.items.ModItems;
import com.hbm.items.weapon.ItemGunBase;
import com.hbm.lib.Library;
@ -25,6 +26,9 @@ import com.hbm.sound.MovingSoundChopperMine;
import com.hbm.sound.MovingSoundCrashing;
import com.hbm.sound.MovingSoundPlayerLoop;
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.hbm.sound.MovingSoundPlayerLoop.EnumHbmSound;
@ -267,6 +271,22 @@ public class ModEventHandlerClient {
if(rad > 0)
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;

View File

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

View File

@ -1,7 +1,20 @@
package com.hbm.tileentity.bomb;
import java.util.HashMap;
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.main.MainRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -20,25 +33,9 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
public ItemStack slots[];
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() {
slots = new ItemStack[27];
tntStrength = 0;
nukeStrength = 0;
hydroStrength = 0;
amatStrength = 0;
dirtyStrength = 0;
schrabStrength = 0;
euphStrength = 0;
falls = false;
}
@Override
@ -150,12 +147,13 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
@Override
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
return j != 0 || i != 1 || itemStack.getItem() == Items.bucket;
return false;
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
slots = new ItemStack[getSizeInventory()];
@ -173,6 +171,7 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
@ -188,298 +187,165 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
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
public void updateEntity() {
this.tntStrength = 0;
this.nukeStrength = 0;
this.hydroStrength = 0;
this.amatStrength = 0;
this.dirtyStrength = 0;
this.schrabStrength = 0;
this.euphStrength = 0;
for(int i = 0; i < slots.length; i++) {
if(slots[i] != null) {
setValues(slots[i]);
}
if(slots[i] != null) {
setMultipliers(slots[i]);
float tnt = 0F, tntMod = 1F;
float nuke = 0F, nukeMod = 1F;
float hydro = 0F, hydroMod = 1F;
float amat = 0F, amatMod = 1F;
float dirty = 0F, dirtyMod = 1F;
float schrab = 0F, schrabMod = 1F;
float euph = 0F;
for(ItemStack stack : slots) {
if(stack == null)
continue;
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;
}
}
}
tnt *= tntMod;
nuke *= nukeMod;
hydro *= hydroMod;
amat *= amatMod;
dirty *= dirtyMod;
schrab *= schrabMod;
if(this.nukeStrength > 0 && this.tntStrength < 16)
this.nukeStrength = 0;
if(this.hydroStrength > 0 && this.nukeStrength < 100)
this.hydroStrength = 0;
if(this.amatStrength > 0 && this.nukeStrength < 15)
this.amatStrength = 0;
if(this.dirtyStrength > 0 && this.nukeStrength == 0)
this.dirtyStrength = 0;
if(this.schrabStrength > 0 && this.nukeStrength < 50)
this.schrabStrength = 0;
if(this.euphStrength > 0 && this.schrabStrength == 0)
this.euphStrength = 0;
}
public void setValues(ItemStack stack) {
dirty = Math.min(dirty, 100);
Item item = stack.getItem();
for(int i = 0; i < stack.stackSize; i++) {
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(tnt < 16) nuke = 0;
if(nuke < 100) hydro = 0;
if(nuke < 50) amat = 0;
if(nuke < 50) schrab = 0;
if(schrab == 0) euph = 0;
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;
}
}
this.tnt = tnt;
this.nuke = nuke;
this.hydro = hydro;
this.amat = amat;
this.dirty = dirty;
this.schrab = schrab;
this.euph = euph;
}
public void setMultipliers(ItemStack stack) {
public boolean isFalling() {
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;
for(ItemStack stack : slots) {
if(stack != null && stack.getItem() == ModItems.custom_fall)
return true;
}
return false;
}
public float[] returnAllValues() {
return new float[] { this.tntStrength, this.nukeStrength, this.hydroStrength, this.amatStrength, this.dirtyStrength, this.schrabStrength, this.euphStrength };
public void destruct() {
clearSlots();
worldObj.func_147480_a(xCoord, yCoord, xCoord, false);
}
public void clearSlots() {
@ -500,4 +366,48 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory
{
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;
}
}
}