From f27234879f7418e6bc934201325758f4eb54b95e Mon Sep 17 00:00:00 2001 From: BallOfEnergy <66693744+ballofenergy1@users.noreply.github.com> Date: Sat, 22 Mar 2025 00:12:32 -0500 Subject: [PATCH 01/12] BOO! surprise feature! Completely revamped toolboxes, now they swap hotbars! --- .../java/com/hbm/crafting/ToolRecipes.java | 24 +- .../handlers/ToolboxCraftingHandler.java | 68 ------ .../inventory/container/ContainerToolBox.java | 84 +++++++ .../com/hbm/inventory/gui/GUILeadBox.java | 20 +- .../com/hbm/inventory/gui/GUIToolBox.java | 65 +++++ .../java/com/hbm/items/IItemInventory.java | 154 ++++++++++++ src/main/java/com/hbm/items/ModItems.java | 15 +- .../items/block/ItemBlockStorageCrate.java | 157 ++---------- .../com/hbm/items/special/ItemKitNBT.java | 38 +-- .../java/com/hbm/items/tool/ItemLeadBox.java | 98 ++------ .../java/com/hbm/items/tool/ItemToolBox.java | 227 ++++++++++++++++++ .../java/com/hbm/main/CraftingManager.java | 16 +- src/main/java/com/hbm/main/MainRegistry.java | 7 +- src/main/resources/assets/hbm/lang/en_US.lang | 5 +- .../assets/hbm/textures/gui/gui_toolbox.png | Bin 0 -> 1399 bytes 15 files changed, 624 insertions(+), 354 deletions(-) delete mode 100644 src/main/java/com/hbm/crafting/handlers/ToolboxCraftingHandler.java create mode 100644 src/main/java/com/hbm/inventory/container/ContainerToolBox.java create mode 100644 src/main/java/com/hbm/inventory/gui/GUIToolBox.java create mode 100644 src/main/java/com/hbm/items/IItemInventory.java create mode 100644 src/main/java/com/hbm/items/tool/ItemToolBox.java create mode 100644 src/main/resources/assets/hbm/textures/gui/gui_toolbox.png diff --git a/src/main/java/com/hbm/crafting/ToolRecipes.java b/src/main/java/com/hbm/crafting/ToolRecipes.java index b56361021..84c9df2a6 100644 --- a/src/main/java/com/hbm/crafting/ToolRecipes.java +++ b/src/main/java/com/hbm/crafting/ToolRecipes.java @@ -28,9 +28,9 @@ import net.minecraft.item.ItemStack; * @author hbm */ public class ToolRecipes { - + public static void register() { - + //Regular tools addSword( STEEL.ingot(), ModItems.steel_sword); addPickaxe( STEEL.ingot(), ModItems.steel_pickaxe); @@ -62,7 +62,7 @@ public class ToolRecipes { addAxe( DESH.ingot(), ModItems.desh_axe); addShovel( DESH.ingot(), ModItems.desh_shovel); addHoe( DESH.ingot(), ModItems.desh_hoe); - + CraftingManager.addRecipeAuto(new ItemStack(ModItems.elec_sword, 1), new Object[] { "RPR", "RPR", " B ", 'P', ANY_PLASTIC.ingot(), 'D', DURA.ingot(), 'R', DURA.bolt(), 'M', ModItems.motor, 'B', ModItems.battery_lithium }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.elec_pickaxe, 1), new Object[] { "RDM", " PB", " P ", 'P', ANY_PLASTIC.ingot(), 'D', DURA.ingot(), 'R', DURA.bolt(), 'M', ModItems.motor, 'B', ModItems.battery_lithium }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.elec_axe, 1), new Object[] { " DP", "RRM", " PB", 'P', ANY_PLASTIC.ingot(), 'D', DURA.ingot(), 'R', DURA.bolt(), 'M', ModItems.motor, 'B', ModItems.battery_lithium }); @@ -90,7 +90,7 @@ public class ToolRecipes { CraftingManager.addRecipeAuto(new ItemStack(ModItems.chlorophyte_axe, 1), new Object[] { " SD", "APS", "FA ", 'S', ModItems.blades_steel, 'D', ModItems.powder_chlorophyte, 'A', FIBER.ingot(), 'P', ModItems.bismuth_axe, 'F', DURA.bolt() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.chlorophyte_axe, 1), new Object[] { " SD", "APS", "FA ", 'S', ModItems.blades_steel, 'D', ModItems.powder_chlorophyte, 'A', FIBER.ingot(), 'P', ModItems.volcanic_axe, 'F', DURA.bolt() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.mese_axe, 1), new Object[] { " SD", "APS", "FA ", 'S', ModItems.blades_desh, 'D', ModItems.powder_dineutronium, 'A', ModItems.plate_paa, 'P', ModItems.chlorophyte_axe, 'F', ModItems.shimmer_handle }); - + //Chainsaws CraftingManager.addRecipeAuto(ItemToolAbilityFueled.getEmptyTool(ModItems.chainsaw), new Object[] { "CCH", "BBP", "CCE", 'H', STEEL.shell(), 'B', ModItems.blades_steel, 'P', ModItems.piston_selenium, 'C', ModBlocks.chain, 'E', ModItems.canister_empty }); @@ -150,7 +150,7 @@ public class ToolRecipes { CraftingManager.addRecipeAuto(new ItemStack(ModItems.power_net_tool), new Object[] { "WRW", " I ", " B ", 'W', MINGRADE.wireFine(), 'R', REDSTONE.dust(), 'I', IRON.ingot(), 'B', ModItems.battery_generic }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.analysis_tool), new Object[] { " G", " S ", "S ", 'G', KEY_ANYPANE, 'S', STEEL.ingot() }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.kit_toolbox_empty), new Object[] { "CCC", "CIC", 'C', CU.plate(), 'I', IRON.ingot() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.toolbox), new Object[] { "CCC", "CIC", 'C', CU.plate(), 'I', IRON.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.screwdriver, 1), new Object[] { " I", " I ", "S ", 'S', STEEL.ingot(), 'I', IRON.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.screwdriver_desh, 1), new Object[] { " I", " I ", "S ", 'S', ANY_PLASTIC.ingot(), 'I', DESH.ingot() }); @@ -161,24 +161,24 @@ public class ToolRecipes { CraftingManager.addRecipeAuto(ItemBlowtorch.getEmptyTool(ModItems.blowtorch), new Object[] { "CC ", " I ", "CCC", 'C', CU.plate528(), 'I', IRON.ingot() }); CraftingManager.addRecipeAuto(ItemBlowtorch.getEmptyTool(ModItems.acetylene_torch), new Object[] { "SS ", " PS", " T ", 'S', STEEL.plate528(), 'P', ANY_PLASTIC.ingot(), 'T', ModItems.tank_steel }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.boltgun), new Object[] { "DPS", " RD", " D ", 'D', DURA.ingot(), 'P', DictFrame.fromOne(ModItems.part_generic, EnumPartType.PISTON_PNEUMATIC), 'R', RUBBER.ingot(), 'S', STEEL.shell() }); - + //Bobmazon CraftingManager.addShapelessAuto(new ItemStack(ModItems.bobmazon), new Object[] { Items.book, Items.gold_nugget, Items.string, KEY_BLUE }); - + //Carts CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(EnumCartBase.WOOD, EnumMinecart.EMPTY), new Object[] { "P P", "WPW", 'P',KEY_SLAB, 'W', KEY_PLANKS }); CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(EnumCartBase.STEEL, EnumMinecart.EMPTY), new Object[] { "P P", "IPI", 'P', STEEL.plate(), 'I', STEEL.ingot() }); CraftingManager.addShapelessAuto(ItemModMinecart.createCartItem(EnumCartBase.PAINTED, EnumMinecart.EMPTY), new Object[] { ItemModMinecart.createCartItem(EnumCartBase.STEEL, EnumMinecart.EMPTY), KEY_RED }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.boat_rubber), new Object[] { "L L", "LLL", 'L', ANY_RUBBER.ingot() }); - + for(EnumCartBase base : EnumCartBase.values()) { - + if(EnumMinecart.DESTROYER.supportsBase(base)) CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(base, EnumMinecart.DESTROYER), new Object[] { "S S", "BLB", "SCS", 'S', STEEL.ingot(), 'B', ModItems.blades_steel, 'L', Fluids.LAVA.getDict(1000), 'C', ItemModMinecart.createCartItem(base, EnumMinecart.EMPTY) }); if(EnumMinecart.POWDER.supportsBase(base)) CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(base, EnumMinecart.POWDER), new Object[] { "PPP", "PCP", "PPP", 'P', Items.gunpowder, 'C', ItemModMinecart.createCartItem(base, EnumMinecart.EMPTY) }); if(EnumMinecart.SEMTEX.supportsBase(base)) CraftingManager.addRecipeAuto(ItemModMinecart.createCartItem(base, EnumMinecart.SEMTEX), new Object[] { "S", "C", 'S', ModBlocks.semtex, 'C', ItemModMinecart.createCartItem(base, EnumMinecart.EMPTY) }); } net.minecraft.item.crafting.CraftingManager.getInstance().addRecipe(DictFrame.fromOne(ModItems.cart, EnumMinecart.CRATE), new Object[] { "C", "S", 'C', ModBlocks.crate_steel, 'S', Items.minecart }).func_92100_c(); - + //Configged if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleToolRecipes) { addSword( CO.block(), ModItems.cobalt_decorated_sword); @@ -234,11 +234,11 @@ public class ToolRecipes { public static void addHoe(Object ingot, Item hoe) { addTool(ingot, hoe, patternHoe); } - + public static void addTool(Object ingot, Item tool, String[] pattern) { CraftingManager.addRecipeAuto(new ItemStack(tool), new Object[] { pattern, 'X', ingot, '#', KEY_STICK }); } - + public static final String[] patternSword = new String[] {"X", "X", "#"}; public static final String[] patternPick = new String[] {"XXX", " # ", " # "}; public static final String[] patternAxe = new String[] {"XX", "X#", " #"}; diff --git a/src/main/java/com/hbm/crafting/handlers/ToolboxCraftingHandler.java b/src/main/java/com/hbm/crafting/handlers/ToolboxCraftingHandler.java deleted file mode 100644 index 7e27a5cc6..000000000 --- a/src/main/java/com/hbm/crafting/handlers/ToolboxCraftingHandler.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.hbm.crafting.handlers; - -import java.util.ArrayList; -import java.util.List; - -import com.hbm.items.ModItems; -import com.hbm.items.special.ItemKitNBT; - -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.world.World; - -public class ToolboxCraftingHandler implements IRecipe { - - @Override - public boolean matches(InventoryCrafting inventory, World world) { - - int itemCount = 0; - int kitCount = 0; - - for(int i = 0; i < 9; i++) { - ItemStack stack = inventory.getStackInRowAndColumn(i % 3, i / 3); - - if(stack != null) { - - if(stack.getItem().hasContainerItem(stack) || !stack.getItem().doesContainerItemLeaveCraftingGrid(stack)) - return false; - - itemCount++; - - if(stack.getItem() == ModItems.kit_toolbox_empty) { - kitCount++; - } - } - } - - return itemCount > 1 && kitCount == 1; - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting inventory) { - - List stacks = new ArrayList(); - - for(int i = 0; i < 9; i++) { - ItemStack stack = inventory.getStackInRowAndColumn(i % 3, i / 3); - - if(stack != null && stack.getItem() != ModItems.kit_toolbox_empty) { - ItemStack copy = stack.copy(); - copy.stackSize = 1; - stacks.add(copy); - } - } - - return ItemKitNBT.create(stacks.toArray(new ItemStack[0])); - } - - @Override - public int getRecipeSize() { - return 9; - } - - @Override - public ItemStack getRecipeOutput() { - return new ItemStack(ModItems.kit_toolbox); - } -} diff --git a/src/main/java/com/hbm/inventory/container/ContainerToolBox.java b/src/main/java/com/hbm/inventory/container/ContainerToolBox.java new file mode 100644 index 000000000..9e9de5aa9 --- /dev/null +++ b/src/main/java/com/hbm/inventory/container/ContainerToolBox.java @@ -0,0 +1,84 @@ +package com.hbm.inventory.container; + +import com.hbm.util.InventoryUtil; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import static com.hbm.items.tool.ItemToolBox.*; + +public class ContainerToolBox extends Container { + + private InventoryToolBox box; + + public ContainerToolBox(InventoryPlayer invPlayer, InventoryToolBox box) { + this.box = box; + this.box.openInventory(); + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 8; j++) { + this.addSlotToContainer(new Slot(box, j + i * 8, 17 + j * 18, 18 + i * 18)); + } + } + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 9; j++) { + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 98 + i * 18)); + } + } + + for(int i = 0; i < 9; i++) { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 156)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) { + ItemStack var3 = null; + Slot var4 = (Slot) this.inventorySlots.get(par2); + + if(var4 != null && var4.getHasStack()) { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if(par2 <= box.getSizeInventory() - 1) { + if(!InventoryUtil.mergeItemStack(this.inventorySlots, var5, box.getSizeInventory(), this.inventorySlots.size(), true)) { + return null; + } + } else if(!InventoryUtil.mergeItemStack(this.inventorySlots, var5, 0, box.getSizeInventory(), false)) { + return null; + } + + if(var5.stackSize == 0) { + var4.putStack((ItemStack) null); + } else { + var4.onSlotChanged(); + } + + var4.onPickupFromSlot(p_82846_1_, var5); + } + + return var3; + } + + @Override + public ItemStack slotClick(int index, int button, int mode, EntityPlayer player) { + // prevents the player from moving around the currently open box + if(mode == 2 && button == player.inventory.currentItem) return null; + if(index == player.inventory.currentItem + 51) return null; + return super.slotClick(index, button, mode, player); + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return box.isUseableByPlayer(player); + } + + @Override + public void onContainerClosed(EntityPlayer player) { + super.onContainerClosed(player); + this.box.closeInventory(); + } +} diff --git a/src/main/java/com/hbm/inventory/gui/GUILeadBox.java b/src/main/java/com/hbm/inventory/gui/GUILeadBox.java index 715b40b01..49802ce65 100644 --- a/src/main/java/com/hbm/inventory/gui/GUILeadBox.java +++ b/src/main/java/com/hbm/inventory/gui/GUILeadBox.java @@ -13,43 +13,43 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; public class GUILeadBox extends GuiContainer { - + private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_containment.png"); private final InventoryLeadBox inventory; private ItemStack firstHeld; - + public GUILeadBox(InventoryPlayer invPlayer, InventoryLeadBox box) { super(new ContainerLeadBox(invPlayer, box)); this.inventory = box; - + this.xSize = 176; this.ySize = 186; } @Override public void drawScreen(int x, int y, float interp) { - + if(firstHeld == null) { // *very* unlikely to be incorrect on the first frame after opening, so doing this is good enough firstHeld = this.mc.thePlayer.getHeldItem(); - + // if the open box has changed or disappeared, close the inventory } else if(this.mc.thePlayer.getHeldItem() != firstHeld) { //this.mc.thePlayer.closeScreen(); //return; } - + super.drawScreen(x, y, interp); } - + @Override protected void drawGuiContainerForegroundLayer(int i, int j) { String name = I18n.format(this.inventory.getInventoryName()); - + if(inventory.hasCustomInventoryName()) { - name = inventory.box.getDisplayName(); + name = inventory.target.getDisplayName(); } - + this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); } diff --git a/src/main/java/com/hbm/inventory/gui/GUIToolBox.java b/src/main/java/com/hbm/inventory/gui/GUIToolBox.java new file mode 100644 index 000000000..1aedd6395 --- /dev/null +++ b/src/main/java/com/hbm/inventory/gui/GUIToolBox.java @@ -0,0 +1,65 @@ +package com.hbm.inventory.gui; + +import com.hbm.inventory.container.ContainerLeadBox; +import com.hbm.inventory.container.ContainerToolBox; +import com.hbm.items.tool.ItemLeadBox.InventoryLeadBox; +import com.hbm.lib.RefStrings; +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.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; + +import static com.hbm.items.tool.ItemToolBox.*; + +public class GUIToolBox extends GuiContainer { + + private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_toolbox.png"); + private final InventoryToolBox inventory; + private ItemStack firstHeld; + + public GUIToolBox(InventoryPlayer invPlayer, InventoryToolBox box) { + super(new ContainerToolBox(invPlayer, box)); + this.inventory = box; + + this.xSize = 176; + this.ySize = 186; + } + + @Override + public void drawScreen(int x, int y, float interp) { + + if(firstHeld == null) { + // *very* unlikely to be incorrect on the first frame after opening, so doing this is good enough + firstHeld = this.mc.thePlayer.getHeldItem(); + + // if the open box has changed or disappeared, close the inventory + } else if(this.mc.thePlayer.getHeldItem() != firstHeld) { + //this.mc.thePlayer.closeScreen(); + //return; + } + + super.drawScreen(x, y, interp); + } + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j) { + String name = I18n.format(this.inventory.getInventoryName()); + + if(inventory.hasCustomInventoryName()) { + name = inventory.target.getDisplayName(); + } + + this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 102 + 2, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + } +} diff --git a/src/main/java/com/hbm/items/IItemInventory.java b/src/main/java/com/hbm/items/IItemInventory.java new file mode 100644 index 000000000..5efeef53d --- /dev/null +++ b/src/main/java/com/hbm/items/IItemInventory.java @@ -0,0 +1,154 @@ +package com.hbm.items; + +import com.hbm.util.ItemStackUtil; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompressedStreamTools; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; + +import java.io.IOException; +import java.util.Random; + +/** + * Base class for items containing an inventory. This can be seen in crates, containment boxes, and the toolbox. + * @author BallOfEnergy/Gammawave + */ +public abstract class IItemInventory implements IInventory { + + public EntityPlayer player; + public ItemStack[] slots; + public ItemStack target; + + public boolean toMarkDirty = false; + + @Override + public void markDirty() { + + if(!toMarkDirty || player.getEntityWorld().isRemote) + return; + + for(int i = 0; i < getSizeInventory(); ++i) { + if(getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { + slots[i] = null; + } + } + + ItemStackUtil.addStacksToNBT(target, slots); // Maintain compatibility with the containment boxes. + + target.setTagCompound(checkNBT(target.getTagCompound())); + + } + + public NBTTagCompound checkNBT(NBTTagCompound nbt) { + if(!nbt.hasNoTags()) { + Random random = new Random(); + + try { + byte[] abyte = CompressedStreamTools.compress(nbt); + + if (abyte.length > 6000) { + player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!")); + for (int i1 = 0; i1 < this.getSizeInventory(); ++i1) { + ItemStack itemstack = this.getStackInSlot(i1); + + if (itemstack != null) { + float f = random.nextFloat() * 0.8F + 0.1F; + float f1 = random.nextFloat() * 0.8F + 0.1F; + float f2 = random.nextFloat() * 0.8F + 0.1F; + + while (itemstack.stackSize > 0) { + int j1 = random.nextInt(21) + 10; + + if (j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } + + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(player.worldObj, player.posX + f, player.posY + f1, player.posZ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + + if (itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } + + float f3 = 0.05F; + entityitem.motionX = (float) random.nextGaussian() * f3 + player.motionX; + entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F + player.motionY; + entityitem.motionZ = (float) random.nextGaussian() * f3 + player.motionZ; + player.worldObj.spawnEntityInWorld(entityitem); + } + } + } + + return new NBTTagCompound(); // Reset. + } + } catch (IOException ignored) {} + } + return nbt; + } + + @Override + public ItemStack decrStackSize(int slot, int amount) { + ItemStack stack = getStackInSlot(slot); + if (stack != null) { + if (stack.stackSize > amount) { + stack = stack.splitStack(amount); + } else { + setInventorySlotContents(slot, null); + } + } + return stack; + } + + @Override + public void setInventorySlotContents(int slot, ItemStack stack) { + if(stack != null) { + stack.stackSize = Math.min(stack.stackSize, this.getInventoryStackLimit()); + } + + slots[slot] = stack; + } + + @Override + public ItemStack getStackInSlotOnClosing(int slot) { + ItemStack stack = getStackInSlot(slot); + setInventorySlotContents(slot, null); + return stack; + } + + @Override + public ItemStack getStackInSlot(int slot) { + return slots[slot]; + } + + @Override + public boolean isUseableByPlayer(EntityPlayer player) { + return true; + } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack stack) { + return true; + } + + @Override + public int getInventoryStackLimit() { + return 64; + } + + @Override + public void openInventory() { + player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateOpen", 1.0F, 0.8F); + } + + @Override + public void closeInventory() { + toMarkDirty = true; + markDirty(); + toMarkDirty = false; + player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateClose", 1.0F, 0.8F); + } +} diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 517423b5d..129624ec4 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -2133,8 +2133,9 @@ public class ModItems { public static Item hazmat_red_kit; public static Item hazmat_grey_kit; public static Item kit_custom; - public static Item kit_toolbox_empty; - public static Item kit_toolbox; + + public static Item legacy_toolbox; + public static Item toolbox; public static Item loot_10; public static Item loot_15; @@ -4125,8 +4126,8 @@ public class ModItems { hazmat_red_kit = new ItemStarterKit().setUnlocalizedName("hazmat_red_kit").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":hazmat_red_kit"); hazmat_grey_kit = new ItemStarterKit().setUnlocalizedName("hazmat_grey_kit").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":hazmat_grey_kit"); kit_custom = new ItemKitCustom().setUnlocalizedName("kit_custom").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":kit"); - kit_toolbox_empty = new Item().setUnlocalizedName("kit_toolbox_empty").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":kit_toolbox_empty"); - kit_toolbox = new ItemKitNBT().setUnlocalizedName("kit_toolbox").setCreativeTab(MainRegistry.consumableTab).setContainerItem(kit_toolbox_empty).setTextureName(RefStrings.MODID + ":kit_toolbox"); + toolbox = new ItemToolBox().setUnlocalizedName("toolbox").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":kit_toolbox"); + legacy_toolbox = new ItemKitNBT().setUnlocalizedName("toolbox_legacy").setContainerItem(toolbox).setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":kit_toolbox"); loot_10 = new ItemLootCrate().setUnlocalizedName("loot_10").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":loot_10"); loot_15 = new ItemLootCrate().setUnlocalizedName("loot_15").setMaxStackSize(1).setCreativeTab(MainRegistry.missileTab).setTextureName(RefStrings.MODID + ":loot_15"); @@ -6487,7 +6488,7 @@ public class ModItems { GameRegistry.registerItem(ammo_standard, ammo_standard.getUnlocalizedName()); GameRegistry.registerItem(ammo_secret, ammo_secret.getUnlocalizedName()); - + GameRegistry.registerItem(weapon_mod_test, weapon_mod_test.getUnlocalizedName()); //Ammo @@ -7161,8 +7162,8 @@ public class ModItems { GameRegistry.registerItem(hazmat_grey_kit, hazmat_grey_kit.getUnlocalizedName()); GameRegistry.registerItem(kit_custom, kit_custom.getUnlocalizedName()); GameRegistry.registerItem(euphemium_kit, euphemium_kit.getUnlocalizedName()); - GameRegistry.registerItem(kit_toolbox_empty, kit_toolbox_empty.getUnlocalizedName()); - GameRegistry.registerItem(kit_toolbox, kit_toolbox.getUnlocalizedName()); + GameRegistry.registerItem(legacy_toolbox, legacy_toolbox.getUnlocalizedName()); + GameRegistry.registerItem(toolbox, toolbox.getUnlocalizedName()); GameRegistry.registerItem(letter, letter.getUnlocalizedName()); //Misile Loot Boxes diff --git a/src/main/java/com/hbm/items/block/ItemBlockStorageCrate.java b/src/main/java/com/hbm/items/block/ItemBlockStorageCrate.java index 83d7d64b7..bad911b14 100644 --- a/src/main/java/com/hbm/items/block/ItemBlockStorageCrate.java +++ b/src/main/java/com/hbm/items/block/ItemBlockStorageCrate.java @@ -3,6 +3,7 @@ package com.hbm.items.block; import com.hbm.blocks.ModBlocks; import com.hbm.inventory.container.*; import com.hbm.inventory.gui.*; +import com.hbm.items.IItemInventory; import com.hbm.items.tool.ItemKey; import com.hbm.main.MainRegistry; import com.hbm.tileentity.IGUIProvider; @@ -10,21 +11,14 @@ import com.hbm.tileentity.machine.storage.*; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; -import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import javax.annotation.Nonnull; -import java.io.IOException; -import java.util.Random; public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider { @@ -86,18 +80,12 @@ public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider throw new NullPointerException(); } - public static class InventoryCrate implements IInventory { - - public final EntityPlayer player; - public final ItemStack crate; - public ItemStack[] slots; - - private boolean toMarkDirty = false; + public static class InventoryCrate extends IItemInventory { public InventoryCrate(EntityPlayer player, ItemStack crate) { this.player = player; - this.crate = crate; + this.target = crate; slots = new ItemStack[this.getSizeInventory()]; if(crate.stackTagCompound == null) @@ -125,66 +113,23 @@ public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider @Override public int getSizeInventory() { - return findCrateType(crate.getItem()).getSizeInventory(); + return findCrateType(target.getItem()).getSizeInventory(); } @Override public String getInventoryName() { - return findCrateType(crate.getItem()).getInventoryName(); - } - - @Override - public ItemStack getStackInSlot(int slot) { - return slots[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int amount) { - ItemStack stack = getStackInSlot(slot); - if (stack != null) { - if (stack.stackSize > amount) { - stack = stack.splitStack(amount); - } else { - setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) { - if(stack != null) { - stack.stackSize = Math.min(stack.stackSize, this.getInventoryStackLimit()); - } - - slots[slot] = stack; + return findCrateType(target.getItem()).getInventoryName(); } @Override public boolean hasCustomInventoryName() { - return crate.hasDisplayName(); - } - - @Override - public int getInventoryStackLimit() { - return 64; + return target.hasDisplayName(); } @Override public void markDirty() { // I HATE THIS SO MUCH - if(player.worldObj.isRemote) { // go the fuck away - return; - } - - if(!toMarkDirty) { // ok fuck you too + if(player.getEntityWorld().isRemote || !toMarkDirty) { // go the fuck away return; } @@ -203,88 +148,18 @@ public class ItemBlockStorageCrate extends ItemBlockBase implements IGUIProvider nbt.setTag("slot" + i, slot); } - if(crate.stackTagCompound != null) { // yes it's a bit jank, but it wants to clear otherwise so... - if(crate.stackTagCompound.hasKey("lock")) - nbt.setInteger("lock", crate.stackTagCompound.getInteger("lock")); - if(crate.stackTagCompound.hasKey("lockMod")) - nbt.setDouble("lockMod", crate.stackTagCompound.getDouble("lockMod")); - if(crate.stackTagCompound.hasKey("spiders")) - nbt.setBoolean("spiders", crate.stackTagCompound.getBoolean("spiders")); // fuck you!! + if(target.stackTagCompound != null) { // yes it's a bit jank, but it wants to clear otherwise so... + if(target.stackTagCompound.hasKey("lock")) + nbt.setInteger("lock", target.stackTagCompound.getInteger("lock")); + if(target.stackTagCompound.hasKey("lockMod")) + nbt.setDouble("lockMod", target.stackTagCompound.getDouble("lockMod")); + if(target.stackTagCompound.hasKey("spiders")) + nbt.setBoolean("spiders", target.stackTagCompound.getBoolean("spiders")); // fuck you!! } - if(!nbt.hasNoTags()) { + target.setTagCompound(checkNBT(nbt)); - Random random = new Random(); - - try { - byte[] abyte = CompressedStreamTools.compress(nbt); - - if(abyte.length > 6000) { - player.addChatComponentMessage(new ChatComponentText(EnumChatFormatting.RED + "Warning: Container NBT exceeds 6kB, contents will be ejected!")); - for(int i1 = 0; i1 < invSize; ++i1) { - ItemStack itemstack = this.getStackInSlot(i1); - - if(itemstack != null) { - float f = random.nextFloat() * 0.8F + 0.1F; - float f1 = random.nextFloat() * 0.8F + 0.1F; - float f2 = random.nextFloat() * 0.8F + 0.1F; - - while(itemstack.stackSize > 0) { - int j1 = random.nextInt(21) + 10; - - if(j1 > itemstack.stackSize) { - j1 = itemstack.stackSize; - } - - itemstack.stackSize -= j1; - EntityItem entityitem = new EntityItem(player.worldObj, player.posX + f, player.posY + f1, player.posZ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - - if(itemstack.hasTagCompound()) { - entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); - } - - float f3 = 0.05F; - entityitem.motionX = (float) random.nextGaussian() * f3 + player.motionX; - entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F + player.motionY; - entityitem.motionZ = (float) random.nextGaussian() * f3 + player.motionZ; - player.worldObj.spawnEntityInWorld(entityitem); - } - } - } - - crate.setTagCompound(null); // Wipe tag compound to clear crate. - player.inventory.setInventorySlotContents(player.inventory.currentItem, crate); - return; - } - } catch(IOException ignored) { } - } - - crate.setTagCompound(nbt); - - player.inventory.setInventorySlotContents(player.inventory.currentItem, crate); - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - return true; - } - - @Override - public void openInventory() { - player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateOpen", 1.0F, 0.8F); - } - - @Override - public void closeInventory() { - toMarkDirty = true; - markDirty(); - toMarkDirty = false; - player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateClose", 1.0F, 0.8F); - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack stack) { - return true; + player.inventory.setInventorySlotContents(player.inventory.currentItem, target); } } } diff --git a/src/main/java/com/hbm/items/special/ItemKitNBT.java b/src/main/java/com/hbm/items/special/ItemKitNBT.java index f7248759c..571ecf257 100644 --- a/src/main/java/com/hbm/items/special/ItemKitNBT.java +++ b/src/main/java/com/hbm/items/special/ItemKitNBT.java @@ -14,64 +14,64 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; public class ItemKitNBT extends Item { - + public ItemKitNBT() { this.setMaxStackSize(1); } - + @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - + ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(stack); - + if(stacks != null) { - + for(ItemStack item : stacks) { if(item != null) { player.inventory.addItemStackToInventory(item.copy()); } } } - + ItemStack container = stack.getItem().getContainerItem(stack); - + stack.stackSize--; - + if(container != null) { - + if(stack.stackSize > 0) { player.inventory.addItemStackToInventory(container.copy()); } else { stack = container.copy(); } } - + world.playSoundAtEntity(player, "hbm:item.unpack", 1.0F, 1.0F); - + return stack; } - + @Override @SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { - + ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(stack); - + if(stacks != null) { - + list.add("Contains:"); - + for(ItemStack item : stacks) { list.add("-" + item.getDisplayName() + (item.stackSize > 1 ? (" x" + item.stackSize) : "")); } } } - + public static ItemStack create(ItemStack... contents) { - ItemStack stack = new ItemStack(ModItems.kit_toolbox); + ItemStack stack = new ItemStack(ModItems.legacy_toolbox); stack.stackTagCompound = new NBTTagCompound(); ItemStackUtil.addStacksToNBT(stack, contents); - + return stack; } } diff --git a/src/main/java/com/hbm/items/tool/ItemLeadBox.java b/src/main/java/com/hbm/items/tool/ItemLeadBox.java index bfa427cc7..3959cb7e7 100644 --- a/src/main/java/com/hbm/items/tool/ItemLeadBox.java +++ b/src/main/java/com/hbm/items/tool/ItemLeadBox.java @@ -2,6 +2,7 @@ package com.hbm.items.tool; import com.hbm.inventory.container.ContainerLeadBox; import com.hbm.inventory.gui.GUILeadBox; +import com.hbm.items.IItemInventory; import com.hbm.main.MainRegistry; import com.hbm.tileentity.IGUIProvider; import com.hbm.util.ItemStackUtil; @@ -10,7 +11,6 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -21,7 +21,7 @@ public class ItemLeadBox extends Item implements IGUIProvider { public ItemLeadBox() { this.setMaxStackSize(1); } - + @Override public int getMaxItemUseDuration(ItemStack stack) { return 1; @@ -29,7 +29,7 @@ public class ItemLeadBox extends Item implements IGUIProvider { @Override public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { - + if(!world.isRemote) player.openGui(MainRegistry.instance, 0, world, 0, 0, 0); return stack; } @@ -44,28 +44,27 @@ public class ItemLeadBox extends Item implements IGUIProvider { public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUILeadBox(player.inventory, new InventoryLeadBox(player, player.getHeldItem())); } - - public static class InventoryLeadBox implements IInventory { - - public final EntityPlayer player; - public final ItemStack box; - public ItemStack[] slots; - + + public static class InventoryLeadBox extends IItemInventory { + public InventoryLeadBox(EntityPlayer player, ItemStack box) { this.player = player; - this.box = box; + this.target = box; slots = new ItemStack[this.getSizeInventory()]; - + if(!box.hasTagCompound()) box.setTagCompound(new NBTTagCompound()); - + ItemStack[] fromNBT = ItemStackUtil.readStacksFromNBT(box, slots.length); - + if(fromNBT != null) { for(int i = 0; i < slots.length; i++) { slots[i] = fromNBT[i]; } } + toMarkDirty = true; + this.markDirty(); + toMarkDirty = false; } @Override @@ -73,43 +72,6 @@ public class ItemLeadBox extends Item implements IGUIProvider { return 20; } - @Override - public ItemStack getStackInSlot(int slot) { - return slots[slot]; - } - - @Override - public ItemStack decrStackSize(int slot, int amount) { - ItemStack stack = getStackInSlot(slot); - if (stack != null) { - if (stack.stackSize > amount) { - stack = stack.splitStack(amount); - markDirty(); - } else { - setInventorySlotContents(slot, null); - } - } - return stack; - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot) { - ItemStack stack = getStackInSlot(slot); - setInventorySlotContents(slot, null); - return stack; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack) { - - if(stack != null) { - stack.stackSize = Math.min(stack.stackSize, this.getInventoryStackLimit()); - } - - slots[slot] = stack; - markDirty(); - } - @Override public String getInventoryName() { return "container.leadBox"; @@ -117,44 +79,12 @@ public class ItemLeadBox extends Item implements IGUIProvider { @Override public boolean hasCustomInventoryName() { - return box.hasDisplayName(); + return target.hasDisplayName(); } @Override public int getInventoryStackLimit() { return 1; } - - @Override - public void markDirty() { - - for(int i = 0; i < getSizeInventory(); ++i) { - if(getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) { - slots[i] = null; - } - } - - ItemStackUtil.addStacksToNBT(box, slots); - } - - @Override - public boolean isUseableByPlayer(EntityPlayer player) { - return true; - } - - @Override - public void openInventory() { - player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateOpen", 1.0F, 0.8F); - } - - @Override - public void closeInventory() { - player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:block.crateClose", 1.0F, 0.8F); - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack stack) { - return true; - } } } diff --git a/src/main/java/com/hbm/items/tool/ItemToolBox.java b/src/main/java/com/hbm/items/tool/ItemToolBox.java new file mode 100644 index 000000000..a378c6cd8 --- /dev/null +++ b/src/main/java/com/hbm/items/tool/ItemToolBox.java @@ -0,0 +1,227 @@ +package com.hbm.items.tool; + +import com.hbm.inventory.container.ContainerToolBox; +import com.hbm.inventory.gui.GUIToolBox; +import com.hbm.items.IItemInventory; +import com.hbm.items.ModItems; +import com.hbm.lib.RefStrings; +import com.hbm.main.MainRegistry; +import com.hbm.tileentity.IGUIProvider; +import com.hbm.util.ChatBuilder; +import com.hbm.util.ItemStackUtil; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.*; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +public class ItemToolBox extends Item implements IGUIProvider { + + @SideOnly(Side.CLIENT) protected IIcon iconOpen; + @SideOnly(Side.CLIENT) protected IIcon iconClosed; + + public ItemToolBox() { + this.setMaxStackSize(1); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister iconRegister) { + super.registerIcons(iconRegister); + this.iconOpen = iconRegister.registerIcon(RefStrings.MODID + ":kit_toolbox_empty"); + this.iconClosed = iconRegister.registerIcon(RefStrings.MODID + ":kit_toolbox"); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(ItemStack stack, int renderPass) { + + if(stack.getTagCompound() != null && stack.getTagCompound().getBoolean("isOpen") && renderPass == 1) return this.iconOpen; + return renderPass == 1 ? this.iconClosed : getIconFromDamageForRenderPass(stack.getItemDamage(), renderPass); + } + + public List getActiveRows(ItemStack box) { + ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(box, 24); + if(stacks == null) + return new ArrayList<>(); + List activeRows = new ArrayList<>(); + for (int row = 0; row < 3; row++) { + for (int slot = 0; slot < 8; slot++) { + if(stacks[row * 8 + slot] != null) { + activeRows.add(row); + break; + } + } + } + return activeRows; + } + + // This function genuinely hurts my soul, but it works... + public void moveRows(ItemStack box, EntityPlayer player) { + + // Move from hotbar into array in preparation for boxing. + ItemStack[] endingHotBar = new ItemStack[9]; + ItemStack[] stacksToTransferToBox = new ItemStack[8]; + + boolean hasToolbox = false; + int extraToolboxes = 0; + for (int i = 0; i < 9; i++) { // Maximum allowed HotBar size is 9. + + ItemStack slot = player.inventory.getStackInSlot(i); + + if(slot != null && slot.getItem() == ModItems.toolbox && i != player.inventory.currentItem) { + + extraToolboxes++; + player.dropPlayerItemWithRandomChoice(slot, true); + player.inventory.setInventorySlotContents(i, null); + + } else if(i == player.inventory.currentItem) { + hasToolbox = true; + endingHotBar[i] = slot; + } else { + stacksToTransferToBox[i - (hasToolbox ? 1 : 0)] = slot; + } + } + + if(extraToolboxes > 0) { + if(extraToolboxes == 1) + player.addChatComponentMessage(new ChatComponentText("You can't toolbox a toolbox... ").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); // TODO: tell someone else to do i18n stuff; i don't want to + else + player.addChatComponentMessage(new ChatComponentText("You can't toolbox a toolbox... (x" + extraToolboxes + ")").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED))); // TODO: this too :ayo: + } + + // Move stacks around inside the box, mostly shifts rows to other rows and shifts the top row to the hotbar. + ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(box, 24); + ItemStack[] endingStacks = new ItemStack[24]; + + if(stacks != null) { + List activeRows = getActiveRows(box); + + int lowestIndex = Integer.MAX_VALUE; + { // Finding the lowest active row to decide what row to move to the hotbar. + for (Integer activeRowIndex : activeRows) { + lowestIndex = Math.min(activeRowIndex, lowestIndex); + } + } + + // This entire section sucks, but honestly it's not actually that bad; it works so.... + for (Integer activeRowIndex : activeRows) { + + int activeIndex = 8 * activeRowIndex; + + if (activeRowIndex == lowestIndex) { // Items to "flow" to the hotbar. + hasToolbox = false; + for (int i = 0; i < 9; i++) { + if(i == player.inventory.currentItem) { + hasToolbox = true; + continue; + } + endingHotBar[i] = stacks[activeIndex + i - (hasToolbox ? 1 : 0)]; + } + continue; + } + + int targetIndex = 8 * (activeRowIndex - 1); + + System.arraycopy(stacks, activeIndex, endingStacks, targetIndex, 8); + } + } + + // Finally, move all temporary arrays into their respective locations. + System.arraycopy(stacksToTransferToBox, 0, endingStacks, 16, 8); + + for (int i = 0; i < endingHotBar.length; i++) { + player.inventory.setInventorySlotContents(i, endingHotBar[i]); + } + + box.setTagCompound(new NBTTagCompound()); + ItemStackUtil.addStacksToNBT(box, endingStacks); + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + + if(!world.isRemote) { + if (player.isSneaking()) { + moveRows(stack, player); + player.inventoryContainer.detectAndSendChanges(); + } else { + if(stack.getTagCompound() == null) + stack.setTagCompound(new NBTTagCompound()); + stack.getTagCompound().setBoolean("isOpen", true); + player.openGui(MainRegistry.instance, 0, world, 0, 0, 0); + } + } + return stack; + } + + @Override + public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { + return new ContainerToolBox(player.inventory, new InventoryToolBox(player, player.getHeldItem())); + } + + @Override + @SideOnly(Side.CLIENT) + public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { + return new GUIToolBox(player.inventory, new InventoryToolBox(player, player.getHeldItem())); + } + + public static class InventoryToolBox extends IItemInventory { + + public InventoryToolBox(EntityPlayer player, ItemStack box) { + this.player = player; + this.target = box; + slots = new ItemStack[this.getSizeInventory()]; + + if(!box.hasTagCompound()) + box.setTagCompound(new NBTTagCompound()); + + ItemStack[] fromNBT = ItemStackUtil.readStacksFromNBT(box, slots.length); + + if(fromNBT != null) { + System.arraycopy(fromNBT, 0, slots, 0, slots.length); + } + toMarkDirty = true; + this.markDirty(); + toMarkDirty = false; + } + + @Override + public int getSizeInventory() { + return 24; + } + + @Override + public String getInventoryName() { + return "container.toolBox"; + } + + @Override + public boolean hasCustomInventoryName() { + return target.hasDisplayName(); + } + + @Override + public void closeInventory() { + this.target.getTagCompound().removeTag("isOpen"); + this.player.inventory.setInventorySlotContents(this.player.inventory.currentItem, this.target); + super.closeInventory(); + } + } +} diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 5605ce908..5494f320b 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -66,12 +66,10 @@ public class CraftingManager { GameRegistry.addRecipe(new RBMKFuelCraftingHandler()); GameRegistry.addRecipe(new MKUCraftingHandler()); - GameRegistry.addRecipe(new ToolboxCraftingHandler()); GameRegistry.addRecipe(new CargoShellCraftingHandler()); GameRegistry.addRecipe(new ScrapsCraftingHandler()); RecipeSorter.register("hbm:rbmk", RBMKFuelCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); - RecipeSorter.register("hbm:toolbox", ToolboxCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); RecipeSorter.register("hbm:cargo", CargoShellCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); RecipeSorter.register("hbm:scraps", ScrapsCraftingHandler.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless"); RecipeSorter.register("hbm:mku", MKUCraftingHandler.class, RecipeSorter.Category.SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); @@ -791,7 +789,7 @@ public class CraftingManager { addShapelessAuto(new ItemStack(ModItems.plate_cast, 1, Mats.MAT_STEEL.id), new Object[] { ModBlocks.hadron_plating_voltz }); addShapelessAuto(DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), new Object[] { ModBlocks.hadron_analysis }); addShapelessAuto(DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED), new Object[] { ModBlocks.hadron_analysis_glass }); - + addRecipeAuto(new ItemStack(ModBlocks.hadron_coil_alloy, 1), new Object[] { "WW", "WW", 'W', ALLOY.wireDense() }); //addRecipeAuto(new ItemStack(ModBlocks.hadron_coil_gold, 1), new Object[] { "WG", "GW", 'W', ALLOY.wireDense(), 'G', GOLD.wireDense() }); //addRecipeAuto(new ItemStack(ModBlocks.hadron_coil_neodymium, 1), new Object[] { "WG", "GW", 'W', ND.wireDense(), 'G', GOLD.wireDense() }); @@ -1171,29 +1169,29 @@ public class CraftingManager { List toDestroy = new ArrayList(); List recipeList = net.minecraft.item.crafting.CraftingManager.getInstance().getRecipeList(); - + synchronized(recipeList) { //this is how threading works. i think. for(Object o : recipeList) { - + if(o instanceof IRecipe) { IRecipe rec = (IRecipe)o; ItemStack stack = rec.getRecipeOutput(); - + for(ItemStack target : targets) { if(stack != null && stack.getItem() == target.getItem() && stack.getItemDamage() == target.getItemDamage()) toDestroy.add(rec); } } } - + if(toDestroy.size() > 0) { recipeList.removeAll(toDestroy); } - + if(Loader.isModLoaded("Mekanism")) { Item disassembler = (Item) Item.itemRegistry.getObject("Mekanism:AtomicDisassembler"); if(disassembler != null) addRecipeAuto(new ItemStack(disassembler, 1), "GAG", "EIE", " I ", 'G', GOLD.plateCast(), 'A', "alloyUltimate", 'E', "battery", 'I', "ingotRefinedObsidian"); } - + if(Loader.isModLoaded("MekanismGenerators")) { Block generator = (Block) Block.blockRegistry.getObject("MekanismGenerators:Generator"); if(generator != null) addRecipeAuto(new ItemStack(generator, 1, 6), " T ", "TAT", "BCB", 'T', TI.plateCast(), 'A', "alloyAdvanced", 'B', "battery", 'C', ANY_PLASTIC.ingot()); diff --git a/src/main/java/com/hbm/main/MainRegistry.java b/src/main/java/com/hbm/main/MainRegistry.java index 903ddb954..dd4323118 100644 --- a/src/main/java/com/hbm/main/MainRegistry.java +++ b/src/main/java/com/hbm/main/MainRegistry.java @@ -172,7 +172,7 @@ public class MainRegistry { public static StatBase statLegendary; public static StatBase statMines; public static StatBase statBullets; - + // Achievements public static Achievement achSacrifice; public static Achievement achImpossible; @@ -863,7 +863,7 @@ public class MainRegistry { FalloutConfigJSON.initialize(); ItemPoolConfigJSON.initialize(); - + ClientConfig.initConfig(); ServerConfig.initConfig(); @@ -1672,6 +1672,9 @@ public class MainRegistry { remapItems.put("hbm:item.briquette_lignite", ModItems.briquette); remapItems.put("hbm:item.antiknock", ModItems.fuel_additive); + remapItems.put("hbm:item.kit_toolbox_empty", ModItems.toolbox); + remapItems.put("hbm:item.kit_toolbox", ModItems.legacy_toolbox); + for(MissingMapping mapping : event.get()) { // ignore all ammo prefixes because those are from the time we threw out all the ammo items diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 90140273e..4c7355630 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -849,6 +849,7 @@ container.soyuzLauncher=Soyuz Launch Platform container.storageDrum=Nuclear Waste Disposal Drum container.teleLinker=TelLink Device container.teleporter=Teleporter +container.toolBox=Toolbox container.trainTram=Electric Flat Bed Tram container.turbinegas=Combined Cycle Gas Turbine container.turretArty=Greg @@ -3387,8 +3388,8 @@ item.key_red.desc.P11=§4e§r item.key_red_cracked.name=Cracked Key item.key_red_cracked.desc=??? item.key_red.key_red_cracked.P11=§4???§r -item.kit_toolbox.name=Toolbox -item.kit_toolbox_empty.name=Empty Toolbox +item.toolbox.name=Toolbox +item.toolbox_legacy.name=Toolbox (LEGACY) item.laser_crystal_bismuth.desc=Bismuth-Samarium-Uranium-Thorium crystal matrix item.laser_crystal_bismuth.name=BiSmUTh Laser Crystal item.laser_crystal_cmb.desc=Antischrabidium Suspended in a CMB-Schrabidate Alloy Lattice diff --git a/src/main/resources/assets/hbm/textures/gui/gui_toolbox.png b/src/main/resources/assets/hbm/textures/gui/gui_toolbox.png new file mode 100644 index 0000000000000000000000000000000000000000..285c78101cec9bd2c09640359806b7f0e9b5c317 GIT binary patch literal 1399 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G!U;i$lZxy-8q?;Kn_c~qpu?a z!^VE@KZ&eBK4*bPWHAE+-(e7DJf6QIg@J*U$J50zq$2L^UBhgZQkmlq@6MUlp8r5f zn^l`zal$3N33|R&+JY(*+&1oS4tbx*v7oPXlk6Z`*v z)_#*VC|kehe=|qOriV|`@6M_JuseLsRGb9JUaNAU#&g9CiR@|yH9h>>;7%3 z{_=@sf!uVgM&q<0UWC^M$J2j*;=Rh+{Tr7PW-m*5w9)-sN9 z&9v{BA%Vptc-W;WU(f|Q$Mm>e!&NC6h9CPm9c=X&6>c2sZYnEJ{PXPpZ*!U5htI~_ zolTS9SM~N}>&D+d-kd-A=6&)Exo6WEF27t}UjkHTx69_IWX8sM^DYZ!*G1GhT>o)j zo`K=P)7Zaa3wF1bKK!-6Y4!K1X~w(>wLZ(={?un;-nyTy&+YwPN>vFz_0 z-fA~gGMqbi?pCzK=5~Jj?ELw5wU_Qxh#EAUXF`ozoIcw9=d{D~{oDA(?0I+W-+%w^ z>-_Ta@}ioWJGQUR&)KxwCOtcQb#+N5FlkJlEL<;{v7nyU;WM+uqX!QXHtpP*c@7vB z+0S(3rZWZfd*e!2SS_Dq`kUdIpTGb5T3I={vj0XsmZ{IC=*mq8`t5Ca@td-CL))7i zS0-Dgnm)h5vBk!W>1zro#>|*>`$>y2k2K|g`e#$F&e~iNbBiOSzt_QbCM0Q{PF4=^ z2g=MzR=)75f**hGK=VWj&_U^bk!vlxk1y?Y_$ngabU-4KBM2!F)*gV^v-ZI0WbFco zJ=z~W?O;L5a%hGk@*-Sf=Gp_m{1=ve?onZ;c7g3Srp;wKEGv(zLi53zsXtHGzsguY zf7W+KIs3XVk7m7^{cZLJzCG*)cdkyp?vhYly}O#_@v|rEAKwywab0T-x4J#BP@@+3 cVmR{;>&*T+-a8#<`~(^5>FVdQ&MBb@03oydF8}}l literal 0 HcmV?d00001 From 9839107c4e04e69d94cd4f07f58e64674af2c96f Mon Sep 17 00:00:00 2001 From: BallOfEnergy <66693744+ballofenergy1@users.noreply.github.com> Date: Sat, 22 Mar 2025 13:05:45 -0500 Subject: [PATCH 02/12] New GUI, also some index fixes. --- .../inventory/container/ContainerToolBox.java | 11 ++++--- .../com/hbm/inventory/gui/GUIToolBox.java | 10 +++--- .../java/com/hbm/items/tool/ItemToolBox.java | 31 +++++++++++++----- .../assets/hbm/textures/gui/gui_toolbox.png | Bin 1399 -> 2012 bytes 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/hbm/inventory/container/ContainerToolBox.java b/src/main/java/com/hbm/inventory/container/ContainerToolBox.java index 9e9de5aa9..512e75283 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerToolBox.java +++ b/src/main/java/com/hbm/inventory/container/ContainerToolBox.java @@ -1,5 +1,6 @@ package com.hbm.inventory.container; +import com.hbm.inventory.SlotNonRetarded; import com.hbm.util.InventoryUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -11,7 +12,7 @@ import static com.hbm.items.tool.ItemToolBox.*; public class ContainerToolBox extends Container { - private InventoryToolBox box; + private final InventoryToolBox box; public ContainerToolBox(InventoryPlayer invPlayer, InventoryToolBox box) { this.box = box; @@ -19,18 +20,18 @@ public class ContainerToolBox extends Container { for(int i = 0; i < 3; i++) { for(int j = 0; j < 8; j++) { - this.addSlotToContainer(new Slot(box, j + i * 8, 17 + j * 18, 18 + i * 18)); + this.addSlotToContainer(new SlotNonRetarded(box, j + i * 8, 17 + j * 18, 49 + i * 18)); } } for(int i = 0; i < 3; i++) { for(int j = 0; j < 9; j++) { - this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 98 + i * 18)); + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 129 + i * 18)); } } for(int i = 0; i < 9; i++) { - this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 156)); + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 187)); } } @@ -52,7 +53,7 @@ public class ContainerToolBox extends Container { } if(var5.stackSize == 0) { - var4.putStack((ItemStack) null); + var4.putStack(null); } else { var4.onSlotChanged(); } diff --git a/src/main/java/com/hbm/inventory/gui/GUIToolBox.java b/src/main/java/com/hbm/inventory/gui/GUIToolBox.java index 1aedd6395..d00282f56 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIToolBox.java +++ b/src/main/java/com/hbm/inventory/gui/GUIToolBox.java @@ -1,8 +1,6 @@ package com.hbm.inventory.gui; -import com.hbm.inventory.container.ContainerLeadBox; import com.hbm.inventory.container.ContainerToolBox; -import com.hbm.items.tool.ItemLeadBox.InventoryLeadBox; import com.hbm.lib.RefStrings; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; @@ -16,7 +14,7 @@ import static com.hbm.items.tool.ItemToolBox.*; public class GUIToolBox extends GuiContainer { - private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_toolbox.png"); + private final static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_toolbox.png"); private final InventoryToolBox inventory; private ItemStack firstHeld; @@ -25,7 +23,7 @@ public class GUIToolBox extends GuiContainer { this.inventory = box; this.xSize = 176; - this.ySize = 186; + this.ySize = 211; } @Override @@ -52,8 +50,8 @@ public class GUIToolBox extends GuiContainer { name = inventory.target.getDisplayName(); } - this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); - this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 102 + 2, 4210752); + this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 37, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); } @Override diff --git a/src/main/java/com/hbm/items/tool/ItemToolBox.java b/src/main/java/com/hbm/items/tool/ItemToolBox.java index a378c6cd8..e44cb5810 100644 --- a/src/main/java/com/hbm/items/tool/ItemToolBox.java +++ b/src/main/java/com/hbm/items/tool/ItemToolBox.java @@ -7,12 +7,10 @@ import com.hbm.items.ModItems; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.IGUIProvider; -import com.hbm.util.ChatBuilder; import com.hbm.util.ItemStackUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.Item; @@ -23,7 +21,6 @@ import net.minecraft.world.World; import java.util.ArrayList; import java.util.List; -import java.util.Random; public class ItemToolBox extends Item implements IGUIProvider { @@ -56,6 +53,7 @@ public class ItemToolBox extends Item implements IGUIProvider { return renderPass == 1 ? this.iconClosed : getIconFromDamageForRenderPass(stack.getItemDamage(), renderPass); } + // Finds active rows in the toolbox (rows with items inside them). public List getActiveRows(ItemStack box) { ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(box, 24); if(stacks == null) @@ -110,14 +108,24 @@ public class ItemToolBox extends Item implements IGUIProvider { ItemStack[] stacks = ItemStackUtil.readStacksFromNBT(box, 24); ItemStack[] endingStacks = new ItemStack[24]; + int lowestActiveIndex = Integer.MAX_VALUE; // Lowest active index to find which row to move *to* the hotbar. + int lowestInactiveIndex = Integer.MAX_VALUE; // Lowest *inactive* index to find which row to move the hotbar to. + if(stacks != null) { List activeRows = getActiveRows(box); - int lowestIndex = Integer.MAX_VALUE; - { // Finding the lowest active row to decide what row to move to the hotbar. - for (Integer activeRowIndex : activeRows) { - lowestIndex = Math.min(activeRowIndex, lowestIndex); + { // despair + for (int i = 0; i < 3; i++) { + if(activeRows.contains(i)) + lowestActiveIndex = Math.min(i, lowestActiveIndex); + else + lowestInactiveIndex = Math.min(i, lowestInactiveIndex); } + + if(lowestInactiveIndex > 2) // No inactive rows... + lowestInactiveIndex = 2; // Set to the last possible row; the items will be moved out of the way in time. + else + lowestInactiveIndex = Math.max(0, lowestInactiveIndex - 1); // A little shittery to make items pop into the row that's *going* to be empty. } // This entire section sucks, but honestly it's not actually that bad; it works so.... @@ -125,7 +133,7 @@ public class ItemToolBox extends Item implements IGUIProvider { int activeIndex = 8 * activeRowIndex; - if (activeRowIndex == lowestIndex) { // Items to "flow" to the hotbar. + if (activeRowIndex == lowestActiveIndex) { // Items to "flow" to the hotbar. hasToolbox = false; for (int i = 0; i < 9; i++) { if(i == player.inventory.currentItem) { @@ -144,7 +152,7 @@ public class ItemToolBox extends Item implements IGUIProvider { } // Finally, move all temporary arrays into their respective locations. - System.arraycopy(stacksToTransferToBox, 0, endingStacks, 16, 8); + System.arraycopy(stacksToTransferToBox, 0, endingStacks, lowestInactiveIndex * 8, 8); for (int i = 0; i < endingHotBar.length; i++) { player.inventory.setInventorySlotContents(i, endingHotBar[i]); @@ -223,5 +231,10 @@ public class ItemToolBox extends Item implements IGUIProvider { this.player.inventory.setInventorySlotContents(this.player.inventory.currentItem, this.target); super.closeInventory(); } + + @Override + public boolean isItemValidForSlot(int slot, ItemStack stack) { + return stack.getItem() != ModItems.toolbox; + } } } diff --git a/src/main/resources/assets/hbm/textures/gui/gui_toolbox.png b/src/main/resources/assets/hbm/textures/gui/gui_toolbox.png index 285c78101cec9bd2c09640359806b7f0e9b5c317..c73cc5b014cbf33f267183752cf59a0bb0339b6a 100644 GIT binary patch delta 1598 zcmV-E2EqCF3fvEnNq@os01m% zaFxO!P-WZ+)TvROR3RV)Y7)}hpi0C9HLl$VyD+G7Fr<*cDU!ygUm;PwS)p#DfxIE~0${K6HquvM(M2K^I4Nk?b1uLl5}b*;#$m&FSfBeRLSR z0wD}swAhQ`5QE-#h^I0p9>Tyyi#h4dfgdvHOBwL7h6JJ+20_R$>yvzO==%(O%Aohv zCkz*ZAO^>4R(~h9@4NgQ2K~j07xmFF*RNl%kEXLP4DJq&*DOxtX7HyP__0Ggl|#j& zYY>EB`6fGoU2pG84E>=8{Ohm(QXlp6!3XcxM~6`&5N$E=n6P|Te$w{6+m9LeF@rvI zh$}-c{^lc3A7kP%CJeiR;I3equIyx$9{j$;zHh*nc7NgSi$~u;^o@cL9EXFSq_)BD zGxS{te%GL*j&=tG9zt$v2h9YL47 z0TGy9?-#u9@EiP0+d?1$^V93a9y0t+XtwH_5r2XCx>kSf&G6Gjbq#Fp0xR1-7ut3$ zaWy&zp!x3KWcb;oO9VEmYi#rQz~K$L185f8@Uzdp2)GNF#^6VQZ45tcnh{`nodVEy z``>mu2W@s;J01hBPO&=x@BVb*E?{1I2f(u$hvM40dT-vb-Ey%M?lj9;zmV1Nzx?BS z>p8!GxqJK9--P^YSZ9TA{^IAW&;I&-{oQcZX*b7pK0NP#&G~J> za*70?I+0_XzI(cQ`1x1X+2NSi`PtvUsK4t@0Lt+QlR*R*lRpF&GqBP70sQIY{q^s4 zk9GEsGwZZC)^+R$FfBU*ZDE~uCD*Yd(6sCbw1surm0ZUiz_fe@lR*R*lRpF(COZP{ zV4ZfQ*0CSJwCo79g>~AMT*r<;)3PJb7S?H3avgU7)AAXU&;c%g>M*s+R?T3QahcJJecmIlOcf8H*)A{+mpImxzVeWqS{J*R7|6juluz3VH zIeGM-`Vi*tx37nvk(%}Nn$B2tvYenxy!!(H0Ce}}rvUX=SPIYo1-$uO>HJ&+SdNpE z_56##Nb4U18h(~5Y~<(HpTU)%+Z z;CBI&+5sd}1OS4){+EGX{&W3J^S1%--@jiU4R`0xoz;^kPwMZ6vrfBXUgze`oAr0E zZGIc@>C>nFWuTGv2B10tV?229V0Gih4eRV+op#ka&FfMC%JB%3K?E0*KLi#(vT8qo zjc3oEUHbFz;lujBjANa4)@j$gE^ptyyZ%#MyY*$vKz0Ng$U5yxu46}_!?7dKK-Otj zaveJY9gfeF*#RY!fB^_ANM=W%;jGiH)H==U(vCpo*b!(T>$EGmjvavx$BsY)S*Kme zb?gXqI6ecD-~k?!fB_FZnH_ol)RI|7x{x*-V6kqtr0@dyCH1OS2w00gru z@IcmSS8^S@0w0cDfd{fqyOQhJ75H#G0+ZbVA(Mas3ssQJuE4`tr(LOan%AXWfy=Qg zFpFbDka9c%KrjJ-U;@CRY;ON4WBvS8eGc%+Cm;XtO!epWU&0dj3}C!BFJ2XaTeoi2 w-@&{Y{xUATfPSpPQW$=dAq6ZM;DXiae}G+lO&!Fn=Kufz07*qoM6N<$g6|Y7!2kdN delta 977 zcmV;?11|jB5BCa?Nq@rt01m?e$8V@)000FHNkl54s9LM3^oR)`g;2J9h zD+?iz(k_rLO?oR4B#=h2zk^ibA$bSa1T79yX=9PVS!knJX>%_?8ygeXo5^e>Yx4J; z`L8>h@AE*|-5mUi&CKU^Hta9cN$1|Z*Jj;a7`2Ow->!~ZhCykc$mZlf|NO1?8!&dS zy#Ip;RI=gZXWg8C@Vi&6l}!H;fFHl@?!Y)bdUny?e)8f_8Ud{O14rHypde&0jvvW*@$K?a76)`}pk7$?WfAm>%Yr0MqHG ze{^?Y{64xo`59=jo}SYYYkpXMK-c)+9{>R0=GYw#UOsDPn zF9HL#zXo*jvnfuFj*ccfJA2Jt2kt=aD}Z?b&d$!-TNty44?k;fpFVxk+;|l*fX@Px z`vn@4Fb54xyZp;Q=fAcO7C#NRzrWwz>u+~=cXE7u+&${goU*$-XKQP#dvt03X~2_{ z6Mq?KpnnZO^8*;-;NW1gxw&c1EzBuv<}4nU0#J`jlko*4lQ0JfJ(4y10On3lPp^F) z9v*i8GK@K8=9DcSmpeOq?N@W`c84)N*$C8=Ib}8H*a);dHUjlzPFc-4HUce=_W+Y| z1t*h#1qCTcW+PC4=9JZ%vv^$E2vm=aKs}jLR&$PxK+9tzP*3KR)tqA^(DHZ>lVJuR zlM4n4J}?1*WHtizXHHqIIg7`ojX?Dj7lObTSqM^(O8^Ka01!+7AegPdJ(*KhbB?XR z%VR5WPv(@>oMS8S^0)+({skA4Fb5J>5KI6dnXSP6nNwD4&f;-tD{wuw0<(531gXa* z00a{N2qplmmHEqm>S(W@n)d-7KYsM$n(CYOo3IYN2Qb{#lh;IGdwaWk1mou9ujASi z=+`Q&3nxF5p$8(9um=;9um=+y0002=F`4`YnU9=Hxj~ru00000NkvXXu0mjf042_k From 737fb1e432e9832d26c4ce993cf8938edfdd0fb0 Mon Sep 17 00:00:00 2001 From: Bob Date: Sat, 22 Mar 2025 23:29:02 +0100 Subject: [PATCH 03/12] go go gadget HIV --- changelog | 1 + .../container/ContainerWeaponTable.java | 32 ++++++++++++++++-- .../inventory/recipes/AmmoPressRecipes.java | 21 ++++++++++++ .../weapon/sedna/factory/GunFactory.java | 2 +- .../weapon/sedna/factory/Orchestras.java | 2 +- .../weapon/sedna/factory/XFactoryEnergy.java | 8 ++--- .../items/weapon/sedna/mods/IWeaponMod.java | 3 ++ .../weapon/sedna/mods/WeaponModCaliber.java | 17 +++++++++- .../weapon/sedna/mods/WeaponModManager.java | 31 +++++++++++++---- .../sedna/mods/WeaponModUziSaturnite.java | 22 ++++++++++++ .../java/com/hbm/main/ResourceManager.java | 1 + .../item/weapon/sedna/ItemRenderUzi.java | 12 ++++--- .../weapon/sedna/ItemRenderUziAkimbo.java | 17 ++++++---- .../machine/storage/TileEntityCrateBase.java | 2 +- src/main/resources/assets/hbm/lang/de_DE.lang | 9 +++++ src/main/resources/assets/hbm/lang/en_US.lang | 9 +++++ .../hbm/textures/items/weapon_mod_sheet.png | Bin 3152 -> 3318 bytes .../weapon_mod_special.skin_saturnite.png | Bin 0 -> 229 bytes .../textures/models/weapons/uzi_saturnite.png | Bin 0 -> 5454 bytes 19 files changed, 163 insertions(+), 26 deletions(-) create mode 100644 src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModUziSaturnite.java create mode 100644 src/main/resources/assets/hbm/textures/items/weapon_mod_special.skin_saturnite.png create mode 100644 src/main/resources/assets/hbm/textures/models/weapons/uzi_saturnite.png diff --git a/changelog b/changelog index 0a9e331d9..b970bea8a 100644 --- a/changelog +++ b/changelog @@ -43,6 +43,7 @@ * Crates can now be opened when held * Crates will not longer show their contents when locked * Crates found in structures will sometimes contain things that aren't items +* Beam weapons are no longer pinpoint accurate when firing unscoped ## Fixed * Fixed animation errors on the MAS-36 diff --git a/src/main/java/com/hbm/inventory/container/ContainerWeaponTable.java b/src/main/java/com/hbm/inventory/container/ContainerWeaponTable.java index d4528cac9..2cdbc4e16 100644 --- a/src/main/java/com/hbm/inventory/container/ContainerWeaponTable.java +++ b/src/main/java/com/hbm/inventory/container/ContainerWeaponTable.java @@ -2,6 +2,7 @@ package com.hbm.inventory.container; import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.mods.WeaponModManager; +import com.hbm.util.InventoryUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -152,8 +153,33 @@ public class ContainerWeaponTable extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2) { - return null; + public ItemStack transferStackInSlot(EntityPlayer player, int index) { + ItemStack copy = null; + Slot slot = (Slot) this.inventorySlots.get(index); + + if(slot != null && slot.getHasStack()) { + ItemStack stack = slot.getStack(); + copy = stack.copy(); + + if(index < 8) { + if(!InventoryUtil.mergeItemStack(this.inventorySlots, stack, 8, this.inventorySlots.size(), true)) return null; + slot.onPickupFromSlot(player, stack); + } else { + if(stack.getItem() instanceof ItemGunBaseNT) { + if(!InventoryUtil.mergeItemStack(this.inventorySlots, stack, 7, 8, false)) return null; + } else { + if(!InventoryUtil.mergeItemStack(this.inventorySlots, stack, 0, 7, false)) return null; + } + } + + if(stack.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } + } + + return copy; } public class ModSlot extends Slot { @@ -171,12 +197,14 @@ public class ContainerWeaponTable extends Container { public void putStack(ItemStack stack) { super.putStack(stack); refreshInstalledMods(); + WeaponModManager.onInstallStack(gun.getStackInSlot(0), stack, index); } @Override public void onPickupFromSlot(EntityPlayer player, ItemStack stack) { super.onPickupFromSlot(player, stack); refreshInstalledMods(); + WeaponModManager.onUninstallStack(gun.getStackInSlot(0), stack, index); } public void refreshInstalledMods() { diff --git a/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java b/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java index e1fddc0de..557ee78e3 100644 --- a/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java @@ -137,6 +137,27 @@ public class AmmoPressRecipes extends SerializableRecipe { null, smokeless.copy(2), null, null, sSmall, null)); + recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P45_SP, 8), + null, lead, null, + null, smokeless, null, + null, cSmall, null)); + recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P45_FMJ, 8), + null, steel, null, + null, smokeless, null, + null, cSmall, null)); + recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P45_JHP, 8), + plastic, copper, null, + null, smokeless, null, + null, cSmall, null)); + recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P45_AP, 8), + null, wSteel, null, + null, smokeless.copy(2), null, + null, sSmall, null)); + recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P45_DU, 8), + null, uranium, null, + null, smokeless.copy(2), null, + null, sSmall, null)); + recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R556_SP, 16), null, lead.copy(2), null, null, smokeless.copy(2), null, diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java index ff80ce43c..1d58a9f7f 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java @@ -158,7 +158,7 @@ public class GunFactory { SILENCER, SCOPE, SAW, GREASEGUN, SLOWDOWN, SPEEDUP, CHOKE, SPEEDLOADER, FURNITURE_GREEN, FURNITURE_BLACK, BAYONET, - STACK_MAG, + STACK_MAG, SKIN_SATURNITE, } public static enum EnumModCaliber { diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java b/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java index 557123942..9658c3cf4 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/Orchestras.java @@ -920,7 +920,7 @@ public class Orchestras { if(type == AnimType.CYCLE) { if(timer == 0) { - int rounds = WeaponModManager.hasUpgrade(stack, ctx.configIndex, 208) ? 2 : 1; + int rounds = WeaponModManager.hasUpgrade(stack, ctx.configIndex, WeaponModManager.ID_MINIGUN_SPEED) ? 3 : 1; for(int i = 0; i < rounds; i++) { SpentCasing casing = ctx.config.getReceivers(stack)[0].getMagazine(stack).getCasing(stack, ctx.inventory); if(casing != null) CasingCreator.composeEffect(entity.worldObj, entity, aiming ? 0.125 : 0.5, aiming ? -0.125 : -0.25, aiming ? -0.25 : -0.5D, 0, 0.18, -0.12, 0.01, (float)entity.getRNG().nextGaussian() * 15F, (float)entity.getRNG().nextGaussian() * 15F, casing.getName()); diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java index d9698f42f..fe742a0a3 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactoryEnergy.java @@ -132,9 +132,9 @@ public class XFactoryEnergy { energy_las_ir = new BulletConfig().setItem(EnumAmmo.CAPACITOR_IR).setCasing(new ItemStack(ModItems.ingot_polymer, 2), 4).setupDamageClass(DamageClass.FIRE).setBeam().setSpread(0.0F).setLife(5).setRenderRotations(false).setOnBeamImpact(LAMBDA_IR_HIT); ModItems.gun_tesla_cannon = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() - .dura(2_000).draw(10).inspect(33).reloadSequential(true).crosshair(Crosshair.CIRCLE) + .dura(2_000).draw(10).inspect(33).crosshair(Crosshair.CIRCLE) .rec(new Receiver(0) - .dmg(35F).delay(20).reload(44).jam(19).sound("hbm:weapon.fire.tesla", 1.0F, 1.0F) + .dmg(35F).delay(20).spreadHipfire(1.5F).reload(44).jam(19).sound("hbm:weapon.fire.tesla", 1.0F, 1.0F) .mag(new MagazineBelt().addConfigs(energy_tesla, energy_tesla_overcharge)) .offset(0.75, 0, -0.375).offsetScoped(0.75, 0, -0.25) .setupStandardFire().recoil(LAMBDA_RECOIL_ENERGY)) @@ -143,9 +143,9 @@ public class XFactoryEnergy { ).setUnlocalizedName("gun_tesla_cannon"); ModItems.gun_lasrifle = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig() - .dura(2_000).draw(10).inspect(26).reloadSequential(true).crosshair(Crosshair.CIRCLE).scopeTexture(scope_luna) + .dura(2_000).draw(10).inspect(26).crosshair(Crosshair.CIRCLE).scopeTexture(scope_luna) .rec(new Receiver(0) - .dmg(50F).delay(8).reload(44).jam(36).sound("hbm:weapon.fire.laser", 1.0F, 1.0F) + .dmg(50F).delay(8).spreadHipfire(1F).reload(44).jam(36).sound("hbm:weapon.fire.laser", 1.0F, 1.0F) .mag(new MagazineFullReload(0, 24).addConfigs(energy_las, energy_las_overcharge, energy_las_ir)) .offset(0.75, -0.0625 * 1.5, -0.1875) .setupStandardFire().recoil(LAMBDA_RECOIL_ENERGY)) diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/IWeaponMod.java b/src/main/java/com/hbm/items/weapon/sedna/mods/IWeaponMod.java index 3dd6c6dc2..a6b959bc7 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/mods/IWeaponMod.java +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/IWeaponMod.java @@ -10,4 +10,7 @@ public interface IWeaponMod { /** The meat and bones of the upgrade eval. Requires the base value, the held gun, the value's * identifier and the yet unmodified parent (i.e. if the value is part of the receiver, that receiver) */ public T eval(T base, ItemStack gun, String key, Object parent); + + public default void onInstall(ItemStack gun, ItemStack mod, int index) { } + public default void onUninstall(ItemStack gun, ItemStack mod, int index) { } } diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModCaliber.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModCaliber.java index 1dbf1a4b0..1794a8cd4 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModCaliber.java +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModCaliber.java @@ -4,10 +4,13 @@ import java.util.ArrayList; import java.util.List; import com.hbm.items.weapon.sedna.BulletConfig; +import com.hbm.items.weapon.sedna.ItemGunBaseNT; import com.hbm.items.weapon.sedna.Receiver; +import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.MagazineBelt; import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mags.MagazineSingleReload; +import com.hbm.items.weapon.sedna.mags.MagazineSingleTypeBase; import net.minecraft.item.ItemStack; @@ -46,7 +49,6 @@ public class WeaponModCaliber extends WeaponModBase { return (T) DUMMY_FULL; } if(base instanceof MagazineBelt) { - MagazineBelt original = (MagazineBelt) base; DUMMY_BELT.acceptedBullets = cfg; return (T) DUMMY_BELT; } @@ -56,4 +58,17 @@ public class WeaponModCaliber extends WeaponModBase { } return base; } + + /* adding or removing a caliber mod annihilates the loaded rounds */ + public void onInstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); } + public void onUninstall(ItemStack gun, ItemStack mod, int index) { clearMag(gun, index); } + + public void clearMag(ItemStack stack, int index) { + ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); + IMagazine mag = gun.getConfig(stack, index).getReceivers(stack)[0].getMagazine(stack); + if(mag instanceof MagazineSingleTypeBase) { + MagazineSingleTypeBase mstb = (MagazineSingleTypeBase) mag; + mstb.setAmount(stack, 0); + } + } } diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java index ba9bb3c46..c2fb9d39b 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java @@ -127,13 +127,14 @@ public class WeaponModManager { new WeaponModDefinition(EnumModSpecial.GREASEGUN).addMod(ModItems.gun_greasegun, new WeaponModGreasegun(ID_GREASEGUN_CLEAN)); new WeaponModDefinition(EnumModSpecial.SLOWDOWN).addMod(ModItems.gun_minigun, new WeaponModSlowdown(207)); new WeaponModDefinition(EnumModSpecial.SPEEDUP) - .addMod(ModItems.gun_minigun, new WeaponModMinigunSpeedup(208)) + .addMod(ModItems.gun_minigun, new WeaponModMinigunSpeedup(ID_MINIGUN_SPEED)) .addMod(new Item[] {ModItems.gun_autoshotgun, ModItems.gun_autoshotgun_shredder}, new WeaponModShredderSpeedup(209)); new WeaponModDefinition(EnumModSpecial.CHOKE).addMod(new Item[] {ModItems.gun_pepperbox, ModItems.gun_maresleg, ModItems.gun_double_barrel, ModItems.gun_liberator, ModItems.gun_spas12}, new WeaponModChoke(210)); new WeaponModDefinition(EnumModSpecial.FURNITURE_GREEN).addMod(ModItems.gun_g3, new WeaponModPolymerFurniture(ID_FURNITURE_GREEN)); new WeaponModDefinition(EnumModSpecial.FURNITURE_BLACK).addMod(ModItems.gun_g3, new WeaponModPolymerFurniture(ID_FURNITURE_BLACK)); new WeaponModDefinition(EnumModSpecial.BAYONET).addMod(ModItems.gun_mas36, new WeaponModMASBayonet(ID_MAS_BAYONET)); new WeaponModDefinition(EnumModSpecial.STACK_MAG).addMod(new Item[] {ModItems.gun_greasegun, ModItems.gun_uzi, ModItems.gun_uzi_akimbo, ModItems.gun_aberrator, ModItems.gun_aberrator_eott}, new WeaponModStackMag(214)); + new WeaponModDefinition(EnumModSpecial.SKIN_SATURNITE).addMod(new Item[] {ModItems.gun_uzi, ModItems.gun_uzi_akimbo}, new WeaponModUziSaturnite(ID_UZI_SATURN)); BulletConfig[] p9 = new BulletConfig[] {XFactory9mm.p9_sp, XFactory9mm.p9_fmj, XFactory9mm.p9_jhp, XFactory9mm.p9_ap}; BulletConfig[] p45 = new BulletConfig[] {XFactory45.p45_sp, XFactory45.p45_fmj, XFactory45.p45_jhp, XFactory45.p45_ap, XFactory45.p45_du}; @@ -178,9 +179,11 @@ public class WeaponModManager { public static final int ID_NO_SHIELD = 204; public static final int ID_NO_STOCK = 205; public static final int ID_GREASEGUN_CLEAN = 206; + public static final int ID_MINIGUN_SPEED = 208; public static final int ID_FURNITURE_GREEN = 211; public static final int ID_FURNITURE_BLACK = 212; public static final int ID_MAS_BAYONET = 213; + public static final int ID_UZI_SATURN = 215; public static ItemStack[] getUpgradeItems(ItemStack stack, int cfg) { if(!stack.hasTagCompound()) return new ItemStack[0]; @@ -240,12 +243,28 @@ public class WeaponModManager { } } - public static boolean isApplicable(ItemStack gun, ItemStack mod, int cfg, boolean checkMutex) { - if(gun == null || mod == null) return false; //if either stacks are null + public static void onInstallStack(ItemStack gun, ItemStack mod, int cfg) { + IWeaponMod newMod = modFromStack(gun, mod, cfg); + if(newMod == null) return; + newMod.onInstall(gun, mod, cfg); + } + + public static void onUninstallStack(ItemStack gun, ItemStack mod, int cfg) { + IWeaponMod newMod = modFromStack(gun, mod, cfg); + if(newMod == null) return; + newMod.onUninstall(gun, mod, cfg); + } + + public static IWeaponMod modFromStack(ItemStack gun, ItemStack mod, int cfg) { + if(gun == null || mod == null) return null; WeaponModDefinition def = stackToMod.get(new ComparableStack(mod)); - if(def == null) return false; //if the mod stack doesn't have a mod definition - IWeaponMod newMod = def.modByGun.get(new ComparableStack(gun)); - if(newMod == null) newMod = def.modByGun.get(null); //if there's no per-gun mod, default to null key + if(def == null) return null; + IWeaponMod newMod = def.modByGun.get(new ComparableStack(gun).makeSingular()); //shift clicking causes the gun to have stack size 0! + return newMod; + } + + public static boolean isApplicable(ItemStack gun, ItemStack mod, int cfg, boolean checkMutex) { + IWeaponMod newMod = modFromStack(gun, mod, cfg); if(newMod == null) return false; //if there's just no mod applicable if(checkMutex) for(int i : gun.stackTagCompound.getIntArray(KEY_MOD_LIST + cfg)) { diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModUziSaturnite.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModUziSaturnite.java new file mode 100644 index 000000000..baba38d00 --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModUziSaturnite.java @@ -0,0 +1,22 @@ +package com.hbm.items.weapon.sedna.mods; + +import com.hbm.items.weapon.sedna.GunConfig; +import com.hbm.items.weapon.sedna.Receiver; + +import net.minecraft.item.ItemStack; + +public class WeaponModUziSaturnite extends WeaponModBase { + + public WeaponModUziSaturnite(int id) { + super(id, "FURNITURE"); + this.setPriority(PRIORITY_ADDITIVE); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + if(key == GunConfig.F_DURABILITY) return cast((Float) base * 5F, base); + if(key == Receiver.F_BASEDAMAGE) return cast((Float) base + 3F, base); + return base; + } + +} diff --git a/src/main/java/com/hbm/main/ResourceManager.java b/src/main/java/com/hbm/main/ResourceManager.java index 1f3c3dd08..6f56ba605 100644 --- a/src/main/java/com/hbm/main/ResourceManager.java +++ b/src/main/java/com/hbm/main/ResourceManager.java @@ -958,6 +958,7 @@ public class ResourceManager { public static final ResourceLocation flamethrower_daybreaker_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/flamethrower_daybreaker.png"); public static final ResourceLocation mike_hawk_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/lag.png"); public static final ResourceLocation uzi_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/uzi.png"); + public static final ResourceLocation uzi_saturnite_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/uzi_saturnite.png"); public static final ResourceLocation panzerschreck_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/panzerschreck.png"); public static final ResourceLocation g3_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/g3.png"); public static final ResourceLocation g3_green_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/g3_polymer_green.png"); diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUzi.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUzi.java index 4752e9443..1fdea82b0 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUzi.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUzi.java @@ -35,7 +35,7 @@ public class ItemRenderUzi extends ItemRenderWeaponBase { public void renderFirstPerson(ItemStack stack) { ItemGunBaseNT gun = (ItemGunBaseNT) stack.getItem(); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex); + Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex); double scale = 0.25D; GL11.glScaled(scale, scale, scale); @@ -143,7 +143,7 @@ public class ItemRenderUzi extends ItemRenderWeaponBase { GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_SMOOTH); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex); + Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex); ResourceManager.uzi.renderPart("Gun"); ResourceManager.uzi.renderPart("StockBack"); ResourceManager.uzi.renderPart("StockFront"); @@ -159,14 +159,14 @@ public class ItemRenderUzi extends ItemRenderWeaponBase { boolean silenced = hasSilencer(stack, 0); - if(silenced) { + if(silenced && type == ItemRenderType.INVENTORY) { double scale = 0.625D; GL11.glScaled(scale, scale, scale); GL11.glTranslated(0, 0, -4); } GL11.glShadeModel(GL11.GL_SMOOTH); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex); + Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex); ResourceManager.uzi.renderPart("Gun"); ResourceManager.uzi.renderPart("StockBack"); ResourceManager.uzi.renderPart("StockFront"); @@ -179,4 +179,8 @@ public class ItemRenderUzi extends ItemRenderWeaponBase { public boolean hasSilencer(ItemStack stack, int cfg) { return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_SILENCER); } + + public boolean isSaturnite(ItemStack stack) { + return WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_UZI_SATURN); + } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUziAkimbo.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUziAkimbo.java index 68ab84b23..ec538663b 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUziAkimbo.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderUziAkimbo.java @@ -36,10 +36,10 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { float offset = 0.8F; for(int i = -1; i <= 1; i += 2) { - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex); + int index = i == -1 ? 0 : 1; + Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, index) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex); GL11.glPushMatrix(); - int index = i == -1 ? 0 : 1; standardAimingTransform(stack, -2.25F * offset * i, -1.5F * offset, 2.5F * offset, 0, -4.375 / 8D, 1); double scale = 0.25D; @@ -156,7 +156,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { public void renderEquipped(ItemStack stack) { GL11.glShadeModel(GL11.GL_SMOOTH); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex); + Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, 1) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex); ResourceManager.uzi.renderPart("Gun"); ResourceManager.uzi.renderPart("StockBack"); ResourceManager.uzi.renderPart("StockFront"); @@ -170,7 +170,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { public void renderEquippedAkimbo(ItemStack stack) { GL11.glShadeModel(GL11.GL_SMOOTH); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex); + Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, 0) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex); ResourceManager.uzi.renderPart("GunMirror"); ResourceManager.uzi.renderPart("StockBack"); ResourceManager.uzi.renderPart("StockFront"); @@ -185,7 +185,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_SMOOTH); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex); + Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, index) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex); ResourceManager.uzi.renderPart(index == 0 ? "GunMirror" : "Gun"); ResourceManager.uzi.renderPart("StockBack"); ResourceManager.uzi.renderPart("StockFront"); @@ -199,7 +199,6 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { public void renderOther(ItemStack stack, ItemRenderType type) { GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_SMOOTH); - Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.uzi_tex); boolean silencer0 = hasSilencer(stack, 1); boolean silencer1 = hasSilencer(stack, 0); @@ -216,6 +215,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { GL11.glScaled(scale, scale, scale); GL11.glTranslated(0, 0, -4); } + Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, 1) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex); ResourceManager.uzi.renderPart("Gun"); ResourceManager.uzi.renderPart("StockBack"); ResourceManager.uzi.renderPart("StockFront"); @@ -238,6 +238,7 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { GL11.glScaled(scale, scale, scale); GL11.glTranslated(0, 0, -4); } + Minecraft.getMinecraft().renderEngine.bindTexture(isSaturnite(stack, 0) ? ResourceManager.uzi_saturnite_tex : ResourceManager.uzi_tex); ResourceManager.uzi.renderPart("GunMirror"); ResourceManager.uzi.renderPart("StockBack"); ResourceManager.uzi.renderPart("StockFront"); @@ -252,4 +253,8 @@ public class ItemRenderUziAkimbo extends ItemRenderWeaponBase { public boolean hasSilencer(ItemStack stack, int cfg) { return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_SILENCER); } + + public boolean isSaturnite(ItemStack stack, int cfg) { + return WeaponModManager.hasUpgrade(stack, cfg, WeaponModManager.ID_UZI_SATURN); + } } diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateBase.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateBase.java index 896112e17..1dac5081a 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateBase.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityCrateBase.java @@ -191,7 +191,7 @@ public abstract class TileEntityCrateBase extends TileEntityLockableBase impleme /// For when opening from a player's inventory. public static void spawnSpiders(EntityPlayer player, World worldObj, ItemStack crate) { - if(crate.getTagCompound().getBoolean("spiders")) { + if(crate.hasTagCompound() && crate.getTagCompound().getBoolean("spiders")) { Random random = new Random(); for (int i = 0; i < numSpiders; i++) { diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 8d8a8a260..577bbd545 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -3697,6 +3697,14 @@ item.wd40.name=VT-40 item.weapon_bat.name=Richards Standard item.weapon_bat_nail.name=Das Klischee item.weapon_golf_club.name=Schläger des russischen Mafiosos +item.weapon_mod_caliber.bmg50.name=.50 BMG Konversionskit +item.weapon_mod_caliber.m357.name=.357 Magnum Konversionskit +item.weapon_mod_caliber.m44.name=.44 Magnum Konversionskit +item.weapon_mod_caliber.p22.name=.22 lfB Konversionskit +item.weapon_mod_caliber.p45.name=.45 Konversionskit +item.weapon_mod_caliber.p9.name=9mm Konversionskit +item.weapon_mod_caliber.r556.name=5.56mm Konversionskit +item.weapon_mod_caliber.r762.name=7.62mm Konversionskit item.weapon_mod_generic.bigmt_damage.name=Optimierter Saturnit-Verschluss item.weapon_mod_generic.bigmt_dura.name=Langlebige Saturnit-Teile item.weapon_mod_generic.bronze_damage.name=Optimierter Bronzeverschluss @@ -3723,6 +3731,7 @@ item.weapon_mod_special.greasegun.name=Grease Gun Modernisierungskit item.weapon_mod_special.saw.name=Bügelsäge item.weapon_mod_special.scope.name=Ziehlvorrichtung item.weapon_mod_special.silencer.name=Schalldämpfer +item.weapon_mod_special.skin_saturnite.name=Saturnit-Skin item.weapon_mod_special.slowdown.name=Rädergetriebe item.weapon_mod_special.speedloader.name=Schnelllader item.weapon_mod_special.speedup.name=Elektrischer Servomotor diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 9085b8d52..b3bf02dd6 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -4723,6 +4723,14 @@ item.wd40.name=VT-40 item.weapon_bat.name=Richard's Default item.weapon_bat_nail.name=The Cliché item.weapon_golf_club.name=Russian Mobster's Club +item.weapon_mod_caliber.bmg50.name=.50 BMG Conversion Kit +item.weapon_mod_caliber.m357.name=.357 Magnum Conversion Kit +item.weapon_mod_caliber.m44.name=.44 Magnum Conversion Kit +item.weapon_mod_caliber.p22.name=.22 LR Conversion Kit +item.weapon_mod_caliber.p45.name=.45 Conversion Kit +item.weapon_mod_caliber.p9.name=9mm Conversion Kit +item.weapon_mod_caliber.r556.name=5.56mm Conversion Kit +item.weapon_mod_caliber.r762.name=7.62mm Conversion Kit item.weapon_mod_generic.bigmt_damage.name=Optimized Saturnite Receiver item.weapon_mod_generic.bigmt_dura.name=High-Durability Saturnite Parts item.weapon_mod_generic.bronze_damage.name=Optimized Bronze Receiver @@ -4749,6 +4757,7 @@ item.weapon_mod_special.greasegun.name=Grease Gun Modernization Kit item.weapon_mod_special.saw.name=Hacksaw item.weapon_mod_special.scope.name=Scope item.weapon_mod_special.silencer.name=Silencer +item.weapon_mod_special.skin_saturnite.name=Saturnite Skin item.weapon_mod_special.slowdown.name=Gear Train item.weapon_mod_special.speedloader.name=Speedloader item.weapon_mod_special.speedup.name=Auxiliary Electric Engine diff --git a/src/main/resources/assets/hbm/textures/items/weapon_mod_sheet.png b/src/main/resources/assets/hbm/textures/items/weapon_mod_sheet.png index 0a9ac00437b62ca1098ec1fae6cec1ce6c99d61c..be0625b8f19cdc5a92ae2a10de6dff8d7b451202 100644 GIT binary patch delta 3298 zcmV<83?1{(81@;EG=Hs0L_t(|ob6muXdK5G{?;6#^x=YJ`GQ2jmpE4Ls6^vp2sB0~ zsg1xWlq2LW7AfHlh@iTE#I0LZotr zQzYBfg;YoGPCDrVY2qeKA5Q;jc5e1|<|NCu;tv*`cK4gz{eQoie`fxFXARa5h7}lZ z!+;7}n8jhgS*6_N>+``25Rb=MJRWCKl0!i}U%L!}PuyDhu~IW&L$@(v1`{Zgu`KW_Uu_TH90;2y!OU1+Qo*3hLp>Q$K$M6EZY9p z;R8S-kuU}Z27jyv92gkT;;#jfNQCwE^#Ldwcw}Tm>DmThH-52LM16fdip3&yM2N@Z z?6o(J;fv)Z0Ki)>4=9&G#^=ushr_JCz8<m zqinxWD8vpQK8)GfSu8IvV}5=f2O8c%+pFKZ^0&}GWPf}BmI&c+SgCo&<8k)vp9k>8 z@)E9oK4Tf5FC&piNXwEL9{|ptJ!=$;MQFK10CRJ5*5>#7!M6xELrgWe+vK%4GkHYOa`S=38hjAfW8Pwc|52=?t?0o|U)pnpH&R~G}EMTo^> zhEoes6@iSuVt9l5ttEo!MpSFEX`03pi*KQ&$A5<#=>?#40Drsige$*7MKTruc)eZ# zQ0@~%E(uA$d68vEBoZtZi%HL^)+fk}53G)g{C>Z6u3MiF3WZo}Yby>kyo1&k9s#`n zz>QBLm^nXf`SfZS>ji7+@uBg4AL@cz@uxRB@yG5nj(ll>wTM8*BW^yQ2LNo_whaKV zeSiCQB@t^C!SDAo-uMK5Xi7r3i69zrts+$8Z;=&Hi#y8a^GGBTESXFiJU^e$!|U}b zyR&NUXy;Gr6<%()y2*K?LT;eGmg@}&X*`XU@U zbjTnP03el089=!O==Lcx5f1IUkA0c{7JocK5ppDmU$zN z_nT;a;SpSZ^9nkL)j|#`B32aua2CM{q6kkv{j_zAhPkQ}yjUz|9NKpuOI`okGJn3z z{iuLMNF)*lb=oQ*BewMTFy3z}8(-u*i^vCts-UZ@i_zBE*~x&FIFbYZ$dMzAcO%5* z&#A_jVQ_y7JGAdUM(#(I@Avzyb9m$HTwmsPbou`|;bVL`>c=|^1Wnl|xC}W-S0g*_=+I0CI*@?%GA7>L26KHR5$Hc@0 zPMkY*?yfKhL5NL;>JyolmS)n?fc zQ5FmaZTr&cw6+MW7-Hl7CKj&&kB^45L?A=z<^qUI!(=kFY@diwD8#zEyRm!sZp_Zk z!Zb~-d_Z@1H}1LT9xN{}Zlo8` zaUzY!M?;uDm)6QHOioT>a({ACI~M?yMXRr`x5^^ptIR*h_^3!0di0M-6%HjAdFChJ%_omMH&ZnV;Y@(d8LX3y1(K*r}$OL~-$$z%Ym1{B>O z4Mk&`wHfxzmMj-wnx-+(Y_f))asaLcWi9|z9$8DF@HfrmMG?d@P17_+Mn){-i%Augd!||M{JAvhf?Lr#kW$YF zkc%M~#3P%{Vrgj!&ph*tYo|;hV_-F8L7{BG*#{HIn3+sQITX%clel8;K|IH)Jl%M{ z3{*yQPtY}#y#-kH{eJ)~pU-d98uIx(g27@7gq_Y=tAOG``E-}d%)1cN~&lS!pcxl}5lSS%uw z$zX174y95_$@m1_C@gibv;lS(6OYGPCX=Z+#|bhKZfZV2=70Nx!635PEP}zHB@o{) zICaXqckgz*F+Mfu2AwFZ=x$`AAUBSPjmigj0Q=|%up2j>P9v2{8PRBz@h<73k3Nz< zK(ScF`M=~)7yJP?(hDeD&!O@D?@_p(!?S1nZuf0NGMTheoFsyq;dtndf<$x~bBhbLcu0CRJ5n3|f>9#WDBD#j<*!@mR|+ouESRARL#)9N;vfcW{U#0wY9Nr+qPM6LM$#WqM@Myi+_uY0ALe9#@B(!4~N67R4T#i z^;V2<_%J$&pmY7PUNF)4x_nVY)(?9uh-!N(m2xZ35vf$l5ECziT57)z$mmYjuch`A zYN`1me+;<_5$~9Mz-Hy&G5LVa%J%>o3kwLO^h)cw-T1Q5gl%?QxfHgKYqEIMcdV0Eo-__N{yk0MASrfp6hMW|7 zpph8hJ_vA1$mr$+rlzKp`5vHLyT8gU;9lQW+kXkP@7U3Ijp36Q4Qd6wPd&!pnvw%iTHcit2 zz`DD;F*P-X69?0HIpAR`!8;F7HuP7yg^GjXKKftWUnmq%C=@FA;y(Icb}q2KBGd{# zA%7EzMA*p4i1jYNTRs2)JGDQJx?oT*A3(L4gy01c-Hl8rs?8(>FNj#vos3UNCX)sQ z^PDnbs@XMN@Hv6z=4P#|81eahK+E2MYXHycgp(IPbFFRFe1D-(aOKNs{tAphL8ROgxH2k-gOC1_0nWyD8-g}AHnNq!(&MUb$aYT}Lx0ru zY5|1xYzeaTWW_{``T`Pyhg%B(Y<)omU$+HV_aw9g-8IZ>0biRJ&rh$ZCDa91k}_ON za9$yE@iRm0nB80yk3ykfh#j+=i>d~GbhJ^%Cs1~);lT!s_nXQsfaf}8);xSZK!$3g zBb9h~wb4;6`2gPd)%YqaadfUP3x6l8@|`kk9rX$;WNs&@bh?zfywLEOHROP zrOn-Zzy|ZjdciulD9PP?z#93HUqk@_r?-tL@jHiwN`E`P-+#OEW$*WgLLoLfI=a5= z1AeTiWqrW-&rNg;qNXS+AWXy_I&q!>z|`;dRuoX}*k*wE%^&_9f0cYdB!3dY&Ye3e z))u(&D@H-zWUe{hWVK_P0le{b-UX#7D)9m6uMeOa{?qL{tluK&*k)}7WPJKciZx?Z zTps{{`FuXS9C*)KTL4tg2Y3MBXTLwlzR6s};?V(6+OXl^z|DT%+Y0;wiyP?$Y1lxe zjImy@h6l^BpVo&{xbaDKzJCV*zWnD=qvfy1ZM9x>H$UCJV-1gYXTUXfBZ=obmI0u- z$DMDvpqUq+GboZN!_14%ZA!NzLM4EvT2`$s2|zilOk1rFb0>qo?eN{@R>q1U#(qe% z?=H78)y{RTd;|gkM%$X6u)e5Kg`*rzzKH!e} gUeIRYi}`^613xi0zUv92djJ3c07*qoM6N<$f*?XV*#H0l delta 3131 zcmV-B48-&H8PFJzG=B$4L_t(|ob6m+Xd6c!{x%qMPbzj~73ZbupZL6-&5 z3Obm>VSl(y+2QN+!3&T~CRs9>WKxnxLp)!*4S`SGM)`?ELjAK#_C zC-BwUDgfY}mq(S`py2c8Mx#;I($WH55fX_63x~r9hr?J}TGA3h?7VueYt?ilc%Kbm&;|T z2&q)ch<`?-QjV?&y}i8*0H&v>8x{e8)00D?5V9{dv5yQG)Z2k-&*fhemY0|DiCdq? zuyB6f$?5elH3Zf%7((!&5Sq>1_{*Dp`18OSPrkIlMns_C5w}z-0RY$ zh<}ZW5DteKAAAD8G$kSYL=c0xQ4#9#cgY%PBpsDXC8X17mdRuco?j}J5C{a6(^yxeZxo$$!sqnO1jjfZkZ3_^oWJ7 z7azstx2~dZT+MP&5wWfSfVT)<5JhDEvAAc2) z2&h$BrGtl`B^Ofa!2+PJfKYFIHvx3{;0Peo!{@_)lquRr2Ef9}lh zw739VH7IHP#b#& zOZ6&|X(E%!C{4X=w?S zN<}I71YH-FCRlm^?i7xLZsl&Ge4~iqLqDK=qlo9ug#A9Z3z$y zVBJprn7LfQ?(S~Z*4E~H6Jlj$1+A^ESXo&C0G9wVzJCrxel!|ol}ZJHK%i!Y!`tX2 zg3k4)hQP$&>+(er*$CWT5cT$KHtW}(C$ibBAr@W;jr4vUP|&@u-$?H#G}7}${uGKe zBHlIifS)V>uBiw7T=`9a#>N5yDZM^=wi{n&O}Ork8@&E)FUQS~mtp{bSggJkE#ph; z0W$pQg?~c~08YH|K|{Ilz<~n{04`m+B;{|!f)?B14ZVH)_936oJBxrjflaLkcwy-2 z$JqU$-T0<>6XPc@Y6q#avy%mbL6pm7%+Jr)@caAwSs)NVBYOgP(2|p^2U>{%{)+&w zf{boGU~Xg8Np!C z#iwJJE?qL_=jRO?1)ZIpOca5?>1t$m43A2s0^WF21@+{`#YI4)CtH?f0AK?H1DKne z!}~Af@N#DpQ!($FfNG$>Dc-DkQ#?km#pC628Rc@hhA$qY*Rpeg%@v_h@CBJzEXF1# zCV!mo^83{T0I*Ysb7(eAy?OxkW)gxIL`*j_p{O^L5WFB_PxlHwA(P1%WafEQ#8j(m zy5MU9d-m+ns)`YxuLpD-?DRG8oJlxy@eAMHRxkIL%Vl4_EceS$ZzOD_LZ$-h$pDI^U=HeHI zI5GRBC?4f<*$^jYzZ6vu{OV|{f={68R_iZYF+E}_j{u(QRatA|>j5&j}dt%B|}_~7e&7k`voRN@0@ zY=6ML4hlZ~N{VyGs<=M@01Jgec)9aKXKw*ezaFpy4z!v2`^#O7*%8Km%(3q;cQNYC zHIrzaHX7yM^Y9Zvr;SGW_dGT#!e)qg&tpe~ZGasSwgJQ-W?yPz-(T)xDw{N9{2dV* z0RK}n%#J7rU*yY0+`^x0xip*kp1=3g0G~u;BVaps!ipe2ztNh&PCa0o@Wpz-{{eWK VDb>MLE7|}6002ovPDHLkV1ni469fPN diff --git a/src/main/resources/assets/hbm/textures/items/weapon_mod_special.skin_saturnite.png b/src/main/resources/assets/hbm/textures/items/weapon_mod_special.skin_saturnite.png new file mode 100644 index 0000000000000000000000000000000000000000..bfb5e43553273daea9d8988e1d821cf70e7e642b GIT binary patch literal 229 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vfm4_8VZa7>}*dade%&T;l>3_a`(BnGB7BRtc`>J9IR~MIps>fla zd~K={OeYv_ZZOZkmk@fo$yeYcgT?Q&v&|!}J}_mNuC{6ygT6t;roa26UW+WceCz-N YL%6?V6~ng`AP+Hky85}Sb4q9e09x5s*8l(j literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/models/weapons/uzi_saturnite.png b/src/main/resources/assets/hbm/textures/models/weapons/uzi_saturnite.png new file mode 100644 index 0000000000000000000000000000000000000000..5b404a064a9062954e50c786271c4ccab43387e4 GIT binary patch literal 5454 zcma)Ac_36>*q^b}%UD9$Nl0&&8vAYtWu%x?))K}}W69c>Y!N~khB8A@CQFvV*h8`p zS+We-Wd@ZkTfVFJ`~UmyANSlj_uO-y=Q+>s_x#R0v9vJZ;ov zSAm6QvL|!h^F19M$UeShs2Zow)k3@4eAhrQee$GIED{p-QxapW8yd)=EU9bcxoUP< zuDYGIo&Jx|r7vvvGBSKi9FlkuT=~J)R#x`*M^mA>JH_j)ZODQ;q6fKf-{#uzMxzQZ z=yAn{lVV`)pEw)RWrb15?{7IYPSCf@56Tn=J`HWTo?LmrDy8uit2h-&9ON<(>97d4 z^UCgZrJo9s{))CRwwOYmNxe>8pY9JoGHBT$icKH-M$0HP?mNg!{hH5*guoxxcf0TI;lk67Ig1g_N**u$>}PfYue*Kv70w9vh}YMz9-d86ydyTLMEF;VxA@vw zjY;f@>7(m=y>7X@gBo{Q$KFVr+4(X^NP$^5i}3%Fb;L=x*O%6EA8EJHZ|XjWD`l^^ z|5{Yx;V~3Kt6?~isl#!&it5rL^ag*xz%PwTYN?mpwW<0b-cP%Js!?#$+{Ir%f(A4e z8-+UTN`&8@Sw=eq{?-T!yRPKcs_tljy^xD1tBqLMY; zBrE0Csu8&)E4%Y@x+(a<#O#mrvJ=GA3>3xHq{Y>gukQ!E44iZ~6BwCJ9F^8k=bG*u z_LQye)%~-Z)unkSw}@kTb=6z8;l#D0HAOA^se2#Z1|FTzYlv8MlToksnYz+T8{@Aq zkG?zXS7RBQ&O`Ze=Ru9)#{SOy`lAC<_{Hol`dqG{*rMvpd${h`H0e~i1bLkxZLv|V z%Z`~=y!J@m?SKa`Mh2m&i{j+Yna1#o`>S1kk$bzPMn?C4W}6t$?c@4})t8I3O#R$c zvy(Cq0|e`SDXG%hDG>gNtayZamrc9z%)#b{W9RG-;#_G{2vjNue3a#9kv2cnME91& zV`8gcg>TL*ABS~dZ*yMBmBjAl|C@jK!L=1J-bN>PEhQ1-!pA-C;(UXRHeZ;a^{$4R z8k0-hq%##`UeGM_`jR__MPzO+z)0s;-ofFemI)LImJ4i1P*U`%K9;0=ly5m2P!}3x zke(FO5RR(KvW&~JUZ8DcH{7ud5|wWf zzGj^MsE#alp0WRyQzy=bd@Io5k1Ke$xqHp1{K$<}GC##{s?I+G8d5eo*5e3-h)%81 z9VdsJKl^%y?~?)J+t;Ojq$;iox}>;f%AER}&}~+JsP$Y+|U*^Qs}~UgSd;&&u~L#FaxOFT_WUFh{H;90=n* z5op)_^F0*e_xCa;h#)cgn-cOi`+t6W%P-3%+()6TjEuzeBEuKA8~b5ydJ^45vqd|t z=VfwW9=sJFP+590gM$Bgi@al?C~#tIa`HI<$T2GQMQ?BK$7gG{!_8+iiQTa%ITLfk z@d0j0e3XPrF}_!0iAuHK-JbAWIN05=_Yru`rkn#a(ueVrYw89TMKh*pnH6it<`L6ZYx=dG^?f9{J$tvtT04^zQ?!hQD;sf?faKpE4o`*A2f%t7?k z-M6MrTcpd7$Z?GoJC3AA*+=_=fohCg+!V_g{k7Oq{>^fZ3Lo|C4&(`U@3^lKdXVC~ zQli<%OA>%h>HVm&e+w>Yzr`K)1x7EQ);7T4}ZAoEfam%3(5NLdlV8zVdeAcuPOp&+h%)RV#4(1){n5D@Bpgv z0K7ndbt5NYlnseD66xsnxnY01`W=2>-7Ax`pI$qw=}6NqImahqEZPgtTsUUHJEWcl z;ZYMf?2T7el0XgS_S#6Vt$Qw&j<}x-t9aRH-lF&m1kBt^yg})Ox1-}gLkZVmFq{@NYz$-wGu-*+^s;^IxBC~}tBQ>$1~iBWy2?XLW~Vog#p?*hZNfQmBb0Xe)jXPo$vCQ-Z4nk zw-GRaMVO=h$srVLR=!(VA9wl2`F*!|PGwXWP@8>unB%ZBHY)?)543YOR{wKDDca+M;jh+?9jfFz!fgDLpXf*pW)f0N8<-E5!mMR2*Jbo^`pNasmB zONBA((3d2P5QgJ{>WSPG5JzSf*02_buv+|4P|9cTR9pURgu73Q3HqFnXe%gh5=~F6 zo)%gNZmf*1U;}e5EYAjYk7_*SL?KEFaAF3ZbDLCc+Cu#Uq!nN3rEe~qI*90`3-;$; z4c(;wUNY&Ij)(-_h<7ID=U3?IX*TvA9Q=0cw>Uc39U!_i)u+TiJQNzgxvi#~Wj-jE zpn1Fhp>_t9O1)Fc%=ZGM9+NMC<^pOw+~7;5pvz{su6Uq79QpAy=nI{S+85POh;D4B(15mF7uw5RWx!aRY#EMQOJe0x{Lt z<6`SU5ohq=#GA}LeUBRqSRaaSh+J}!4L?r6QMfY0}4_B9_Rph`TFLDv;swjMw83V z%|^3aQ5s<8Zd6bH5`HSB!`UqDbwyz2744>1K#xm<8ekiW3MB>4k%t!`4Ob_(mCnn^ zx5$ru@ldEHELSA|HK5j$C?kJ56#KhqDelP?r}S7q)da)6oK+bS+pscM!Xqc=8LDrwe7 zV_vF*y0U6E6%6w6ss$x#27o3?$Fm>KLUipIMV0}!egADwTlwXDvyw8G5C{|lh)~eU zS#C8;j6XS2srMeB56w#)(&wEV^OD@Z+wf>?9nJeWMh5S@twpj+#GzTZpU*oT&DTc^ z*l;F2^1F(X4Gz-0!64*-uMoXsJD+s=jr)Xa34M95}|5O8W){Jy(AZea# z;`~s<8Myu>E^-(FS_i)U-{@X-q}D0cB<|}5XHKp#;`}K=z(yXgXRn}Diw*Qke8^3a zdit0Y1Cd7#4(})Y=LFD^xH6_kpi3+UZZ#gqVTiSoZ4U1(nG*;5vflxy=;)83`oUGz zr56BWuE|wK#&0XPbqNUezw4f2kw*rcGfV5sP!UV*DN3Wf3;nOm6C84r4bi ziEnwQItZC=``DEpYGG9rT&Ke#8r8Z;ok96$`Jp&DkCB8q^7m!RNa&xWS{F_DWW zz0Jc;ry0pUQ179g`gL!n_QB@xjCK zf3})&YQB$Rp>_<1{{cw7CGM=(-^XRFVJ?CF6bG>L7y#BM|F$H0hwq;dMcQur($R2t zC@85M^}yHHx9|+l?Re9H(L(W~?#{XLQQwOvZrR%MrP^Rw>H9Pd_ZCM}jQuynhi+t>iQi8hjMsGJNZ~-Sj?V-S>ztktFWBae1CgMsypt2nD?%`3G|4 zr7mv?PuH^ilJh=q6$BJ~Pem8>NN%grUYg5%57%9am`FvD^q3Td0Kt%TXmK@lnrh?0OJ`e4CMlcsUsj3YGw%~aMAM`RxV2`_ z5;Z)Bp!oA}b;d}EoUIv^@3DI_$~K~v1D~vczln+xxIjuG4%QR}L!1)}sOEJe24Dj~ zI$aXr2Pw%NzlgO^wmSj(mbS++E};Yl!DfNO9q1rUcei6x?`RAAtKq6(|K#?bFm`@= zYInyNagKFVK zF)ot!qy}{S=SN3h9N$Pijg!HHQ(TD77xKBfEX>>|9rVvL2%$&Qq-XY8yQIwqSAGgk zh091u9ii4)3(1>Js8#IaqPOhGW@m)3T$MG^UM;+DX=4D;vh41ncMEFZ_PMraK4F<(+e7O(+~#PC;-aiu!dSB1do?zs69_6Y zMY<6EtS`=aG-@e*-JUF0+T?E*sZLqB{kjm%6|#K>?^~an(H$FLRU&WW{F#uWHsqxG ZM_h>jnd&Mp@&_a<$jsQnsKn3-^FPj%YEl3I literal 0 HcmV?d00001 From d6c15c8ff2d5e235a9c32706bc7091288bc4d6e8 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 23 Mar 2025 21:46:56 +0100 Subject: [PATCH 04/12] the malicious gigglefish from the silly dimension --- changelog | 7 ++++- gradle.properties | 2 +- src/main/java/api/hbm/fluid/IFluidUser.java | 0 .../java/com/hbm/crafting/WeaponRecipes.java | 16 +++++++++++ .../inventory/recipes/AmmoPressRecipes.java | 17 ++++++++--- .../hbm/items/weapon/sedna/ItemGunBaseNT.java | 19 ++++++++++-- .../weapon/sedna/factory/GunFactory.java | 3 +- .../weapon/sedna/factory/XFactory556mm.java | 2 +- .../weapon/sedna/factory/XFactory9mm.java | 27 +++++++++++++++++- .../weapon/sedna/mods/WeaponModManager.java | 11 ++++++- .../weapon/sedna/mods/WeaponModOverride.java | 22 ++++++++++++++ src/main/java/com/hbm/lib/RefStrings.java | 2 +- src/main/java/com/hbm/main/ClientProxy.java | 10 +++---- .../packet/toclient/GunAnimationPacket.java | 4 +-- .../com/hbm/render/anim/HbmAnimations.java | 8 ++++-- .../weapon/sedna/ItemRenderWeaponBase.java | 10 +++++++ .../machine/storage/TileEntityBarrel.java | 8 +++++- .../storage/TileEntityMachineFluidTank.java | 16 ++++++----- src/main/resources/META-INF/HBM_at.cfg | 2 ++ src/main/resources/assets/hbm/lang/de_DE.lang | 10 +++++++ src/main/resources/assets/hbm/lang/en_US.lang | 10 +++++++ .../items/weapon_mod_test.override_10.png | Bin 0 -> 267 bytes .../items/weapon_mod_test.override_12_5.png | Bin 0 -> 267 bytes .../items/weapon_mod_test.override_15.png | Bin 0 -> 267 bytes .../items/weapon_mod_test.override_20.png | Bin 0 -> 267 bytes .../items/weapon_mod_test.override_2_5.png | Bin 0 -> 267 bytes .../items/weapon_mod_test.override_5.png | Bin 0 -> 267 bytes .../items/weapon_mod_test.override_7_5.png | Bin 0 -> 267 bytes 28 files changed, 175 insertions(+), 31 deletions(-) delete mode 100644 src/main/java/api/hbm/fluid/IFluidUser.java create mode 100644 src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModOverride.java create mode 100644 src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_10.png create mode 100644 src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_12_5.png create mode 100644 src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_15.png create mode 100644 src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_20.png create mode 100644 src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_2_5.png create mode 100644 src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_5.png create mode 100644 src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_7_5.png diff --git a/changelog b/changelog index b970bea8a..7514dcf6c 100644 --- a/changelog +++ b/changelog @@ -44,6 +44,10 @@ * Crates will not longer show their contents when locked * Crates found in structures will sometimes contain things that aren't items * Beam weapons are no longer pinpoint accurate when firing unscoped +* Reduced the recoil animation's intensity on the G3 by 66%, unless if the stock is sawed off +* The comically long pistol no longer cancels the inspect animation when fired while inspecting + * Instead, it will fire where the gun is pointing, at the player's face + * There's no special animation for this, since in survival mode, that would be lethal anyway ## Fixed * Fixed animation errors on the MAS-36 @@ -56,4 +60,5 @@ * Chunk-loading drones may or may not be fixed * Fixed disperser canisters not actually despawning on impact, endlessly spawning mist clouds * Fixed issues where the new packet system didn't play nice with machines that are being sent packets by other machines, like watz segments and radar screens -* Fixed fat man's piston not being extended correctly in non-first person rendering when unloaded \ No newline at end of file +* Fixed fat man's piston not being extended correctly in non-first person rendering when unloaded +* Fixed weapon equip animation not playing when switching between two weapons of the same type diff --git a/gradle.properties b/gradle.properties index 7e329bde9..ca8db7f3d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mod_version=1.0.27 # Empty build number makes a release type -mod_build_number=5257 +mod_build_number=5278 credits=HbMinecraft,\ \ rodolphito (explosion algorithms),\ diff --git a/src/main/java/api/hbm/fluid/IFluidUser.java b/src/main/java/api/hbm/fluid/IFluidUser.java deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/main/java/com/hbm/crafting/WeaponRecipes.java b/src/main/java/com/hbm/crafting/WeaponRecipes.java index 5ba032b13..6ae2883c3 100644 --- a/src/main/java/com/hbm/crafting/WeaponRecipes.java +++ b/src/main/java/com/hbm/crafting/WeaponRecipes.java @@ -16,6 +16,7 @@ import com.hbm.items.ModItems; import com.hbm.items.weapon.GunB92Cell; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret; +import com.hbm.items.weapon.sedna.factory.GunFactory.EnumModSpecial; import com.hbm.main.CraftingManager; import net.minecraft.init.Blocks; @@ -96,6 +97,21 @@ public class WeaponRecipes { CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE_SHOT, 6), new Object[] { "C", "P", "G", 'C', Blocks.gravel, 'P', Items.paper, 'G', Items.gunpowder }); CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE_IRON, 6), new Object[] { "C", "P", "G", 'C', IRON.ingot(), 'P', Items.paper, 'G', Items.gunpowder }); + //SEDNA Mods + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SILENCER.ordinal()), new Object[] { "P", "B", "P", 'P', ANY_PLASTIC.ingot(), 'B', STEEL.lightBarrel() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SCOPE.ordinal()), new Object[] { "SPS", "G G", "SPS", 'P', ANY_PLASTIC.ingot(), 'S', STEEL.plate(), 'G', KEY_ANYPANE }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SAW.ordinal()), new Object[] { "BBS", "BHB", 'B', STEEL.bolt(), 'S', KEY_STICK, 'H', DURA.plate() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SPEEDLOADER.ordinal()), new Object[] { " B ", "BSB", " B ", 'B', STEEL.bolt(), 'S', WEAPONSTEEL.plate() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SLOWDOWN.ordinal()), new Object[] { " I ", " M ", "I I", 'I', WEAPONSTEEL.ingot(), 'M', WEAPONSTEEL.mechanism() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SPEEDUP.ordinal()), new Object[] { "PIP", "WWW", "PIP", 'P', WEAPONSTEEL.plate(), 'I', GUNMETAL.ingot(), 'W', GOLD.wireDense() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.GREASEGUN.ordinal()), new Object[] { "BRM", "P G", 'B', WEAPONSTEEL.lightBarrel(), 'R', WEAPONSTEEL.lightReceiver(), 'M', WEAPONSTEEL.mechanism(), 'P', DURA.plate(), 'G', ANY_PLASTIC.grip() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.CHOKE.ordinal()), new Object[] { "P", "B", "P", 'P', WEAPONSTEEL.plate(), 'B', DURA.lightBarrel() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.FURNITURE_GREEN.ordinal()), new Object[] { "PDS", " G", 'P', ANY_PLASTIC.ingot(), 'D', KEY_GREEN, 'S', ANY_PLASTIC.stock(), 'G', ANY_PLASTIC.grip() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.FURNITURE_BLACK.ordinal()), new Object[] { "PDS", " G", 'P', ANY_PLASTIC.ingot(), 'D', KEY_BLACK, 'S', ANY_PLASTIC.stock(), 'G', ANY_PLASTIC.grip() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SKIN_SATURNITE.ordinal()), new Object[] { "BRM", " P ", 'B', BIGMT.lightBarrel(), 'R', BIGMT.lightReceiver(), 'M', BIGMT.mechanism(), 'P', BIGMT.plate() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.STACK_MAG.ordinal()), new Object[] { "P P", "P P", "PMP", 'P', WEAPONSTEEL.plate(), 'M', BIGMT.mechanism() }); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.BAYONET.ordinal()), new Object[] { " P", "BBB", 'P', WEAPONSTEEL.plate(), 'B', STEEL.bolt() }); + //Nitra! CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M357_SP, 6), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M357_SP), ModItems.nitra }); CraftingManager.addShapelessAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M44_SP, 6), new Object[] { DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M44_SP), ModItems.nitra }); diff --git a/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java b/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java index 557ee78e3..de3fd9e09 100644 --- a/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java @@ -39,6 +39,7 @@ public class AmmoPressRecipes extends SerializableRecipe { OreDictStack copper = new OreDictStack(CU.ingot()); OreDictStack plastic = new OreDictStack(ANY_PLASTIC.ingot()); OreDictStack uranium = new OreDictStack(U238.ingot()); + OreDictStack ferro = new OreDictStack(FERRO.ingot()); ComparableStack smokeful = new ComparableStack(Items.gunpowder); OreDictStack smokeless = new OreDictStack(ANY_SMOKELESS.dust()); ComparableStack rocket = new ComparableStack(ModItems.rocket_fuel); @@ -195,6 +196,10 @@ public class AmmoPressRecipes extends SerializableRecipe { null, uranium.copy(2), null, null, smokeless.copy(4), null, null, sSmall.copy(2), null)); + recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R762_HE, 12), + he, ferro, null, + null, smokeless.copy(4), null, + null, sSmall.copy(2), null)); recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_SP, 12), null, lead.copy(2), null, @@ -216,6 +221,10 @@ public class AmmoPressRecipes extends SerializableRecipe { null, uranium.copy(2), null, null, smokeless.copy(6), null, null, sBig, null)); + recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_HE, 12), + he, ferro, null, + null, smokeless.copy(6), null, + null, sBig, null)); recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G12_BP, 6), null, nugget.copy(6), null, @@ -259,21 +268,22 @@ public class AmmoPressRecipes extends SerializableRecipe { null, nugget.copy(8), null, null, smokeless.copy(2), null, null, sShell, null)); - recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G10_SHRAPNEL, 4), plastic, nugget.copy(8), null, null, smokeless.copy(2), null, null, sShell, null)); - recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G10_DU, 4), null, uranium, null, null, smokeless.copy(2), null, null, sShell, null)); - recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G10_SLUG, 4), null, lead, null, null, smokeless.copy(2), null, null, sShell, null)); + recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G10_EXPLOSIVE, 4), + he, ferro, null, + null, smokeless.copy(2), null, + null, sShell, null)); recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.G26_FLARE, 4), null, rp, null, @@ -387,7 +397,6 @@ public class AmmoPressRecipes extends SerializableRecipe { null, lPlate , null)); OreDictStack tungsten = new OreDictStack(W.ingot()); - OreDictStack ferro = new OreDictStack(FERRO.ingot()); recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.COIL_TUNGSTEN, 4), null, null, null, null, tungsten, null, diff --git a/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java b/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java index ed086e56e..b0b659935 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java +++ b/src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java @@ -14,7 +14,6 @@ import com.hbm.handler.HbmKeybinds.EnumKeybind; import com.hbm.interfaces.IItemHUD; import com.hbm.inventory.RecipesCommon.ComparableStack; import com.hbm.inventory.gui.GUIWeaponTable; -import com.hbm.items.IEquipReceiver; import com.hbm.items.IKeybindReceiver; import com.hbm.items.weapon.sedna.hud.IHUDComponent; import com.hbm.items.weapon.sedna.mags.IMagazine; @@ -48,7 +47,7 @@ import net.minecraft.world.World; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; -public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipReceiver, IItemHUD { +public class ItemGunBaseNT extends Item implements IKeybindReceiver, IItemHUD { /** Timestamp for rendering smoke nodes and muzzle flashes */ public long[] lastShot; @@ -96,6 +95,7 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei public static final String KEY_LOCKONTARGET = "lockontarget"; public static final String KEY_LOCKEDON = "lockedon"; public static final String KEY_CANCELRELOAD = "cancel"; + public static final String KEY_EQUIPPED = "eqipped"; public static ConcurrentHashMap loopedSounds = new ConcurrentHashMap(); @@ -228,7 +228,6 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei } } - @Override public void onEquip(EntityPlayer player, ItemStack stack) { for(int i = 0; i < this.configs_DNA.length; i++) { playAnimation(player, stack, AnimType.EQUIP, i); @@ -291,6 +290,17 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei return; } + /// ON EQUIP /// + if(player != null) { + boolean wasHeld = this.getIsEquipped(stack); + + if(!wasHeld && isHeld && player != null) { + this.onEquip(player, stack); + } + } + + this.setIsEquipped(stack, isHeld); + /// RESET WHEN NOT EQUIPPED /// if(!isHeld) { for(int i = 0; i < confNo; i++) { @@ -359,6 +369,9 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei // RELOAD CANCEL // public static boolean getReloadCancel(ItemStack stack) { return getValueBool(stack, KEY_CANCELRELOAD); } public static void setReloadCancel(ItemStack stack, boolean value) { setValueBool(stack, KEY_CANCELRELOAD, value); } + // EQUIPPED // + public static boolean getIsEquipped(ItemStack stack) { return getValueBool(stack, KEY_EQUIPPED); } + public static void setIsEquipped(ItemStack stack, boolean value) { setValueBool(stack, KEY_EQUIPPED, value); } /// UTIL /// diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java index 1d58a9f7f..f456c204e 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/GunFactory.java @@ -139,7 +139,8 @@ public class GunFactory { } public static enum EnumModTest { - FIRERATE, DAMAGE, MULTI; + FIRERATE, DAMAGE, MULTI, + OVERRIDE_2_5, OVERRIDE_5, OVERRIDE_7_5, OVERRIDE_10, OVERRIDE_12_5, OVERRIDE_15, OVERRIDE_20; } public static enum EnumModGeneric { diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory556mm.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory556mm.java index 4aafb28ea..d59d23a9e 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory556mm.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory556mm.java @@ -111,7 +111,7 @@ public class XFactory556mm { .addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL)); case CYCLE: return new BusAnimation() .addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 20).addPos(0, 0, -4.5, 40).addPos(0, 0, 0, 40)) - .addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, ItemGunBaseNT.getIsAiming(stack) ? -0.5 : -0.75, 25, IType.SIN_DOWN).addPos(0, 0, 0, 75, IType.SIN_FULL)); + .addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, (ItemGunBaseNT.getIsAiming(stack) || !WeaponModManager.hasUpgrade(stack, 0, WeaponModManager.ID_NO_STOCK)) ? -0.25 : -0.75, 25, IType.SIN_DOWN).addPos(0, 0, 0, 75, IType.SIN_FULL)); case CYCLE_DRY: return new BusAnimation() .addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(0, 0, -0.3125, 100).hold(25).addPos(0, 0, -2.75, 130).hold(50).addPos(0, 0, -2.4375, 50).addPos(0, 0, 0, 85)) .addBus("PLUG", new BusAnimationSequence().addPos(0, 0, 0, 250).hold(125).addPos(0, 0, -2.4375, 130).hold(100).addPos(0, 0, 0, 85)) diff --git a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory9mm.java b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory9mm.java index 0cd151888..e8749552f 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory9mm.java +++ b/src/main/java/com/hbm/items/weapon/sedna/factory/XFactory9mm.java @@ -15,6 +15,7 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.GunState; import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext; import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; +import com.hbm.items.weapon.sedna.mags.IMagazine; import com.hbm.items.weapon.sedna.mags.MagazineFullReload; import com.hbm.items.weapon.sedna.mods.WeaponModManager; import com.hbm.main.MainRegistry; @@ -25,7 +26,10 @@ import com.hbm.render.anim.BusAnimation; import com.hbm.render.anim.BusAnimationSequence; import com.hbm.render.anim.BusAnimationKeyframe.IType; import com.hbm.render.anim.HbmAnimations.AnimType; +import com.hbm.util.EntityDamageUtil; +import com.hbm.util.DamageResistanceHandler.DamageClass; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; public class XFactory9mm { @@ -64,7 +68,7 @@ public class XFactory9mm { .dmg(25F).delay(4).dry(10).spread(0.005F).reload(53).jam(44).sound("hbm:weapon.fire.pistol", 1.0F, 1.0F) .mag(new MagazineFullReload(0, 17).addConfigs(p9_sp, p9_fmj, p9_jhp, p9_ap)) .offset(1, -0.0625 * 2.5, -0.25D) - .setupStandardFire().recoil(LAMBDA_RECOIL_LAG)) + .setupStandardFire().fire(LAMBDA_FIRE_LAG).recoil(LAMBDA_RECOIL_LAG)) .setupStandardConfiguration() .anim(LAMBDA_LAG_ANIMS).orchestra(Orchestras.ORCHESTRA_LAG) ).setUnlocalizedName("gun_lag"); @@ -133,6 +137,27 @@ public class XFactory9mm { GunStateDecider.deciderAutoRefire(stack, ctx, lastState, 0, index, () -> { return ItemGunBaseNT.getSecondary(stack, index) && ItemGunBaseNT.getMode(stack, ctx.configIndex) == 0; }); }; + public static BiConsumer LAMBDA_FIRE_LAG = (stack, ctx) -> { + AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex); + int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex); + EntityPlayer player = ctx.getPlayer(); + if(player != null && type == AnimType.INSPECT && timer > 20 && timer < 60) { + int index = ctx.configIndex; + Receiver primary = ctx.config.getReceivers(stack)[0]; + IMagazine mag = primary.getMagazine(stack); + BulletConfig config = (BulletConfig) mag.getType(stack, ctx.inventory); + player.addStat(MainRegistry.statBullets, 1); + mag.useUpAmmo(stack, ctx.inventory, 1); + ItemGunBaseNT.setWear(stack, index, Math.min(ItemGunBaseNT.getWear(stack, index) + config.wear, ctx.config.getDurability(stack))); + player.worldObj.playSoundEffect(player.posX, player.posY, player.posZ, primary.getFireSound(stack), primary.getFireVolume(stack), primary.getFirePitch(stack)); + ItemGunBaseNT.setState(stack, index, GunState.COOLDOWN); + ItemGunBaseNT.setTimer(stack, index, primary.getDelayAfterFire(stack)); + EntityDamageUtil.attackEntityFromNT(player, BulletConfig.getDamage(player, player, DamageClass.PHYSICAL), 1_000F, true, false, 1D, 5F, 0F); + } else { + Lego.doStandardFire(stack, ctx, AnimType.CYCLE, true); + } + }; + public static BiConsumer LAMBDA_SMOKE = (stack, ctx) -> { Lego.handleStandardSmoke(ctx.entity, stack, 2000, 0.05D, 1.1D, ctx.configIndex); }; diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java index c2fb9d39b..359936bd2 100644 --- a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModManager.java @@ -58,6 +58,14 @@ public class WeaponModManager { new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.DAMAGE.ordinal())).addDefault(TEST_DAMAGE); new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.MULTI.ordinal())).addDefault(TEST_MULTI); + new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_2_5.ordinal())).addDefault(new WeaponModOverride(3, 2.5F, "OVERRIDE")); + new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_5.ordinal())).addDefault(new WeaponModOverride(4, 5F, "OVERRIDE")); + new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_7_5.ordinal())).addDefault(new WeaponModOverride(5, 7.5F, "OVERRIDE")); + new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_10.ordinal())).addDefault(new WeaponModOverride(6, 10F, "OVERRIDE")); + new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_12_5.ordinal())).addDefault(new WeaponModOverride(7, 12_5F, "OVERRIDE")); + new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_15.ordinal())).addDefault(new WeaponModOverride(8, 15F, "OVERRIDE")); + new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_test, 1, EnumModTest.OVERRIDE_20.ordinal())).addDefault(new WeaponModOverride(9, 20F, "OVERRIDE")); + new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.IRON_DAMAGE.ordinal())).addMod(ModItems.gun_pepperbox, new WeaponModGenericDamage(100)); new WeaponModDefinition(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.IRON_DURA.ordinal())).addMod(ModItems.gun_pepperbox, new WeaponModGenericDurability(101)); @@ -151,7 +159,7 @@ public class WeaponModManager { .addMod(ModItems.gun_greasegun, new WeaponModCaliber(311, 24, 3F, p45)) .addMod(ModItems.gun_uzi, new WeaponModCaliber(312, 24, 3F, p45)) .addMod(ModItems.gun_uzi_akimbo, new WeaponModCaliber(313, 24, 3F, p45)) - .addMod(ModItems.gun_lag, new WeaponModCaliber(314, 24, 25F, p45)); + .addMod(ModItems.gun_lag, new WeaponModCaliber(314, 15, 25F, p45)); new WeaponModDefinition(EnumModCaliber.P22) .addMod(ModItems.gun_henry, new WeaponModCaliber(320, 28, 10F, p22)) .addMod(ModItems.gun_uzi, new WeaponModCaliber(321, 40, 3F, p22)) @@ -260,6 +268,7 @@ public class WeaponModManager { WeaponModDefinition def = stackToMod.get(new ComparableStack(mod)); if(def == null) return null; IWeaponMod newMod = def.modByGun.get(new ComparableStack(gun).makeSingular()); //shift clicking causes the gun to have stack size 0! + if(newMod == null) newMod = def.modByGun.get(null); return newMod; } diff --git a/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModOverride.java b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModOverride.java new file mode 100644 index 000000000..54f68163b --- /dev/null +++ b/src/main/java/com/hbm/items/weapon/sedna/mods/WeaponModOverride.java @@ -0,0 +1,22 @@ +package com.hbm.items.weapon.sedna.mods; + +import com.hbm.items.weapon.sedna.Receiver; + +import net.minecraft.item.ItemStack; + +public class WeaponModOverride extends WeaponModBase { + + protected final float baseDamage; + + public WeaponModOverride(int id, float baseDamage, String... slots) { + super(id, slots); + this.baseDamage = baseDamage; + this.setPriority(PRIORITY_SET); + } + + @Override + public T eval(T base, ItemStack gun, String key, Object parent) { + if(key == Receiver.F_BASEDAMAGE) return cast(baseDamage, base); + return base; + } +} diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index d939975a4..c7dd243c2 100644 --- a/src/main/java/com/hbm/lib/RefStrings.java +++ b/src/main/java/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (5257)"; + public static final String VERSION = "1.0.27 BETA (5278)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index 6928ba30b..b726eff94 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -1760,7 +1760,7 @@ public class ClientProxy extends ServerProxy { .addPos(90, 0, 1, 800) .addPos(0, 0, 1, 50)); - HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation); + HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, null); } /* crucible swing */ @@ -1782,7 +1782,7 @@ public class ClientProxy extends ServerProxy { Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:weapon.cSwing"), 0.8F + player.getRNG().nextFloat() * 0.2F)); - HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation); + HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, null); } } @@ -1806,7 +1806,7 @@ public class ClientProxy extends ServerProxy { .addPos(0, 0, 0, retire)); - HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation); + HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, null); } else { @@ -1827,7 +1827,7 @@ public class ClientProxy extends ServerProxy { .addPos(2, 0, 2, sideways) .addPos(0, 0, 0, retire)); - HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation); + HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, null); } } @@ -1839,7 +1839,7 @@ public class ClientProxy extends ServerProxy { BusAnimation anim = item.getAnimation(data, stack); if(anim != null) { - HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), anim); + HbmAnimations.hotbar[player.inventory.currentItem][0] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), anim, null); } } } diff --git a/src/main/java/com/hbm/packet/toclient/GunAnimationPacket.java b/src/main/java/com/hbm/packet/toclient/GunAnimationPacket.java index 922d19200..f72fddb63 100644 --- a/src/main/java/com/hbm/packet/toclient/GunAnimationPacket.java +++ b/src/main/java/com/hbm/packet/toclient/GunAnimationPacket.java @@ -105,7 +105,7 @@ public class GunAnimationPacket implements IMessage { if(animation != null) { boolean isReloadAnimation = type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE || type == AnimType.RELOAD_EMPTY; - HbmAnimations.hotbar[slot][0] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, isReloadAnimation && base.mainConfig.reloadAnimationsSequential); + HbmAnimations.hotbar[slot][0] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, type, isReloadAnimation && base.mainConfig.reloadAnimationsSequential); } } catch(Exception x) { } @@ -143,7 +143,7 @@ public class GunAnimationPacket implements IMessage { Minecraft.getMinecraft().entityRenderer.itemRenderer.resetEquippedProgress(); Minecraft.getMinecraft().entityRenderer.itemRenderer.itemToRender = stack; boolean isReloadAnimation = type == AnimType.RELOAD || type == AnimType.RELOAD_CYCLE || type == AnimType.RELOAD_EMPTY; - HbmAnimations.hotbar[slot][gunIndex] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, isReloadAnimation && config.getReloadAnimSequential(stack)); + HbmAnimations.hotbar[slot][gunIndex] = new Animation(stack.getItem().getUnlocalizedName(), System.currentTimeMillis(), animation, type, isReloadAnimation && config.getReloadAnimSequential(stack)); } } } diff --git a/src/main/java/com/hbm/render/anim/HbmAnimations.java b/src/main/java/com/hbm/render/anim/HbmAnimations.java index e5cc8becd..218042e44 100644 --- a/src/main/java/com/hbm/render/anim/HbmAnimations.java +++ b/src/main/java/com/hbm/render/anim/HbmAnimations.java @@ -47,18 +47,22 @@ public class HbmAnimations { public BusAnimation animation; // If set, don't cancel this animation when the timer ends, instead wait for the next to start public boolean holdLastFrame = false; + // so we know what type of animation we're playing, only used rarely + public AnimType type; - public Animation(String key, long startMillis, BusAnimation animation) { + public Animation(String key, long startMillis, BusAnimation animation, AnimType type) { this.key = key; this.startMillis = startMillis; this.animation = animation; + this.type = type; } - public Animation(String key, long startMillis, BusAnimation animation, boolean holdLastFrame) { + public Animation(String key, long startMillis, BusAnimation animation, AnimType type, boolean holdLastFrame) { this.key = key; this.startMillis = startMillis; this.animation = animation; this.holdLastFrame = holdLastFrame; + this.type = type; } } diff --git a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java index 634f50e4a..e365bf670 100644 --- a/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java +++ b/src/main/java/com/hbm/render/item/weapon/sedna/ItemRenderWeaponBase.java @@ -84,6 +84,16 @@ public abstract class ItemRenderWeaponBase implements IItemRenderer { GL11.glPushMatrix(); if(mc.gameSettings.thirdPersonView == 0 && !mc.renderViewEntity.isPlayerSleeping() && !mc.gameSettings.hideGUI && !mc.playerController.enableEverythingIsScrewedUpMode()) { + /*ItemRenderer ir = mc.entityRenderer.itemRenderer; + float equip = ir.prevEquippedProgress + (ir.equippedProgress- ir.prevEquippedProgress) * interp; + Animation current = HbmAnimations.getRelevantAnim(); + // flicker prevention, if equip is in progress, only render if an animation is playing + if(!(equip < 0.25 && ir.prevEquippedProgress < ir.equippedProgress && (current == null || current.type != AnimType.EQUIP))) { + entityRenderer.enableLightmap(interp); + this.setupTransformsAndRender(stack); + entityRenderer.disableLightmap(interp); + }*/ + entityRenderer.enableLightmap(interp); this.setupTransformsAndRender(stack); entityRenderer.disableLightmap(interp); diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java index 88b69a4c1..84db4a9ae 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java @@ -1,5 +1,6 @@ package com.hbm.tileentity.machine.storage; +import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority; import api.hbm.fluidmk2.IFluidStandardTransceiverMK2; import com.hbm.blocks.ModBlocks; @@ -91,7 +92,7 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom tank.unloadTank(4, 5, slots); for(DirPos pos : getConPos()) { - if(mode == 0 || mode == 2) this.trySubscribe(tank.getTankType(), worldObj, pos); + if(mode == 0 || mode == 1) this.trySubscribe(tank.getTankType(), worldObj, pos); if(mode == 1 || mode == 2) this.tryProvide(tank, worldObj, pos); } @@ -234,6 +235,11 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom return new FluidTank[] { tank }; } + @Override + public ConnectionPriority getFluidPriority() { + return mode == 1 ? ConnectionPriority.LOW : ConnectionPriority.NORMAL; + } + @Override public int[] getFluidIDToCopy() { return new int[] {tank.getTankType().getID()}; diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java index 891343625..af722a0d5 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java @@ -1,5 +1,6 @@ package com.hbm.tileentity.machine.storage; +import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority; import api.hbm.fluid.IFluidStandardTransceiver; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; @@ -48,7 +49,7 @@ import java.util.List; import java.util.Random; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")}) -public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable{ +public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable { public FluidTank tank; public short mode = 0; @@ -107,7 +108,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements } for(DirPos pos : getConPos()) { - if(mode == 0 || mode == 2) this.trySubscribe(tank.getTankType(), worldObj, pos); + if(mode == 0 || mode == 1) this.trySubscribe(tank.getTankType(), worldObj, pos); if(mode == 1 || mode == 2) this.tryProvide(tank, worldObj, pos); } @@ -331,12 +332,8 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements @Override public long getDemand(FluidType type, int pressure) { - - if(this.mode == 2 || this.mode == 3 || this.sendingBrake) - return 0; - + if(this.mode == 2 || this.mode == 3) return 0; if(tank.getPressure() != pressure) return 0; - return type == tank.getTankType() ? tank.getMaxFill() - tank.getFill() : 0; } @@ -377,6 +374,11 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements return (mode == 0 || mode == 1) ? new FluidTank[] {tank} : new FluidTank[0]; } + @Override + public ConnectionPriority getFluidPriority() { + return mode == 1 ? ConnectionPriority.LOW : ConnectionPriority.NORMAL; + } + @Override public int[] getFluidIDToCopy() { return new int[] {tank.getTankType().getID()}; diff --git a/src/main/resources/META-INF/HBM_at.cfg b/src/main/resources/META-INF/HBM_at.cfg index 60e1b0364..28454115f 100644 --- a/src/main/resources/META-INF/HBM_at.cfg +++ b/src/main/resources/META-INF/HBM_at.cfg @@ -40,6 +40,8 @@ public net.minecraft.nbt.NBTTagList * # Mo # ItemRenderer public net.minecraft.client.renderer.ItemRenderer field_78453_b # itemToRender +public net.minecraft.client.renderer.ItemRenderer field_78454_c # equippedProgress +public net.minecraft.client.renderer.ItemRenderer field_78451_d # prevEquippedProgress # AbstractResourcePack public net.minecraft.client.resources.AbstractResourcePack field_110597_b # resourcePackFile diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 577bbd545..401f3fcaa 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -3736,6 +3736,16 @@ item.weapon_mod_special.slowdown.name=Rädergetriebe item.weapon_mod_special.speedloader.name=Schnelllader item.weapon_mod_special.speedup.name=Elektrischer Servomotor item.weapon_mod_special.stack_mag.name=Zweistapel-Magazin +item.weapon_mod_test.damage.name=DAMAGE UPGRADE +item.weapon_mod_test.firerate.name=FIRE RATE UPGRADE +item.weapon_mod_test.multi.name=MULTI SHOT UPGRADE +item.weapon_mod_test.override_2_5.name=DAMAGE OVERRIDE (2.5) +item.weapon_mod_test.override_5.name=DAMAGE OVERRIDE (5) +item.weapon_mod_test.override_7_5.name=DAMAGE OVERRIDE (7.5) +item.weapon_mod_test.override_10.name=DAMAGE OVERRIDE (10) +item.weapon_mod_test.override_12_5.name=DAMAGE OVERRIDE (12.5) +item.weapon_mod_test.override_15.name=DAMAGE OVERRIDE (15) +item.weapon_mod_test.override_20.name=DAMAGE OVERRIDE (20) item.weapon_pipe_lead.name=Die Handüberbrückung item.weapon_pipe_rusty.name=Der Einstellungskorrigierer item.weapon_saw.name=Ärztlich autorisierter Mord diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index b3bf02dd6..ad23fa440 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -4762,6 +4762,16 @@ item.weapon_mod_special.slowdown.name=Gear Train item.weapon_mod_special.speedloader.name=Speedloader item.weapon_mod_special.speedup.name=Auxiliary Electric Engine item.weapon_mod_special.stack_mag.name=Double-Stacked Magazine +item.weapon_mod_test.damage.name=DAMAGE UPGRADE +item.weapon_mod_test.firerate.name=FIRE RATE UPGRADE +item.weapon_mod_test.multi.name=MULTI SHOT UPGRADE +item.weapon_mod_test.override_2_5.name=DAMAGE OVERRIDE (2.5) +item.weapon_mod_test.override_5.name=DAMAGE OVERRIDE (5) +item.weapon_mod_test.override_7_5.name=DAMAGE OVERRIDE (7.5) +item.weapon_mod_test.override_10.name=DAMAGE OVERRIDE (10) +item.weapon_mod_test.override_12_5.name=DAMAGE OVERRIDE (12.5) +item.weapon_mod_test.override_15.name=DAMAGE OVERRIDE (15) +item.weapon_mod_test.override_20.name=DAMAGE OVERRIDE (20) item.weapon_pipe_lead.name=The Manual Override item.weapon_pipe_rusty.name=The Attitude Adjuster item.weapon_saw.name=Doctor Assisted Homicide diff --git a/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_10.png b/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_10.png new file mode 100644 index 0000000000000000000000000000000000000000..9866eb14f183f3775b4b4ff3027cd00122c95ad4 GIT binary patch literal 267 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#VfZ;Vn)8is{iL<6HMdmEO0K=< znCp~rZo1d?;;cJtf!!YK+Rp7)SvQY4jAO!i>osL5ddwUe9TNYSiLY(<`^2*8eKpWG N44$rjF6*2UngEn*Xn+6! literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_12_5.png b/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_12_5.png new file mode 100644 index 0000000000000000000000000000000000000000..9866eb14f183f3775b4b4ff3027cd00122c95ad4 GIT binary patch literal 267 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#VfZ;Vn)8is{iL<6HMdmEO0K=< znCp~rZo1d?;;cJtf!!YK+Rp7)SvQY4jAO!i>osL5ddwUe9TNYSiLY(<`^2*8eKpWG N44$rjF6*2UngEn*Xn+6! literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_15.png b/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_15.png new file mode 100644 index 0000000000000000000000000000000000000000..9866eb14f183f3775b4b4ff3027cd00122c95ad4 GIT binary patch literal 267 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#VfZ;Vn)8is{iL<6HMdmEO0K=< znCp~rZo1d?;;cJtf!!YK+Rp7)SvQY4jAO!i>osL5ddwUe9TNYSiLY(<`^2*8eKpWG N44$rjF6*2UngEn*Xn+6! literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_20.png b/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_20.png new file mode 100644 index 0000000000000000000000000000000000000000..9866eb14f183f3775b4b4ff3027cd00122c95ad4 GIT binary patch literal 267 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#VfZ;Vn)8is{iL<6HMdmEO0K=< znCp~rZo1d?;;cJtf!!YK+Rp7)SvQY4jAO!i>osL5ddwUe9TNYSiLY(<`^2*8eKpWG N44$rjF6*2UngEn*Xn+6! literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_2_5.png b/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_2_5.png new file mode 100644 index 0000000000000000000000000000000000000000..9866eb14f183f3775b4b4ff3027cd00122c95ad4 GIT binary patch literal 267 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#VfZ;Vn)8is{iL<6HMdmEO0K=< znCp~rZo1d?;;cJtf!!YK+Rp7)SvQY4jAO!i>osL5ddwUe9TNYSiLY(<`^2*8eKpWG N44$rjF6*2UngEn*Xn+6! literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_5.png b/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_5.png new file mode 100644 index 0000000000000000000000000000000000000000..9866eb14f183f3775b4b4ff3027cd00122c95ad4 GIT binary patch literal 267 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#VfZ;Vn)8is{iL<6HMdmEO0K=< znCp~rZo1d?;;cJtf!!YK+Rp7)SvQY4jAO!i>osL5ddwUe9TNYSiLY(<`^2*8eKpWG N44$rjF6*2UngEn*Xn+6! literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_7_5.png b/src/main/resources/assets/hbm/textures/items/weapon_mod_test.override_7_5.png new file mode 100644 index 0000000000000000000000000000000000000000..9866eb14f183f3775b4b4ff3027cd00122c95ad4 GIT binary patch literal 267 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#VfZ;Vn)8is{iL<6HMdmEO0K=< znCp~rZo1d?;;cJtf!!YK+Rp7)SvQY4jAO!i>osL5ddwUe9TNYSiLY(<`^2*8eKpWG N44$rjF6*2UngEn*Xn+6! literal 0 HcmV?d00001 From 6db42e6d4b2d2cb963a8231469776955f55dc41c Mon Sep 17 00:00:00 2001 From: George Paton Date: Mon, 24 Mar 2025 11:49:53 +1100 Subject: [PATCH 05/12] fix fluid valves not deactivating (was clearing power net rather than fluid net connections) --- .../tileentity/network/TileEntityFluidValve.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityFluidValve.java b/src/main/java/com/hbm/tileentity/network/TileEntityFluidValve.java index 823dfdb32..a54caa173 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityFluidValve.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityFluidValve.java @@ -1,26 +1,27 @@ package com.hbm.tileentity.network; -import api.hbm.energymk2.Nodespace; +import com.hbm.uninos.UniNodespace; + import net.minecraft.block.Block; import net.minecraft.world.World; public class TileEntityFluidValve extends TileEntityPipeBaseNT { - + @Override public boolean shouldCreateNode() { return this.getBlockMetadata() == 1; } public void updateState() { - + this.blockMetadata = -1; // delete cache - + if(this.getBlockMetadata() == 0 && this.node != null) { - Nodespace.destroyNode(worldObj, xCoord, yCoord, zCoord); + UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, this.getType().getNetworkProvider()); this.node = null; } } - + @Override public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z) { return oldBlock != newBlock; From f00f2c7ca381981889195aee686835ffa8ebfc00 Mon Sep 17 00:00:00 2001 From: George Paton Date: Mon, 24 Mar 2025 12:25:06 +1100 Subject: [PATCH 06/12] fix compat shim incorrectly subscribing receiving tanks --- .../java/api/hbm/fluid/IFluidStandardReceiver.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/api/hbm/fluid/IFluidStandardReceiver.java b/src/main/java/api/hbm/fluid/IFluidStandardReceiver.java index 196d8a490..364d3353a 100644 --- a/src/main/java/api/hbm/fluid/IFluidStandardReceiver.java +++ b/src/main/java/api/hbm/fluid/IFluidStandardReceiver.java @@ -11,22 +11,22 @@ import net.minecraftforge.common.util.ForgeDirection; @Deprecated public interface IFluidStandardReceiver extends IFluidStandardReceiverMK2 { - + public default void subscribeToAllAround(FluidType type, TileEntity tile) { subscribeToAllAround(type, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord); } - + public default void subscribeToAllAround(FluidType type, World world, int x, int y, int z) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - trySubscribe(type, world, x, y, z, dir); + trySubscribe(type, world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir); } } - + public default void tryUnsubscribe(FluidType type, World world, int x, int y, int z) { GenNode node = UniNodespace.getNode(world, x, y, z, type.getNetworkProvider()); if(node != null && node.net != null) node.net.removeReceiver(this); } - + public default void unsubscribeToAllAround(FluidType type, TileEntity tile) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { tryUnsubscribe(type, tile.getWorldObj(), tile.xCoord + dir.offsetX, tile.yCoord + dir.offsetY, tile.zCoord + dir.offsetZ); From 62485c6854726adf331e63f46e03ad318c688970 Mon Sep 17 00:00:00 2001 From: George Paton Date: Mon, 24 Mar 2025 15:05:56 +1100 Subject: [PATCH 07/12] fluid tank handling updated to match energy storage blocks, allowing for more consistent tank leveling behaviour --- .../fluidmk2/IFluidBufferTransceiverMK2.java | 5 + .../hbm/fluidmk2/IFluidStandardSenderMK2.java | 24 +-- .../machine/storage/TileEntityBarrel.java | 65 +++++++- .../storage/TileEntityMachineFluidTank.java | 154 ++++++++++++------ 4 files changed, 179 insertions(+), 69 deletions(-) create mode 100644 src/main/java/api/hbm/fluidmk2/IFluidBufferTransceiverMK2.java diff --git a/src/main/java/api/hbm/fluidmk2/IFluidBufferTransceiverMK2.java b/src/main/java/api/hbm/fluidmk2/IFluidBufferTransceiverMK2.java new file mode 100644 index 000000000..7d0ba5d53 --- /dev/null +++ b/src/main/java/api/hbm/fluidmk2/IFluidBufferTransceiverMK2.java @@ -0,0 +1,5 @@ +package api.hbm.fluidmk2; + +public interface IFluidBufferTransceiverMK2 extends IFluidStandardTransceiverMK2 { + +} diff --git a/src/main/java/api/hbm/fluidmk2/IFluidStandardSenderMK2.java b/src/main/java/api/hbm/fluidmk2/IFluidStandardSenderMK2.java index 2a1a3ce43..5cbbf4e58 100644 --- a/src/main/java/api/hbm/fluidmk2/IFluidStandardSenderMK2.java +++ b/src/main/java/api/hbm/fluidmk2/IFluidStandardSenderMK2.java @@ -24,29 +24,29 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 { public default void tryProvide(FluidTank tank, World world, DirPos pos) { tryProvide(tank.getTankType(), tank.getPressure(), world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } public default void tryProvide(FluidType type, World world, DirPos pos) { tryProvide(type, 0, world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } public default void tryProvide(FluidType type, int pressure, World world, DirPos pos) { tryProvide(type, pressure, world, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); } - + public default void tryProvide(FluidTank tank, World world, int x, int y, int z, ForgeDirection dir) { tryProvide(tank.getTankType(), tank.getPressure(), world, x, y, z, dir); } public default void tryProvide(FluidType type, World world, int x, int y, int z, ForgeDirection dir) { tryProvide(type, 0, world, x, y, z, dir); } - + public default void tryProvide(FluidType type, int pressure, World world, int x, int y, int z, ForgeDirection dir) { TileEntity te = Compat.getTileStandard(world, x, y, z); boolean red = false; - + if(te instanceof IFluidConnectorMK2) { IFluidConnectorMK2 con = (IFluidConnectorMK2) te; if(con.canConnect(type, dir.getOpposite())) { - + GenNode node = UniNodespace.getNode(world, x, y, z, type.getNetworkProvider()); - + if(node != null && node.net != null) { node.net.addProvider(this); red = true; } } } - - if(te instanceof IFluidReceiverMK2 && te != this) { + + if(te != this && te instanceof IFluidReceiverMK2 && !(te instanceof IFluidBufferTransceiverMK2)) { IFluidReceiverMK2 rec = (IFluidReceiverMK2) te; if(rec.canConnect(type, dir.getOpposite())) { long provides = Math.min(this.getFluidAvailable(type, pressure), this.getProviderSpeed(type, pressure)); @@ -56,7 +56,7 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 { this.useUpFluid(type, pressure, toTransfer); } } - + if(particleDebug) { NBTTagCompound data = new NBTTagCompound(); data.setString("type", "network"); @@ -71,9 +71,9 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 { PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, posX, posY, posZ), new TargetPoint(world.provider.dimensionId, posX, posY, posZ, 25)); } } - + public FluidTank[] getSendingTanks(); - + @Override public default long getFluidAvailable(FluidType type, int pressure) { long amount = 0; @@ -112,14 +112,14 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 { public default int[] getProvidingPressureRange(FluidType type) { int lowest = HIGHEST_VALID_PRESSURE; int highest = 0; - + for(FluidTank tank : getSendingTanks()) { if(tank.getTankType() == type) { if(tank.getPressure() < lowest) lowest = tank.getPressure(); if(tank.getPressure() > highest) highest = tank.getPressure(); } } - + return lowest <= highest ? new int[] {lowest, highest} : DEFAULT_PRESSURE_RANGE; } diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java index 84db4a9ae..101843c50 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java @@ -1,7 +1,10 @@ package com.hbm.tileentity.machine.storage; import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority; -import api.hbm.fluidmk2.IFluidStandardTransceiverMK2; +import api.hbm.fluidmk2.FluidNode; +import api.hbm.fluidmk2.IFluidBufferTransceiverMK2; + +import java.util.HashSet; import com.hbm.blocks.ModBlocks; import com.hbm.handler.CompatHandler; @@ -20,6 +23,8 @@ import com.hbm.tileentity.IFluidCopiable; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IPersistentNBT; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.uninos.UniNodespace; +import com.hbm.util.fauxpointtwelve.BlockPos; import com.hbm.util.fauxpointtwelve.DirPos; import cpw.mods.fml.common.Optional; import cpw.mods.fml.relauncher.Side; @@ -37,9 +42,13 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.world.EnumSkyBlock; 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 TileEntityBarrel extends TileEntityMachineBase implements SimpleComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent, IFluidCopiable { +public class TileEntityBarrel extends TileEntityMachineBase implements SimpleComponent, IFluidBufferTransceiverMK2, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent, IFluidCopiable { + + protected FluidNode node; + protected FluidType lastType; public FluidTank tank; public short mode = 0; @@ -90,10 +99,28 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom tank.setType(0, 1, slots); tank.loadTank(2, 3, slots); tank.unloadTank(4, 5, slots); - - for(DirPos pos : getConPos()) { - if(mode == 0 || mode == 1) this.trySubscribe(tank.getTankType(), worldObj, pos); - if(mode == 1 || mode == 2) this.tryProvide(tank, worldObj, pos); + + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { + + this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); + + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { + this.node = this.createNode(tank.getTankType()); + UniNodespace.createNode(worldObj, this.node); + lastType = tank.getTankType(); + } + } + + if(mode == 2 || mode == 1) { + this.tryProvide(tank, worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN); + } else { + if(node != null && node.hasValidNet()) node.net.removeProvider(this); + } + + if(mode == 0 || mode == 1) { + if(node != null && node.hasValidNet()) node.net.addReceiver(this); + } else { + if(node != null && node.hasValidNet()) node.net.removeReceiver(this); } if(tank.getFill() > 0) { @@ -104,6 +131,30 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom } } + protected FluidNode createNode(FluidType type) { + DirPos[] conPos = getConPos(); + + HashSet posSet = new HashSet<>(); + posSet.add(new BlockPos(this)); + for(DirPos pos : conPos) { + ForgeDirection dir = pos.getDir(); + posSet.add(new BlockPos(pos.getX() - dir.offsetX, pos.getY() - dir.offsetY, pos.getZ() - dir.offsetZ)); + } + + return new FluidNode(type.getNetworkProvider(), posSet.toArray(new BlockPos[posSet.size()])).setConnections(conPos); + } + + @Override + public void invalidate() { + super.invalidate(); + + if(!worldObj.isRemote) { + if(this.node != null) { + UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); + } + } + } + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -220,6 +271,8 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom tank.writeToNBT(nbt, "tank"); } + @Override public boolean canConnect(FluidType fluid, ForgeDirection dir) { return true; } + @Override public FluidTank[] getSendingTanks() { return (mode == 1 || mode == 2) ? new FluidTank[] {tank} : new FluidTank[0]; diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java index af722a0d5..a4272cfc1 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java @@ -1,7 +1,9 @@ package com.hbm.tileentity.machine.storage; import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority; -import api.hbm.fluid.IFluidStandardTransceiver; +import api.hbm.fluidmk2.FluidNode; +import api.hbm.fluidmk2.IFluidBufferTransceiverMK2; + import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.explosion.vanillant.ExplosionVNT; @@ -22,8 +24,10 @@ import com.hbm.inventory.fluid.tank.FluidTank; import com.hbm.lib.Library; import com.hbm.packet.PacketDispatcher; import com.hbm.tileentity.*; +import com.hbm.uninos.UniNodespace; import com.hbm.packet.toclient.AuxParticlePacketNT; import com.hbm.util.ParticleUtil; +import com.hbm.util.fauxpointtwelve.BlockPos; import com.hbm.util.fauxpointtwelve.DirPos; import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; @@ -45,23 +49,26 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Random; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")}) -public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidStandardTransceiver, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable { - +public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidBufferTransceiverMK2, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable { + + protected FluidNode node; + protected FluidType lastType; + public FluidTank tank; public short mode = 0; public static final short modes = 4; public boolean hasExploded = false; - protected boolean sendingBrake = false; public boolean onFire = false; public byte lastRedstone = 0; public Explosion lastExplosion = null; - + public int age = 0; - + public TileEntityMachineFluidTank() { super(6); tank = new FluidTank(Fluids.NONE, 256000); @@ -82,7 +89,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements public void updateEntity() { if(!worldObj.isRemote) { - + //meta below 12 means that it's an old multiblock configuration if(this.getBlockMetadata() < 12) { //get old direction @@ -98,24 +105,43 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements worldObj.getTileEntity(xCoord, yCoord, zCoord).readFromNBT(data); return; } - + if(!hasExploded) { age++; - + if(age >= 20) { age = 0; this.markChanged(); } - - for(DirPos pos : getConPos()) { - if(mode == 0 || mode == 1) this.trySubscribe(tank.getTankType(), worldObj, pos); - if(mode == 1 || mode == 2) this.tryProvide(tank, worldObj, pos); + + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { + + this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); + + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { + this.node = this.createNode(tank.getTankType()); + UniNodespace.createNode(worldObj, this.node); + lastType = tank.getTankType(); + } } - + + if(mode == 2 || mode == 1) { + this.tryProvide(tank, worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN); + } else { + if(node != null && node.hasValidNet()) node.net.removeProvider(this); + } + + if(mode == 0 || mode == 1) { + if(node != null && node.hasValidNet()) node.net.addReceiver(this); + } else { + if(node != null && node.hasValidNet()) node.net.removeReceiver(this); + } + tank.loadTank(2, 3, slots); tank.setType(0, 1, slots); - } else { - for(DirPos pos : getConPos()) this.tryUnsubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ()); + } else if(this.node != null) { + UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); + this.node = null; } byte comp = this.getComparatorPower(); //comparator shit @@ -131,11 +157,11 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements this.explode(); this.tank.setFill(0); } - + if(tank.getTankType().hasTrait(FT_Corrosive.class) && tank.getTankType().getTrait(FT_Corrosive.class).isHighlyCorrosive()) { this.explode(); } - + if(this.hasExploded) { int leaking = 0; @@ -146,26 +172,50 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements } else { leaking = Math.min(tank.getFill(), tank.getMaxFill() / 10000); } - + updateLeak(leaking); } } - + tank.unloadTank(4, 5, slots); - + this.networkPackNT(150); } - + ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - 10); ForgeDirection rot = dir.getRotation(ForgeDirection.UP); List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 2.875, zCoord + 1).offset(dir.offsetX * 0.5 - rot.offsetX * 2.25, 0, dir.offsetZ * 0.5 - rot.offsetZ * 2.25)); - + for(EntityPlayer player : players) { HbmPlayerProps props = HbmPlayerProps.getData(player); props.isOnLadder = true; } } + protected FluidNode createNode(FluidType type) { + DirPos[] conPos = getConPos(); + + HashSet posSet = new HashSet<>(); + posSet.add(new BlockPos(this)); + for(DirPos pos : conPos) { + ForgeDirection dir = pos.getDir(); + posSet.add(new BlockPos(pos.getX() - dir.offsetX, pos.getY() - dir.offsetY, pos.getZ() - dir.offsetZ)); + } + + return new FluidNode(type.getNetworkProvider(), posSet.toArray(new BlockPos[posSet.size()])).setConnections(conPos); + } + + @Override + public void invalidate() { + super.invalidate(); + + if(!worldObj.isRemote) { + if(this.node != null) { + UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); + } + } + } + @Override public void serialize(ByteBuf buf) { super.serialize(buf); @@ -173,7 +223,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements buf.writeBoolean(hasExploded); tank.serialize(buf); } - + @Override public void deserialize(ByteBuf buf) { super.deserialize(buf); @@ -181,39 +231,39 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements hasExploded = buf.readBoolean(); tank.deserialize(buf); } - + /** called when the tank breaks due to hazardous materials or external force, can be used to quickly void part of the tank or spawn a mushroom cloud */ public void explode() { this.hasExploded = true; this.onFire = tank.getTankType().hasTrait(FT_Flammable.class); this.markChanged(); } - + /** called every tick post explosion, used for leaking fluid and spawning particles */ public void updateLeak(int amount) { if(!hasExploded) return; if(amount <= 0) return; - + this.tank.getTankType().onFluidRelease(this, tank, amount); this.tank.setFill(Math.max(0, this.tank.getFill() - amount)); - + FluidType type = tank.getTankType(); - + if(type.hasTrait(FT_Amat.class)) { new ExplosionVNT(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 5F).makeAmat().setBlockAllocator(null).setBlockProcessor(null).explode(); - + } else if(type.hasTrait(FT_Flammable.class) && onFire) { List affected = worldObj.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(xCoord - 1.5, yCoord, zCoord - 1.5, xCoord + 2.5, yCoord + 5, zCoord + 2.5)); for(Entity e : affected) e.setFire(5); Random rand = worldObj.rand; ParticleUtil.spawnGasFlame(worldObj, xCoord + rand.nextDouble(), yCoord + 0.5 + rand.nextDouble(), zCoord + rand.nextDouble(), rand.nextGaussian() * 0.2, 0.1, rand.nextGaussian() * 0.2); - + if(worldObj.getTotalWorldTime() % 5 == 0) { FT_Polluting.pollute(worldObj, xCoord, yCoord, zCoord, tank.getTankType(), FluidReleaseType.BURN, amount * 5); } - + } else if(type.hasTrait(FT_Gaseous.class) || type.hasTrait(FT_Gaseous_ART.class)) { - + if(worldObj.getTotalWorldTime() % 5 == 0) { NBTTagCompound data = new NBTTagCompound(); data.setString("type", "tower"); @@ -233,7 +283,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements @Override public void explode(World world, int x, int y, int z) { - + if(this.hasExploded) return; this.onFire = tank.getTankType().hasTrait(FT_Flammable.class); this.hasExploded = true; @@ -243,7 +293,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements @Override public void tryExtinguish(World world, int x, int y, int z, EnumExtinguishType type) { if(!this.hasExploded || !this.onFire) return; - + if(type == EnumExtinguishType.WATER) { if(tank.getTankType().hasTrait(FT_Liquid.class)) { // extinguishing oil with water is a terrible idea! worldObj.newExplosion(null, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, 5F, true, true); @@ -253,13 +303,13 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements return; } } - + if(type == EnumExtinguishType.FOAM || type == EnumExtinguishType.CO2) { this.onFire = false; this.markChanged(); } } - + protected DirPos[] getConPos() { return new DirPos[] { new DirPos(xCoord + 2, yCoord, zCoord - 1, Library.POS_X), @@ -272,17 +322,17 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements new DirPos(xCoord + 1, yCoord, zCoord - 2, Library.NEG_Z) }; } - + public void handleButtonPacket(int value, int meta) { mode = (short) ((mode + 1) % modes); this.markChanged(); } - + AxisAlignedBB bb = null; - + @Override public AxisAlignedBB getRenderBoundingBox() { - + if(bb == null) { bb = AxisAlignedBB.getBoundingBox( xCoord - 2, @@ -293,30 +343,30 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements zCoord + 3 ); } - + return bb; } - + @Override @SideOnly(Side.CLIENT) public double getMaxRenderDistanceSquared() { return 65536.0D; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); - + mode = nbt.getShort("mode"); tank.readFromNBT(nbt, "tank"); hasExploded = nbt.getBoolean("exploded"); onFire = nbt.getBoolean("onFire"); } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setShort("mode", mode); tank.writeToNBT(nbt, "tank"); nbt.setBoolean("exploded", hasExploded); @@ -362,6 +412,8 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements this.onFire = data.getBoolean("onFire"); } + @Override public boolean canConnect(FluidType fluid, ForgeDirection dir) { return true; } + @Override public FluidTank[] getSendingTanks() { if(this.hasExploded) return new FluidTank[0]; @@ -370,7 +422,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements @Override public FluidTank[] getReceivingTanks() { - if(this.hasExploded || this.sendingBrake) return new FluidTank[0]; + if(this.hasExploded) return new FluidTank[0]; return (mode == 0 || mode == 1) ? new FluidTank[] {tank} : new FluidTank[0]; } @@ -404,14 +456,14 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements public boolean isDamaged() { return this.hasExploded; } - + List repair = new ArrayList<>(); @Override public List getRepairMaterials() { - + if(!repair.isEmpty()) return repair; - + repair.add(new OreDictStack(OreDictManager.STEEL.plate(), 6)); return repair; } From 141e80bfcb1fc201f3313f24c8f25f9a6ffb285a Mon Sep 17 00:00:00 2001 From: George Paton Date: Mon, 24 Mar 2025 16:09:56 +1100 Subject: [PATCH 08/12] batteries and fluid tanks now block propagation if not set to buffer mode (which the player can circumvent by cabling/piping around them, which gives them the choice of behaviour, and is more intuitive) --- .../fluidmk2/IFluidBufferTransceiverMK2.java | 5 - .../hbm/fluidmk2/IFluidStandardSenderMK2.java | 2 +- .../machine/storage/TileEntityBarrel.java | 48 ++++--- .../storage/TileEntityMachineBattery.java | 135 ++++++++++-------- .../storage/TileEntityMachineFluidTank.java | 48 ++++--- 5 files changed, 139 insertions(+), 99 deletions(-) delete mode 100644 src/main/java/api/hbm/fluidmk2/IFluidBufferTransceiverMK2.java diff --git a/src/main/java/api/hbm/fluidmk2/IFluidBufferTransceiverMK2.java b/src/main/java/api/hbm/fluidmk2/IFluidBufferTransceiverMK2.java deleted file mode 100644 index 7d0ba5d53..000000000 --- a/src/main/java/api/hbm/fluidmk2/IFluidBufferTransceiverMK2.java +++ /dev/null @@ -1,5 +0,0 @@ -package api.hbm.fluidmk2; - -public interface IFluidBufferTransceiverMK2 extends IFluidStandardTransceiverMK2 { - -} diff --git a/src/main/java/api/hbm/fluidmk2/IFluidStandardSenderMK2.java b/src/main/java/api/hbm/fluidmk2/IFluidStandardSenderMK2.java index 5cbbf4e58..75791b659 100644 --- a/src/main/java/api/hbm/fluidmk2/IFluidStandardSenderMK2.java +++ b/src/main/java/api/hbm/fluidmk2/IFluidStandardSenderMK2.java @@ -46,7 +46,7 @@ public interface IFluidStandardSenderMK2 extends IFluidProviderMK2 { } } - if(te != this && te instanceof IFluidReceiverMK2 && !(te instanceof IFluidBufferTransceiverMK2)) { + if(te != this && te instanceof IFluidReceiverMK2) { IFluidReceiverMK2 rec = (IFluidReceiverMK2) te; if(rec.canConnect(type, dir.getOpposite())) { long provides = Math.min(this.getFluidAvailable(type, pressure), this.getProviderSpeed(type, pressure)); diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java index 101843c50..a6a8d4b80 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java @@ -2,7 +2,7 @@ package com.hbm.tileentity.machine.storage; import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority; import api.hbm.fluidmk2.FluidNode; -import api.hbm.fluidmk2.IFluidBufferTransceiverMK2; +import api.hbm.fluidmk2.IFluidStandardTransceiverMK2; import java.util.HashSet; @@ -45,10 +45,9 @@ 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 TileEntityBarrel extends TileEntityMachineBase implements SimpleComponent, IFluidBufferTransceiverMK2, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent, IFluidCopiable { +public class TileEntityBarrel extends TileEntityMachineBase implements SimpleComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent, IFluidCopiable { protected FluidNode node; - protected FluidType lastType; public FluidTank tank; public short mode = 0; @@ -100,27 +99,42 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom tank.loadTank(2, 3, slots); tank.unloadTank(4, 5, slots); - if(this.node == null || this.node.expired || tank.getTankType() != lastType) { + // In buffer mode, acts like a pipe block, providing fluid to its own node + // otherwise, it is a regular providing/receiving machine, blocking further propagation + if(mode == 1) { + if(this.node == null || this.node.expired) { - this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); + this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); - if(this.node == null || this.node.expired || tank.getTankType() != lastType) { - this.node = this.createNode(tank.getTankType()); - UniNodespace.createNode(worldObj, this.node); - lastType = tank.getTankType(); + if(this.node == null || this.node.expired) { + this.node = this.createNode(tank.getTankType()); + UniNodespace.createNode(worldObj, this.node); + } } - } - if(mode == 2 || mode == 1) { this.tryProvide(tank, worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN); - } else { - if(node != null && node.hasValidNet()) node.net.removeProvider(this); - } - - if(mode == 0 || mode == 1) { if(node != null && node.hasValidNet()) node.net.addReceiver(this); } else { - if(node != null && node.hasValidNet()) node.net.removeReceiver(this); + if(this.node != null) { + UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); + this.node = null; + } + + for(DirPos pos : getConPos()) { + FluidNode dirNode = (FluidNode) UniNodespace.getNode(worldObj, pos.getX(), pos.getY(), pos.getZ(), tank.getTankType().getNetworkProvider()); + + if(mode == 2) { + tryProvide(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + } else { + if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeProvider(this); + } + + if(mode == 0) { + if(dirNode != null && dirNode.hasValidNet()) dirNode.net.addReceiver(this); + } else { + if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeReceiver(this); + } + } } if(tank.getFill() > 0) { diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java index 543e7205f..8b038ff38 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineBattery.java @@ -16,6 +16,7 @@ import com.hbm.lib.Library; import com.hbm.tileentity.IGUIProvider; import com.hbm.tileentity.IPersistentNBT; import com.hbm.tileentity.TileEntityMachineBase; +import com.hbm.uninos.UniNodespace; import com.hbm.util.CompatEnergyControl; import cpw.mods.fml.common.Optional; @@ -36,14 +37,14 @@ import net.minecraftforge.common.util.ForgeDirection; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")}) public class TileEntityMachineBattery extends TileEntityMachineBase implements IEnergyConductorMK2, IEnergyProviderMK2, IEnergyReceiverMK2, IPersistentNBT, SimpleComponent, IGUIProvider, IInfoProviderEC, CompatHandler.OCComponent { - + public long[] log = new long[20]; public long delta = 0; public long power = 0; public long prevPowerState = 0; - + protected PowerNode node; - + //0: input only //1: buffer //2: output only @@ -55,16 +56,16 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I public short redLow = 0; public short redHigh = 2; public ConnectionPriority priority = ConnectionPriority.LOW; - + //public boolean conducts = false; public byte lastRedstone = 0; - + private static final int[] slots_top = new int[] {0}; private static final int[] slots_bottom = new int[] {0, 1}; private static final int[] slots_side = new int[] {1}; - + private String customName; - + public TileEntityMachineBattery() { super(2); slots = new ItemStack[2]; @@ -84,24 +85,24 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I public boolean hasCustomInventoryName() { return this.customName != null && this.customName.length() > 0; } - + public void setCustomName(String name) { this.customName = name; } @Override public boolean isItemValidForSlot(int i, ItemStack stack) { - + switch(i) { case 0: case 1: if(stack.getItem() instanceof IBatteryItem) return true; break; } - + return true; } - + @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); @@ -112,18 +113,18 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I this.lastRedstone = nbt.getByte("lastRedstone"); this.priority = ConnectionPriority.values()[nbt.getByte("priority")]; } - + @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); - + nbt.setLong("power", power); nbt.setShort("redLow", redLow); nbt.setShort("redHigh", redHigh); nbt.setByte("lastRedstone", lastRedstone); nbt.setByte("priority", (byte)this.priority.ordinal()); } - + @Override public int[] getAccessibleSlotsFromSide(int p_94128_1_) { return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side); @@ -136,7 +137,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I @Override public boolean canExtractItem(int i, ItemStack itemStack, int j) { - + if(itemStack.getItem() instanceof IBatteryItem) { if(i == 0 && ((IBatteryItem)itemStack.getItem()).getCharge(itemStack) == 0) { return true; @@ -145,79 +146,95 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I return true; } } - + return false; } public long getPowerRemainingScaled(long i) { return (power * i) / this.getMaxPower(); } - + public byte getComparatorPower() { if(power == 0) return 0; double frac = (double) this.power / (double) this.getMaxPower() * 15D; return (byte) (MathHelper.clamp_int((int) frac + 1, 0, 15)); //to combat eventual rounding errors with the FEnSU's stupid maxPower } - + @Override public void updateEntity() { - + if(!worldObj.isRemote && worldObj.getBlock(xCoord, yCoord, zCoord) instanceof MachineBattery) { - + if(priority == null || priority.ordinal() == 0 || priority.ordinal() == 4) { priority = ConnectionPriority.LOW; } - + int mode = this.getRelevantMode(false); - - if(this.node == null || this.node.expired) { - - this.node = Nodespace.getNode(worldObj, xCoord, yCoord, zCoord); - + + long prevPower = this.power; + + power = Library.chargeItemsFromTE(slots, 1, power, getMaxPower()); + + // In buffer mode, becomes a cable block and provides power to itself + // otherwise, acts like a regular power providing/accepting machine + if(mode == mode_buffer) { if(this.node == null || this.node.expired) { - this.node = this.createNode(); - Nodespace.createNode(worldObj, this.node); + + this.node = (PowerNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER); + + if(this.node == null || this.node.expired) { + this.node = this.createNode(); + UniNodespace.createNode(worldObj, this.node); + } + } + + this.tryProvide(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN); + if(node != null && node.hasValidNet()) node.net.addReceiver(this); + } else { + if(this.node != null) { + UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER); + this.node = null; + } + + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + PowerNode dirNode = (PowerNode) UniNodespace.getNode(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, Nodespace.THE_POWER_PROVIDER); + + if(mode == mode_output) { + tryProvide(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); + } else { + if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeProvider(this); + } + + if(mode == mode_input) { + if(dirNode != null && dirNode.hasValidNet()) dirNode.net.addReceiver(this); + } else { + if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeReceiver(this); + } } } - - long prevPower = this.power; - - power = Library.chargeItemsFromTE(slots, 1, power, getMaxPower()); - - if(mode == mode_output || mode == mode_buffer) { - this.tryProvide(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN); - } else { - if(node != null && node.hasValidNet()) node.net.removeProvider(this); - } - + byte comp = this.getComparatorPower(); if(comp != this.lastRedstone) this.markDirty(); this.lastRedstone = comp; - - if(mode == mode_input || mode == mode_buffer) { - if(node != null && node.hasValidNet()) node.net.addReceiver(this); - } else { - if(node != null && node.hasValidNet()) node.net.removeReceiver(this); - } - + power = Library.chargeTEFromItems(slots, 0, power, getMaxPower()); long avg = (power + prevPower) / 2; this.delta = avg - this.log[0]; - + for(int i = 1; i < this.log.length; i++) { this.log[i - 1] = this.log[i]; } - + this.log[19] = avg; - + prevPowerState = power; - + this.networkPackNT(20); } } - + public void onNodeDestroyedCallback() { this.node = null; } @@ -225,10 +242,10 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I @Override public void invalidate() { super.invalidate(); - + if(!worldObj.isRemote) { if(this.node != null) { - Nodespace.destroyNode(worldObj, xCoord, yCoord, zCoord); + UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, Nodespace.THE_POWER_PROVIDER); } } } @@ -237,7 +254,7 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I int mode = this.getRelevantMode(true); return mode == mode_output || mode == mode_buffer ? this.getMaxPower() / 600 : 0; } - + @Override public long getReceiverSpeed() { int mode = this.getRelevantMode(true); return mode == mode_input || mode == mode_buffer ? this.getMaxPower() / 200 : 0; @@ -269,30 +286,30 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I public long getPower() { return power; } - + private short modeCache = 0; public short getRelevantMode(boolean useCache) { if(useCache) return this.modeCache; this.modeCache = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) ? this.redHigh : this.redLow; return this.modeCache; } - + private long bufferedMax; @Override public long getMaxPower() { - + if(bufferedMax == 0) { bufferedMax = ((MachineBattery)worldObj.getBlock(xCoord, yCoord, zCoord)).maxPower; } - + return bufferedMax; } @Override public boolean canConnect(ForgeDirection dir) { return true; } @Override public void setPower(long power) { this.power = power; } @Override public ConnectionPriority getPriority() { return this.priority; } - + // do some opencomputer stuff @Override @Optional.Method(modid = "OpenComputers") diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java index a4272cfc1..c63fefddc 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java @@ -2,7 +2,7 @@ package com.hbm.tileentity.machine.storage; import api.hbm.energymk2.IEnergyReceiverMK2.ConnectionPriority; import api.hbm.fluidmk2.FluidNode; -import api.hbm.fluidmk2.IFluidBufferTransceiverMK2; +import api.hbm.fluidmk2.IFluidStandardTransceiverMK2; import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; @@ -54,10 +54,9 @@ import java.util.List; import java.util.Random; @Optional.InterfaceList({@Optional.Interface(iface = "li.cil.oc.api.network.SimpleComponent", modid = "opencomputers")}) -public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidBufferTransceiverMK2, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable { +public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable { protected FluidNode node; - protected FluidType lastType; public FluidTank tank; public short mode = 0; @@ -114,27 +113,42 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements this.markChanged(); } - if(this.node == null || this.node.expired || tank.getTankType() != lastType) { + // In buffer mode, acts like a pipe block, providing fluid to its own node + // otherwise, it is a regular providing/receiving machine, blocking further propagation + if(mode == 1) { + if(this.node == null || this.node.expired) { - this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); + this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); - if(this.node == null || this.node.expired || tank.getTankType() != lastType) { - this.node = this.createNode(tank.getTankType()); - UniNodespace.createNode(worldObj, this.node); - lastType = tank.getTankType(); + if(this.node == null || this.node.expired) { + this.node = this.createNode(tank.getTankType()); + UniNodespace.createNode(worldObj, this.node); + } } - } - if(mode == 2 || mode == 1) { this.tryProvide(tank, worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN); - } else { - if(node != null && node.hasValidNet()) node.net.removeProvider(this); - } - - if(mode == 0 || mode == 1) { if(node != null && node.hasValidNet()) node.net.addReceiver(this); } else { - if(node != null && node.hasValidNet()) node.net.removeReceiver(this); + if(this.node != null) { + UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); + this.node = null; + } + + for(DirPos pos : getConPos()) { + FluidNode dirNode = (FluidNode) UniNodespace.getNode(worldObj, pos.getX(), pos.getY(), pos.getZ(), tank.getTankType().getNetworkProvider()); + + if(mode == 2) { + tryProvide(tank, worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir()); + } else { + if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeProvider(this); + } + + if(mode == 0) { + if(dirNode != null && dirNode.hasValidNet()) dirNode.net.addReceiver(this); + } else { + if(dirNode != null && dirNode.hasValidNet()) dirNode.net.removeReceiver(this); + } + } } tank.loadTank(2, 3, slots); From b5d76afb8c0e7f9a842675e014e9156f78252cf8 Mon Sep 17 00:00:00 2001 From: George Paton Date: Mon, 24 Mar 2025 19:56:04 +1100 Subject: [PATCH 09/12] fix switching barrel types not updating fluid net --- .../tileentity/machine/storage/TileEntityBarrel.java | 12 ++++++++---- .../machine/storage/TileEntityMachineFluidTank.java | 10 +++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java index a6a8d4b80..a383f491a 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityBarrel.java @@ -48,6 +48,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class TileEntityBarrel extends TileEntityMachineBase implements SimpleComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IGUIProvider, CompatHandler.OCComponent, IFluidCopiable { protected FluidNode node; + protected FluidType lastType; public FluidTank tank; public short mode = 0; @@ -102,18 +103,21 @@ public class TileEntityBarrel extends TileEntityMachineBase implements SimpleCom // In buffer mode, acts like a pipe block, providing fluid to its own node // otherwise, it is a regular providing/receiving machine, blocking further propagation if(mode == 1) { - if(this.node == null || this.node.expired) { + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); - if(this.node == null || this.node.expired) { + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { this.node = this.createNode(tank.getTankType()); UniNodespace.createNode(worldObj, this.node); + lastType = tank.getTankType(); } } - this.tryProvide(tank, worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN); - if(node != null && node.hasValidNet()) node.net.addReceiver(this); + if(node != null && node.hasValidNet()) { + node.net.addProvider(this); + node.net.addReceiver(this); + } } else { if(this.node != null) { UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java index c63fefddc..ff27156ca 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java @@ -57,6 +57,7 @@ import java.util.Random; public class TileEntityMachineFluidTank extends TileEntityMachineBase implements SimpleComponent, OCComponent, IFluidStandardTransceiverMK2, IPersistentNBT, IOverpressurable, IGUIProvider, IRepairable, IFluidCopiable { protected FluidNode node; + protected FluidType lastType; public FluidTank tank; public short mode = 0; @@ -116,18 +117,21 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements // In buffer mode, acts like a pipe block, providing fluid to its own node // otherwise, it is a regular providing/receiving machine, blocking further propagation if(mode == 1) { - if(this.node == null || this.node.expired) { + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); if(this.node == null || this.node.expired) { this.node = this.createNode(tank.getTankType()); UniNodespace.createNode(worldObj, this.node); + lastType = tank.getTankType(); } } - this.tryProvide(tank, worldObj, xCoord, yCoord, zCoord, ForgeDirection.UNKNOWN); - if(node != null && node.hasValidNet()) node.net.addReceiver(this); + if(node != null && node.hasValidNet()) { + node.net.addProvider(this); + node.net.addReceiver(this); + } } else { if(this.node != null) { UniNodespace.destroyNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); From 177e5a245efab35fae21f6b329eab82fbe220c7f Mon Sep 17 00:00:00 2001 From: George Paton Date: Mon, 24 Mar 2025 20:00:01 +1100 Subject: [PATCH 10/12] dingleberry blues --- .../tileentity/machine/storage/TileEntityMachineFluidTank.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java index ff27156ca..cf6e8dccc 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityMachineFluidTank.java @@ -121,7 +121,7 @@ public class TileEntityMachineFluidTank extends TileEntityMachineBase implements this.node = (FluidNode) UniNodespace.getNode(worldObj, xCoord, yCoord, zCoord, tank.getTankType().getNetworkProvider()); - if(this.node == null || this.node.expired) { + if(this.node == null || this.node.expired || tank.getTankType() != lastType) { this.node = this.createNode(tank.getTankType()); UniNodespace.createNode(worldObj, this.node); lastType = tank.getTankType(); From 7146e20fb3c408f920f00c94db14fb963231915a Mon Sep 17 00:00:00 2001 From: Boblet Date: Mon, 24 Mar 2025 10:38:15 +0100 Subject: [PATCH 11/12] f u c k --- changelog | 67 ++----------------- .../java/api/hbm/fluidmk2/FluidNetMK2.java | 6 +- .../java/com/hbm/crafting/WeaponRecipes.java | 2 +- .../container/ContainerWeaponTable.java | 2 +- src/main/java/com/hbm/util/BobMathUtil.java | 10 +++ 5 files changed, 23 insertions(+), 64 deletions(-) diff --git a/changelog b/changelog index 7514dcf6c..82529db34 100644 --- a/changelog +++ b/changelog @@ -1,64 +1,9 @@ -## Added -* `/ntmserver` - * Functions like `/ntmclient` but for common settings - * Can toggle `DAMAGE_COMPATIBILITY_MODE`, off by default, enables a more compatible (but slightly jankier) version of the bullet damage code - * `MINE__DAMAGE` can be used to adjust landmine damage - * `TAINT_TRAILS` now replaces the hardcore taint config option, making taint blocks more potent and the potion effect trail taint blocks -* New ammo types - * Explosive 7.62mm - * Explosive .50 BMG - * Explosive 10 gauge buckshot (unlike 12 gauge which has explosive slugs) -* Lincoln's repeater, a b-side to the lever action rifle -* Weapon modification table - * All weapon tiers have generic upgrades for increasing damage and durability - * Many guns have specialized attachments. Some examples: - * The assault rifle can use silencers, scopes, can have its stock removed and has two different polymer furnitures - * .44 revolvers can use scopes - * All full-length shotguns can have their barrel sawed off - * Most shotguns can make use of a choke to decrease projectile spread (does not work with sawed-offs) - * The grease gun has a modernization package, replacing most parts and increasing most stats - * Some guns have special mod combos that will change the name - ## Changed -* Fat mines now use the standardized mini nuke code - * Fat mines now have a base damage of exactly 100, being identical to demolition mini nukes - * Fat mines now gib affected entities -* IV bags now use `setHealth` operations instead of dealing damage, preventing health duplication by just avoiding the damage -* The settings tool can now copy and paste the "paint" from paintable cables and fluid ducts -* Changed the way taint works - * Instead of neon purple vines, taint is bow a greyish sludge - * Taint now actively replaces blocks instead of growing along them - * Taint is still limited in spread, however taint spread is lower underground, taint decays three times faster in intensity if the block is not exposed to air, making taint spread more along the surface - * Taint has a 25% chance of splashing down when replacing a block with no supports, causing structures to collapse and taint to spread faster - * Similar to soil sand, entities will sink in taint and get slowed down - * The sludge consumeth -* `enableGuns` config option now applies to SEDNA system guns, simply canceling all gun-related keybinds -* Cinnabar dust, if registered by another mod, can now be acidized into cinnabar using hydrogen peroxide -* Copper wires, like AA and gold, can now be welded into dense wires -* Removed the crafting recipe for the small geothermal generator and ZPE generators -* Removed the gemothermal, ZPE and ambient radiation generators from the creative menu -* Disabled the horrid flicker on the quad rocket launcher's antenna, making steered mode look less terrible -* All non-legendary .357 revolvers now fire a quarter of a second faster -* Changed the detonator's recipe to be less archaic -* Crates can now be opened when held -* Crates will not longer show their contents when locked -* Crates found in structures will sometimes contain things that aren't items -* Beam weapons are no longer pinpoint accurate when firing unscoped -* Reduced the recoil animation's intensity on the G3 by 66%, unless if the stock is sawed off -* The comically long pistol no longer cancels the inspect animation when fired while inspecting - * Instead, it will fire where the gun is pointing, at the player's face - * There's no special animation for this, since in survival mode, that would be lethal anyway +* The toolbox' functionality has been completely changed (thanks gamma) + * Instead of a crappy backpack substitute that doesn't work half the time, the toolbox can quickly swap out the hotbar when used +* Updated StG 77 recipe to use two grips and a proper scope ## Fixed -* Fixed animation errors on the MAS-36 -* Fixed drone docks, requester and provider crates not dropping their contents when broken -* Fixed all missing texture errors that appear in the startup log -* Potentially fixed a crash with mekanism during the recipe change phase -* Removed the coke to heavy oil recipe for allowing infinite oil loops - * Coke to syngas and coalgas recipes should be fine though, so they stay -* Potentially fixed another issue regarding NPCs firing belt-fed guns -* Chunk-loading drones may or may not be fixed -* Fixed disperser canisters not actually despawning on impact, endlessly spawning mist clouds -* Fixed issues where the new packet system didn't play nice with machines that are being sent packets by other machines, like watz segments and radar screens -* Fixed fat man's piston not being extended correctly in non-first person rendering when unloaded -* Fixed weapon equip animation not playing when switching between two weapons of the same type +* Fixed a bunch of singleblocks not accepting fluids (thanks mellow) +* Fixed fluid valves not properly disconnecting +* Fixed a dupe regarding the weapon mod table diff --git a/src/main/java/api/hbm/fluidmk2/FluidNetMK2.java b/src/main/java/api/hbm/fluidmk2/FluidNetMK2.java index 411f91a77..3283c6489 100644 --- a/src/main/java/api/hbm/fluidmk2/FluidNetMK2.java +++ b/src/main/java/api/hbm/fluidmk2/FluidNetMK2.java @@ -88,9 +88,11 @@ public class FluidNetMK2 extends NodeNet= 0; i--) { - long toTransfer = Math.min(fluidDemand[p][i], fluidAvailable[p]); + long toTransfer = Math.min(fluidDemand[p][i], totalAvailable); if(toTransfer <= 0) continue; long priorityDemand = fluidDemand[p][i]; @@ -102,6 +104,8 @@ public class FluidNetMK2 extends NodeNet largest) largest = num; return largest; } + public static long min(long... nums) { + long smallest = Long.MAX_VALUE; + for(long num : nums) if(num < smallest) smallest = num; + return smallest; + } + public static long max(long... nums) { + long largest = Long.MIN_VALUE; + for(long num : nums) if(num > largest) largest = num; + return largest; + } public static float min(float... nums) { float smallest = Float.MAX_VALUE; for(float num : nums) if(num < smallest) smallest = num; From 79d3b0cbb7073ace8117ce583f2d8e64fcdd2ae0 Mon Sep 17 00:00:00 2001 From: Boblet Date: Mon, 24 Mar 2025 16:01:13 +0100 Subject: [PATCH 12/12] the infinite agony generator --- changelog | 3 +++ gradle.properties | 2 +- .../java/com/hbm/crafting/WeaponRecipes.java | 19 ++++++++++++++++++ .../java/com/hbm/inventory/material/Mats.java | 4 ++-- src/main/java/com/hbm/lib/RefStrings.java | 2 +- .../java/com/hbm/main/CraftingManager.java | 2 +- .../com/hbm/util/DamageResistanceHandler.java | 8 ++++---- .../assets/hbm/textures/items/ducttape.png | Bin 383 -> 344 bytes 8 files changed, 31 insertions(+), 9 deletions(-) diff --git a/changelog b/changelog index 82529db34..a9ca40d00 100644 --- a/changelog +++ b/changelog @@ -2,6 +2,9 @@ * The toolbox' functionality has been completely changed (thanks gamma) * Instead of a crappy backpack substitute that doesn't work half the time, the toolbox can quickly swap out the hotbar when used * Updated StG 77 recipe to use two grips and a proper scope +* Buffed the RPA set +* Tiered damage and durability weapon mods are now craftable +* Duct tape is now cheaper and less ugly ## Fixed * Fixed a bunch of singleblocks not accepting fluids (thanks mellow) diff --git a/gradle.properties b/gradle.properties index ca8db7f3d..f2f5fe3b0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mod_version=1.0.27 # Empty build number makes a release type -mod_build_number=5278 +mod_build_number=5279 credits=HbMinecraft,\ \ rodolphito (explosion algorithms),\ diff --git a/src/main/java/com/hbm/crafting/WeaponRecipes.java b/src/main/java/com/hbm/crafting/WeaponRecipes.java index e77df9b63..49c31e360 100644 --- a/src/main/java/com/hbm/crafting/WeaponRecipes.java +++ b/src/main/java/com/hbm/crafting/WeaponRecipes.java @@ -16,6 +16,7 @@ import com.hbm.items.ModItems; import com.hbm.items.weapon.GunB92Cell; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmoSecret; +import com.hbm.items.weapon.sedna.factory.GunFactory.EnumModGeneric; import com.hbm.items.weapon.sedna.factory.GunFactory.EnumModSpecial; import com.hbm.main.CraftingManager; @@ -98,6 +99,24 @@ public class WeaponRecipes { CraftingManager.addRecipeAuto(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.STONE_IRON, 6), new Object[] { "C", "P", "G", 'C', IRON.ingot(), 'P', Items.paper, 'G', Items.gunpowder }); //SEDNA Mods + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.IRON_DAMAGE.ordinal()), new Object[] { GUNMETAL.ingot(), IRON.ingot(), IRON.ingot(), IRON.ingot(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.IRON_DURA.ordinal()), new Object[] { GUNMETAL.ingot(), IRON.ingot(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.STEEL_DAMAGE.ordinal()), new Object[] { GUNMETAL.mechanism(), STEEL.plateCast(), STEEL.plateCast(), STEEL.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.STEEL_DURA.ordinal()), new Object[] { GUNMETAL.plate(), STEEL.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.DURA_DAMAGE.ordinal()), new Object[] { GUNMETAL.mechanism(), DURA.plateCast(), DURA.plateCast(), DURA.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.DURA_DURA.ordinal()), new Object[] { GUNMETAL.plate(), DURA.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.DESH_DAMAGE.ordinal()), new Object[] { GUNMETAL.mechanism(), DESH.plateCast(), DESH.plateCast(), DESH.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.DESH_DURA.ordinal()), new Object[] { GUNMETAL.plate(), DESH.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.WSTEEL_DAMAGE.ordinal()), new Object[] { WEAPONSTEEL.mechanism(), WEAPONSTEEL.plateCast(), WEAPONSTEEL.plateCast(), WEAPONSTEEL.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.WSTEEL_DURA.ordinal()), new Object[] { WEAPONSTEEL.plate(), WEAPONSTEEL.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.FERRO_DAMAGE.ordinal()), new Object[] { WEAPONSTEEL.mechanism(), FERRO.plateCast(), FERRO.plateCast(), FERRO.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.FERRO_DURA.ordinal()), new Object[] { WEAPONSTEEL.plate(), FERRO.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.TCALLOY_DAMAGE.ordinal()), new Object[] { WEAPONSTEEL.mechanism(), ANY_RESISTANTALLOY.plateCast(), ANY_RESISTANTALLOY.plateCast(), ANY_RESISTANTALLOY.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.TCALLOY_DURA.ordinal()), new Object[] { WEAPONSTEEL.plate(), ANY_RESISTANTALLOY.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.BIGMT_DAMAGE.ordinal()), new Object[] { BIGMT.mechanism(), BIGMT.plateCast(), BIGMT.plateCast(), BIGMT.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.BIGMT_DURA.ordinal()), new Object[] { BIGMT.plate(), BIGMT.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.BRONZE_DAMAGE.ordinal()), new Object[] { BIGMT.mechanism(), ANY_BISMOIDBRONZE.plateCast(), ANY_BISMOIDBRONZE.plateCast(), ANY_BISMOIDBRONZE.plateCast(), ModItems.ducttape }); + CraftingManager.addShapelessAuto(new ItemStack(ModItems.weapon_mod_generic, 1, EnumModGeneric.BRONZE_DURA.ordinal()), new Object[] { BIGMT.plate(), ANY_BISMOIDBRONZE.plateCast(), ModItems.ducttape }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SILENCER.ordinal()), new Object[] { "P", "B", "P", 'P', ANY_PLASTIC.ingot(), 'B', STEEL.lightBarrel() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SCOPE.ordinal()), new Object[] { "SPS", "G G", "SPS", 'P', ANY_PLASTIC.ingot(), 'S', STEEL.plate(), 'G', KEY_ANYPANE }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.weapon_mod_special, 1, EnumModSpecial.SAW.ordinal()), new Object[] { "BBS", "BHB", 'B', STEEL.bolt(), 'S', KEY_STICK, 'H', DURA.plate() }); diff --git a/src/main/java/com/hbm/inventory/material/Mats.java b/src/main/java/com/hbm/inventory/material/Mats.java index d95b7c51f..16bc6378b 100644 --- a/src/main/java/com/hbm/inventory/material/Mats.java +++ b/src/main/java/com/hbm/inventory/material/Mats.java @@ -138,7 +138,7 @@ public class Mats { public static final NTMMaterial MAT_STEEL = makeSmeltable(_AS + 0, STEEL, 0xAFAFAF, 0x0F0F0F, 0x4A4A4A).setAutogen(DUSTTINY, BOLT, WIRE, DUST, PLATE, CASTPLATE, WELDEDPLATE, SHELL, PIPE, BLOCK, HEAVY_COMPONENT, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, GRIP).m(); public static final NTMMaterial MAT_MINGRADE = makeSmeltable(_AS + 1, MINGRADE, 0xFFBA7D, 0xAF1700, 0xE44C0F).setAutogen(WIRE, DUST, BLOCK).m(); public static final NTMMaterial MAT_ALLOY = makeSmeltable(_AS + 2, ALLOY, 0xFF8330, 0x700000, 0xFF7318).setAutogen(WIRE, DUST, DENSEWIRE, PLATE, CASTPLATE, BLOCK, HEAVY_COMPONENT).m(); - public static final NTMMaterial MAT_DURA = makeSmeltable(_AS + 3, DURA, 0x183039, 0x030B0B, 0x376373).setAutogen(BOLT, DUST, PIPE, BLOCK, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, GRIP).m(); + public static final NTMMaterial MAT_DURA = makeSmeltable(_AS + 3, DURA, 0x183039, 0x030B0B, 0x376373).setAutogen(BOLT, DUST, PLATE, CASTPLATE, PIPE, BLOCK, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, GRIP).m(); public static final NTMMaterial MAT_DESH = makeSmeltable(_AS + 12, DESH, 0xFF6D6D, 0x720000, 0xF22929).setAutogen(DUST, CASTPLATE, BLOCK, HEAVY_COMPONENT, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, STOCK, GRIP).m(); public static final NTMMaterial MAT_STAR = makeSmeltable(_AS + 5, STAR, 0xCCCCEA, 0x11111A, 0xA5A5D3).setAutogen(DUST, DENSEWIRE, BLOCK).m(); public static final NTMMaterial MAT_FERRO = makeSmeltable(_AS + 7, FERRO, 0xB7B7C9, 0x101022, 0x6B6B8B).setAutogen(HEAVYBARREL, HEAVYRECEIVER).m(); @@ -154,7 +154,7 @@ public class Mats { public static final NTMMaterial MAT_SLAG = makeSmeltable(_AS + 11, SLAG, 0x554940, 0x34281F, 0x6C6562).setAutogen(BLOCK).n(); public static final NTMMaterial MAT_MUD = makeSmeltable(_AS + 14, MUD, 0xBCB5A9, 0x481213, 0x96783B).n(); public static final NTMMaterial MAT_GUNMETAL = makeSmeltable(_AS + 19, GUNMETAL, 0xFFEF3F, 0xAD3600, 0xF9C62C).setAutogen(LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, MECHANISM, STOCK, GRIP).n(); - public static final NTMMaterial MAT_WEAPONSTEEL = makeSmeltable(_AS + 20, WEAPONSTEEL, 0xA0A0A0, 0x000000, 0x808080).setAutogen(SHELL, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, MECHANISM, STOCK, GRIP).n(); + public static final NTMMaterial MAT_WEAPONSTEEL = makeSmeltable(_AS + 20, WEAPONSTEEL, 0xA0A0A0, 0x000000, 0x808080).setAutogen(CASTPLATE, SHELL, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, MECHANISM, STOCK, GRIP).n(); public static final NTMMaterial MAT_SATURN = makeSmeltable(_AS + 4, BIGMT, 0x3AC4DA, 0x09282C, 0x30A4B7).setAutogen(PLATE, CASTPLATE, SHELL, BLOCK, LIGHTBARREL, HEAVYBARREL, LIGHTRECEIVER, HEAVYRECEIVER, MECHANISM, STOCK, GRIP).m(); //Extension diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index c7dd243c2..317faa8d6 100644 --- a/src/main/java/com/hbm/lib/RefStrings.java +++ b/src/main/java/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (5278)"; + public static final String VERSION = "1.0.27 BETA (5279)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index d5de9f424..ff321331f 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -212,7 +212,7 @@ public class CraftingManager { addShapelessAuto(new ItemStack(ModItems.cbt_device, 1), new Object[] { STEEL.bolt(), ModItems.wrench }); addShapelessAuto(new ItemStack(ModItems.toothpicks, 3), new Object[] { KEY_STICK, KEY_STICK, KEY_STICK }); - addRecipeAuto(new ItemStack(ModItems.ducttape, 6), new Object[] { "FSF", "SPS", "FSF", 'F', Items.string, 'S', KEY_SLIME, 'P', Items.paper }); + addRecipeAuto(new ItemStack(ModItems.ducttape, 4), new Object[] { "F", "P", "S", 'F', Items.string, 'S', KEY_SLIME, 'P', Items.paper }); addRecipeAuto(new ItemStack(ModBlocks.radio_torch_sender, 4), new Object[] { "G", "R", "I", 'G', "dustGlowstone", 'R', Blocks.redstone_torch, 'I', NETHERQUARTZ.gem() }); addRecipeAuto(new ItemStack(ModBlocks.radio_torch_receiver, 4), new Object[] { "G", "R", "I", 'G', "dustGlowstone", 'R', Blocks.redstone_torch, 'I', IRON.ingot() }); diff --git a/src/main/java/com/hbm/util/DamageResistanceHandler.java b/src/main/java/com/hbm/util/DamageResistanceHandler.java index c54bb7a0b..1075f264f 100644 --- a/src/main/java/com/hbm/util/DamageResistanceHandler.java +++ b/src/main/java/com/hbm/util/DamageResistanceHandler.java @@ -111,12 +111,12 @@ public class DamageResistanceHandler { .addExact(DamageSource.fall.damageType, 0F, 1F) .setOther(0F, 0.15F)); registerSet(ModItems.rpa_helmet, ModItems.rpa_plate, ModItems.rpa_legs, ModItems.rpa_boots, new ResistanceStats() - .addCategory(CATEGORY_PROJECTILE, 20F, 0.65F) - .addCategory(CATEGORY_FIRE, 10F, 0.75F) + .addCategory(CATEGORY_PROJECTILE, 25F, 0.65F) + .addCategory(CATEGORY_FIRE, 10F, 0.9F) .addCategory(CATEGORY_EXPLOSION, 15F, 0.25F) - .addExact(DamageClass.LASER.name(), 10F, 0.75F) + .addExact(DamageClass.LASER.name(), 25F, 0.75F) .addExact(DamageSource.fall.damageType, 0F, 1F) - .setOther(10F, 0.15F)); + .setOther(15F, 0.3F)); ResistanceStats bj = new ResistanceStats() .addCategory(CATEGORY_PROJECTILE, 5F, 0.5F) .addCategory(CATEGORY_FIRE, 2.5F, 0.5F) diff --git a/src/main/resources/assets/hbm/textures/items/ducttape.png b/src/main/resources/assets/hbm/textures/items/ducttape.png index facce7f8eec13c3c420d50e24de5ca82b4feed14..dca05429ab768c805d6bb0e8cee9eb20854c18d5 100644 GIT binary patch delta 301 zcmV+|0n+~e0@wnOG=C3CL_t(IjbmV-5HJ!_(6*}ezmc60oPS`$L57Zu4!AxRVr-EV zm%=GWlmX9QKBLTlN0%QHZ$R6s*8j--dzbDp++(=Mz`(%3U}kTQ-vIOgTQg-1gOZ*S z0|NsC!>4zj88$E7%%E+djopB@RjvQMLw(>9lWQk2h{%Y-`G0&uybRhF+6-4uTtzW} z38&|vni&2=yaDH<0k{F5-hF0x{_+_d!@#}E_ZW_DKgJ-dB8SxylrVVx>4zj@f+~{?RON(Pwzf6@Cota)XczumKQ2!RQy*`R)X`w*4$L?T(U}njXI=b1Ij}GiNP$37_C5#Xg|@FwCZ6rQ`_8%NzIWljkx45!HAm+1 zS#7Q3b(L-}P3+xyin|vs&bb4CloDLz)+CX@sX4OIs&kY(27ln@x=q04>2+Z z0B?`4biD2l(_rdP0Px4NO&bXxPw#{>jNH?X5H|sMet2Q@H3Fb~da^MF5(&1K(%_G0 zES7V{wIj?Yi-=*cTvMsq2uo0@+L4z_9bwl5AXu#_+C_rZnlKDiQtcj?B~vzUn~L|^ zJ