From 8e30e3a0b0b163b673edcdd4c2eeff888cfbef87 Mon Sep 17 00:00:00 2001 From: Bob Date: Fri, 7 Aug 2020 21:20:26 +0200 Subject: [PATCH] improved custom nuke GUI --- .../hbm/textures/items/powder_semtex_mix.png | Bin 0 -> 335 bytes .../java/com/hbm/blocks/bomb/NukeCustom.java | 27 ++++---- .../com/hbm/inventory/gui/GUINukeCustom.java | 55 ++++++++++++++++- .../com/hbm/items/special/ItemCustomLore.java | 32 ---------- .../tileentity/bomb/TileEntityNukeCustom.java | 58 +++++++++++++----- 5 files changed, 110 insertions(+), 62 deletions(-) create mode 100644 src/main/java/assets/hbm/textures/items/powder_semtex_mix.png diff --git a/src/main/java/assets/hbm/textures/items/powder_semtex_mix.png b/src/main/java/assets/hbm/textures/items/powder_semtex_mix.png new file mode 100644 index 0000000000000000000000000000000000000000..479f37299571bc0d00a1707c689afd90bfe1f0f7 GIT binary patch literal 335 zcmV-V0kHmwP)1uyVd$hx=QM3YS((_HhKXA+oxBSYFTh^Gxf3tI z#mPwG;^Yibq)fPxrY1N+pcG7;eWx>g&wJkQ2mUpxFbu0O46CskV+`H~inZqeR9b6s zu5K~}-`+T^J%>Esv+_-2OeI&m|I6K zuPhdhdlyB~u9u+hSxUufHYLtV?jJvpQZcuVq=kv^8rZhoNg~>C4X$R>P77&a0yIXS z#e^hD&{_-8PO$No_^#1|eb?aW?Hiy2HwoG%^?MsA(!y+heSUp!>e?%9S~%VF>BNWb h;LjSp(BICttseu9gEAY#Jjnn6002ovPDHLkV1m2bj=TT> literal 0 HcmV?d00001 diff --git a/src/main/java/com/hbm/blocks/bomb/NukeCustom.java b/src/main/java/com/hbm/blocks/bomb/NukeCustom.java index ad4f75221..68f3dca4c 100644 --- a/src/main/java/com/hbm/blocks/bomb/NukeCustom.java +++ b/src/main/java/com/hbm/blocks/bomb/NukeCustom.java @@ -4,19 +4,14 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.entity.effect.EntityCloudFleija; -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; 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; @@ -130,14 +125,21 @@ public class NukeCustom extends BlockContainer implements IBomb { @Override 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 static final int maxTnt = 150; + public static final int maxNuke = 200; + public static final int maxHydro = 350; + public static final int maxAmat = 350; + public static final int maxSchrab = 250; 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) { + dirty = Math.min(dirty, 100); + /// EUPHEMIUM /// if(euph > 0) { @@ -148,7 +150,7 @@ public class NukeCustom extends BlockContainer implements IBomb { } else if(schrab > 0) { schrab += amat / 2 + hydro / 4 + nuke / 8 + tnt / 16; - schrab = Math.min(schrab, 250); + schrab = Math.min(schrab, maxSchrab); EntityNukeExplosionMK3 entity = new EntityNukeExplosionMK3(worldObj); entity.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); @@ -166,7 +168,7 @@ public class NukeCustom extends BlockContainer implements IBomb { } else if(amat > 0) { amat += hydro / 2 + nuke / 4 + tnt / 8; - amat = Math.min(amat, 350); + amat = Math.min(amat, maxAmat); EntityBalefire bf = new EntityBalefire(worldObj); bf.setPosition(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5); @@ -178,7 +180,7 @@ public class NukeCustom extends BlockContainer implements IBomb { } else if(hydro > 0) { hydro += nuke / 2 + tnt / 4; - hydro = Math.min(hydro, 350); + hydro = Math.min(hydro, maxHydro); dirty *= 0.25F; worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(worldObj, (int)hydro, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).moreFallout((int)dirty)); @@ -188,7 +190,7 @@ public class NukeCustom extends BlockContainer implements IBomb { } else if(nuke > 0) { nuke += tnt / 2; - nuke = Math.min(nuke, 200); + nuke = Math.min(nuke, maxNuke); worldObj.spawnEntityInWorld(EntityNukeExplosionMK4.statFac(worldObj, (int)nuke, xCoord + 0.5, yCoord + 5, zCoord + 0.5).moreFallout((int)dirty)); worldObj.spawnEntityInWorld(EntityNukeCloudSmall.statFac(worldObj, xCoord + 0.5, yCoord + 5, zCoord + 0.5, nuke)); @@ -196,7 +198,7 @@ public class NukeCustom extends BlockContainer implements IBomb { /// NON-NUCLEAR /// } else if(tnt >= 75) { - tnt = Math.min(tnt, 150); + tnt = Math.min(tnt, maxTnt); 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)); @@ -246,7 +248,8 @@ public class NukeCustom extends BlockContainer implements IBomb { if(!entity.isFalling()) { - entity.destruct(); + entity.clearSlots(); + world.func_147480_a(x, y, z, false); 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 { diff --git a/src/main/java/com/hbm/inventory/gui/GUINukeCustom.java b/src/main/java/com/hbm/inventory/gui/GUINukeCustom.java index eaa432c14..b64e039fa 100644 --- a/src/main/java/com/hbm/inventory/gui/GUINukeCustom.java +++ b/src/main/java/com/hbm/inventory/gui/GUINukeCustom.java @@ -2,14 +2,15 @@ package com.hbm.inventory.gui; import org.lwjgl.opengl.GL11; +import com.hbm.blocks.bomb.NukeCustom; import com.hbm.inventory.container.ContainerNukeCustom; import com.hbm.lib.RefStrings; import com.hbm.tileentity.bomb.TileEntityNukeCustom; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; public class GUINukeCustom extends GuiInfoContainer { @@ -25,6 +26,58 @@ public class GUINukeCustom extends GuiInfoContainer { this.ySize = 222; } + @Override + public void drawScreen(int mouseX, int mouseY, float f) { + super.drawScreen(mouseX, mouseY, f); + + String[] text; + + text = new String[] { EnumChatFormatting.YELLOW + "Conventional Explosives (Level " + testNuke.tnt + "/" + Math.min(testNuke.tnt, NukeCustom.maxTnt) + ")", + "Caps at " + NukeCustom.maxTnt, + "N²-like above level 75", + EnumChatFormatting.ITALIC + "\"Goes boom\"" }; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 16, guiTop + 89, 18, 18, mouseX, mouseY, text); + + text = new String[] { EnumChatFormatting.YELLOW + "Nuclear (Level " + testNuke.nuke + "/" + testNuke.getNukeAdj() + ")", + "Requires TNT level 16", + "Caps at " + NukeCustom.maxNuke, + "Has fallout", + EnumChatFormatting.ITALIC + "\"Now I am become death, destroyer of worlds.\"" }; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 34, guiTop + 89, 18, 18, mouseX, mouseY, text); + + text = new String[] { EnumChatFormatting.YELLOW + "Thermonuclear (Level " + testNuke.hydro + "/" + testNuke.getHydroAdj() + ")", + "Requires nuclear level 100", + "Caps at " + NukeCustom.maxHydro, + "Reduces added fallout by salted stage by 75%", + EnumChatFormatting.ITALIC + "\"And for my next trick, I'll make", + EnumChatFormatting.ITALIC + "the island of Elugelab disappear!\"" }; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 52, guiTop + 89, 18, 18, mouseX, mouseY, text); + + text = new String[] { EnumChatFormatting.YELLOW + "Antimatter (Level " + testNuke.amat + "/" + testNuke.getAmatAdj() + ")", + "Requires nuclear level 50", + "Caps at " + NukeCustom.maxAmat, + EnumChatFormatting.ITALIC + "\"Antimatter, Balefire, whatever.\"" }; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 70, guiTop + 89, 18, 18, mouseX, mouseY, text); + + text = new String[] { EnumChatFormatting.YELLOW + "Salted (Level " + testNuke.dirty + "/" + Math.min(testNuke.dirty, 100) + ")", + "Extends fallout of nuclear and", + "thermonuclear stages", + "Caps at 100", + EnumChatFormatting.ITALIC + "\"Not to be confused with tablesalt.\"" }; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 88, guiTop + 89, 18, 18, mouseX, mouseY, text); + + text = new String[] { EnumChatFormatting.YELLOW + "Schrabidium (Level " + testNuke.schrab + "/" + testNuke.getSchrabAdj() + ")", + "Requires nuclear level 50", + "Caps at " + NukeCustom.maxSchrab, + EnumChatFormatting.ITALIC + "\"For the hundredth time,", + EnumChatFormatting.ITALIC + "you can't bypass these caps!\"" }; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 106, guiTop + 89, 18, 18, mouseX, mouseY, text); + + text = new String[] { EnumChatFormatting.YELLOW + "Ice cream (Level unknown)", + EnumChatFormatting.ITALIC + "\"Probably not ice cream but the label came off.\"" }; + this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 142, guiTop + 89, 18, 18, mouseX, mouseY, text); + } + @Override protected void drawGuiContainerForegroundLayer( int i, int j) { String name = this.testNuke.hasCustomInventoryName() ? this.testNuke.getInventoryName() : I18n.format(this.testNuke.getInventoryName()); diff --git a/src/main/java/com/hbm/items/special/ItemCustomLore.java b/src/main/java/com/hbm/items/special/ItemCustomLore.java index 76a6c752f..b202c3767 100644 --- a/src/main/java/com/hbm/items/special/ItemCustomLore.java +++ b/src/main/java/com/hbm/items/special/ItemCustomLore.java @@ -260,38 +260,6 @@ public class ItemCustomLore extends Item { list.add("All hail the spout!"); } - if(this == ModItems.custom_tnt) - { - list.add("Explosive +10"); - } - - if(this == ModItems.custom_nuke) - { - list.add("Nuclear +30"); - list.add("Adds fallout"); - } - - if(this == ModItems.custom_hydro) - { - list.add("Hydrogen +30"); - } - - if(this == ModItems.custom_amat) - { - list.add("Antimatter +15"); - } - - if(this == ModItems.custom_dirty) - { - list.add("Fallout +10"); - } - - if(this == ModItems.custom_schrab) - { - list.add("Schrabidium +15"); - list.add("Removes fallout"); - } - if(this == ModItems.custom_fall) { list.add("That's what you've aaaaaaall been waiting for!"); diff --git a/src/main/java/com/hbm/tileentity/bomb/TileEntityNukeCustom.java b/src/main/java/com/hbm/tileentity/bomb/TileEntityNukeCustom.java index 7de76144a..0ae630429 100644 --- a/src/main/java/com/hbm/tileentity/bomb/TileEntityNukeCustom.java +++ b/src/main/java/com/hbm/tileentity/bomb/TileEntityNukeCustom.java @@ -4,17 +4,8 @@ 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; @@ -22,7 +13,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -209,6 +199,7 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory 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.custom_nuke), 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)); @@ -218,8 +209,8 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory 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.egg_balefire_shard), new CustomNukeEntry(EnumBombType.AMAT, 15F)); + entries.put(new ComparableStack(ModItems.egg_balefire), new CustomNukeEntry(EnumBombType.AMAT, 150F)); entries.put(new ComparableStack(ModItems.ingot_tungsten), new CustomNukeEntry(EnumBombType.DIRTY, 1F)); entries.put(new ComparableStack(ModItems.custom_dirty), new CustomNukeEntry(EnumBombType.DIRTY, 10F)); @@ -232,11 +223,11 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory 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.nugget_euphemium), 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(Items.redstone), new CustomNukeEntry(EnumBombType.TNT, 1.05F, EnumEntryType.MULT)); + entries.put(new ComparableStack(Blocks.redstone_block), new CustomNukeEntry(EnumBombType.TNT, 1.5F, 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)); @@ -283,6 +274,9 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory ComparableStack comp = new ComparableStack(stack).makeSingular(); CustomNukeEntry ent = entries.get(comp); + if(ent == null) + continue; + if(ent.entry == EnumEntryType.ADD) { switch(ent.type) { @@ -314,8 +308,6 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory amat *= amatMod; dirty *= dirtyMod; schrab *= schrabMod; - - dirty = Math.min(dirty, 100); if(tnt < 16) nuke = 0; if(nuke < 100) hydro = 0; @@ -332,6 +324,38 @@ public class TileEntityNukeCustom extends TileEntity implements ISidedInventory this.euph = euph; } + public float getNukeAdj() { + + if(nuke == 0) + return 0; + + return Math.min(nuke + tnt / 2, NukeCustom.maxNuke); + } + + public float getHydroAdj() { + + if(hydro == 0) + return 0; + + return Math.min(hydro + nuke / 2 + tnt / 4, NukeCustom.maxHydro); + } + + public float getAmatAdj() { + + if(amat == 0) + return 0; + + return Math.min(amat + hydro / 2 + nuke / 4 + tnt / 8, NukeCustom.maxAmat); + } + + public float getSchrabAdj() { + + if(schrab == 0) + return 0; + + return Math.min(schrab + amat / 2 + hydro / 4 + nuke / 8 + tnt / 16, NukeCustom.maxSchrab); + } + public boolean isFalling() { for(ItemStack stack : slots) {