From 860d79a2d05bce4635bfe64541864ab177140b38 Mon Sep 17 00:00:00 2001 From: BallOfEnergy <66693744+BallOfEnergy1@users.noreply.github.com> Date: Thu, 4 Jan 2024 22:13:40 -0600 Subject: [PATCH 1/7] pipettes! --- src/main/java/com/hbm/items/ModItems.java | 11 ++ .../java/com/hbm/items/tool/ItemPipette.java | 171 ++++++++++++++++++ src/main/resources/assets/hbm/lang/en_US.lang | 3 + .../assets/hbm/textures/items/pipette.png | Bin 0 -> 186 bytes .../hbm/textures/items/pipette_overlay.png | Bin 0 -> 159 bytes 5 files changed, 185 insertions(+) create mode 100644 src/main/java/com/hbm/items/tool/ItemPipette.java create mode 100644 src/main/resources/assets/hbm/textures/items/pipette.png create mode 100644 src/main/resources/assets/hbm/textures/items/pipette_overlay.png diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 30d2e7b34..d402c03ef 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -935,6 +935,9 @@ public class ModItems { public static Item fluid_barrel_full; public static Item fluid_barrel_empty; public static Item fluid_barrel_infinite; + public static Item pipette; + public static Item pipette_boron; + public static Item pipette_laboratory; public static Item disperser_canister_empty; public static Item disperser_canister; @@ -4652,6 +4655,9 @@ public class ModItems { fluid_barrel_empty = new Item().setUnlocalizedName("fluid_barrel_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel"); fluid_barrel_full = new ItemFluidTank().setUnlocalizedName("fluid_barrel_full").setContainerItem(ModItems.fluid_barrel_empty).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel"); fluid_barrel_infinite = new ItemInfiniteFluid(null, 1_000_000_000).setUnlocalizedName("fluid_barrel_infinite").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":fluid_barrel_infinite"); + pipette = new ItemPipette().setUnlocalizedName("pipette").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pipette"); + pipette_boron = new ItemPipette().setUnlocalizedName("pipette_boron").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pipette_boron"); + pipette_laboratory = new ItemPipette().setUnlocalizedName("pipette_laboratory").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":pipette_laboratory"); disperser_canister_empty = new Item().setUnlocalizedName("disperser_canister_empty").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":disperser_canister"); disperser_canister = new ItemDisperser().setUnlocalizedName("disperser_canister").setContainerItem(ModItems.disperser_canister_empty).setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":disperser_canister"); @@ -6382,6 +6388,11 @@ public class ModItems { GameRegistry.registerItem(fluid_barrel_full, fluid_barrel_full.getUnlocalizedName()); GameRegistry.registerItem(fluid_barrel_infinite, fluid_barrel_infinite.getUnlocalizedName()); + //Pipette + GameRegistry.registerItem(pipette, pipette.getUnlocalizedName()); + GameRegistry.registerItem(pipette_boron, pipette_boron.getUnlocalizedName()); + GameRegistry.registerItem(pipette_laboratory, pipette_laboratory.getUnlocalizedName()); + //Disperser Canister GameRegistry.registerItem(disperser_canister_empty, disperser_canister_empty.getUnlocalizedName()); GameRegistry.registerItem(disperser_canister, disperser_canister.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/tool/ItemPipette.java b/src/main/java/com/hbm/items/tool/ItemPipette.java new file mode 100644 index 000000000..9ca02b46a --- /dev/null +++ b/src/main/java/com/hbm/items/tool/ItemPipette.java @@ -0,0 +1,171 @@ +package com.hbm.items.tool; + +import api.hbm.fluid.IFillableItem; +import com.hbm.inventory.fluid.FluidType; +import com.hbm.inventory.fluid.Fluids; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import com.hbm.items.ModItems; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import java.util.List; + +public class ItemPipette extends Item implements IFillableItem { + + public ItemPipette() { + this.setMaxDamage(0); + } + + @SideOnly(Side.CLIENT) protected IIcon overlayIcon; + + public int amount = 50; + + public FluidType type = Fluids.NONE; + + public int getMaxFill() { + if(this == ModItems.pipette_laboratory) + return 50; + else + return 1_000; + } + + public void initNBT(ItemStack stack) { + + stack.stackTagCompound = new NBTTagCompound(); + + this.setFill(stack, type, 0); + } + + public void setFill(ItemStack stack, FluidType type, int fill) { + if(!stack.hasTagCompound()) { + initNBT(stack); + } + + this.type = type; + stack.stackTagCompound.setInteger(type.getName(), fill); + } + + public int getFill(ItemStack stack, FluidType type) { + if(!stack.hasTagCompound()) { + initNBT(stack); + } + + return stack.stackTagCompound.getInteger(type.getName()); + } + + @Override + @SideOnly(Side.CLIENT) + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + + if(!stack.hasTagCompound()) { + initNBT(stack); + } + + if(!world.isRemote) { + if (this.getFill(stack, type) == 0) { + + if(this != ModItems.pipette_laboratory) + this.amount = player.isSneaking() ? Math.min(this.amount + 50, 1_000) : Math.max(this.amount - 50, 50); + else + this.amount = player.isSneaking() ? Math.min(this.amount + 1, 50) : Math.max(this.amount - 1, 1); + + + player.addChatMessage(new ChatComponentText(this.amount + "/" + this.getMaxFill() + "mB")); + } else { + player.addChatMessage(new ChatComponentText("Pipette not empty!")); + } + } + return stack; + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + if(this == ModItems.pipette_laboratory) + list.add("Now with 50x more precision!"); + list.add("Fluid: " + type.getLocalizedName()); + list.add("Amount: " + this.getFill(stack, type) + "/" + amount + "mB (" + this.getMaxFill() + "mB)"); + } + + @Override + public boolean acceptsFluid(FluidType type, ItemStack stack) { + if(this == ModItems.pipette_boron || this == ModItems.pipette_laboratory) + return (type == this.type || this.getFill(stack, type) == 0); + return (type == this.type || this.getFill(stack, type) == 0) && !type.needsLeadContainer(); + } + + @Override + public int tryFill(FluidType type, int amount, ItemStack stack) { + + if(!acceptsFluid(type, stack)) + return amount; + + if(this.getFill(stack, type) == 0) + this.setFill(stack, type, 0); + + int req = this.amount - this.getFill(stack, type); + int toFill = Math.min(req, amount); + + this.setFill(stack, type, this.getFill(stack, type) + toFill); + + return amount - toFill; + } + + @Override + public boolean providesFluid(FluidType type, ItemStack stack) { + return this.type == type; + } + + @Override + public int tryEmpty(FluidType type, int amount, ItemStack stack) { + if(providesFluid(type, stack)) { + int toUnload = Math.min(amount, this.getFill(stack, type)); + this.setFill(stack, type,this.getFill(stack, type) - toUnload); + return toUnload; + } + return amount; + } + + //this took me way too long to figure out + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister icon) { + super.registerIcons(icon); + this.overlayIcon = icon.registerIcon("hbm:pipette_overlay"); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(int p_77618_1_, int p_77618_2_) { + return p_77618_2_ == 1 ? this.overlayIcon : super.getIconFromDamageForRenderPass(p_77618_1_, p_77618_2_); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int pass) { + if(pass == 0) { + return 0xffffff; + } else { + int j = Fluids.fromID(stack.getItemDamage()).getColor(); + + if(j < 0) { + j = 0xffffff; + } + + return j; + } + } + +} diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 845be3e2f..b403e401e 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -3663,6 +3663,9 @@ item.powder_xe135_tiny.name=Tiny Pile of Xenon-135 Powder item.powder_yellowcake.name=Yellowcake item.powder_zirconium.name=Zirconium Powder item.power_net_tool.name=Cable Network Analysis Tool +item.pipette.name=Pipette +item.pipette_boron.name=Boron Pipette +item.pipette_laboratory.name=Laboratory Grade Pipette item.primer_357.name=.357 Magnum Primer (x24) item.primer_44.name=.44 Magnum Primer (x24) item.primer_50.name=Large Caliber Primer (x12) diff --git a/src/main/resources/assets/hbm/textures/items/pipette.png b/src/main/resources/assets/hbm/textures/items/pipette.png new file mode 100644 index 0000000000000000000000000000000000000000..00ebcd67423fdf013dbc4b3cac6c2339cb30d27a GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucL4Qvd#}EtuWQiyR6_qFU9L_tJFivpG%*-@! zGi%}WddzD3zkYJMHb;ZW{r~^@dpy4}ZAueRJE{7jtGy#lz~P$1wlo1>ppZiJ;{Y}u a9tO#2u?t_u814cZ&EV1kQ0v!Yl3>X-g*0Hd~n}{(1^)q<7`njxgN@xNARHP?~ literal 0 HcmV?d00001 From 0ab03d7b77db2464064d72f80b7685adebf3da7d Mon Sep 17 00:00:00 2001 From: BallOfEnergy <66693744+BallOfEnergy1@users.noreply.github.com> Date: Fri, 5 Jan 2024 15:44:43 +0000 Subject: [PATCH 2/7] small flixes --- src/main/java/com/hbm/items/tool/ItemPipette.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/hbm/items/tool/ItemPipette.java b/src/main/java/com/hbm/items/tool/ItemPipette.java index 9ca02b46a..6358bb521 100644 --- a/src/main/java/com/hbm/items/tool/ItemPipette.java +++ b/src/main/java/com/hbm/items/tool/ItemPipette.java @@ -24,7 +24,7 @@ public class ItemPipette extends Item implements IFillableItem { @SideOnly(Side.CLIENT) protected IIcon overlayIcon; - public int amount = 50; + public int amount; public FluidType type = Fluids.NONE; @@ -40,6 +40,7 @@ public class ItemPipette extends Item implements IFillableItem { stack.stackTagCompound = new NBTTagCompound(); this.setFill(stack, type, 0); + this.amount = getMaxFill() } public void setFill(ItemStack stack, FluidType type, int fill) { @@ -95,8 +96,8 @@ public class ItemPipette extends Item implements IFillableItem { @Override public boolean acceptsFluid(FluidType type, ItemStack stack) { if(this == ModItems.pipette_boron || this == ModItems.pipette_laboratory) - return (type == this.type || this.getFill(stack, type) == 0); - return (type == this.type || this.getFill(stack, type) == 0) && !type.needsLeadContainer(); + return (type == this.type || this.getFill(stack, type) == 0 && !type.isAntimatter()); + return (type == this.type || this.getFill(stack, type) == 0) && (!type.isCorrosive() && !type.isAntimatter()); } @Override From 72fa1bda7fb7b336970b5a5f1d81eb2b2d9eefd2 Mon Sep 17 00:00:00 2001 From: BallOfEnergy <66693744+BallOfEnergy1@users.noreply.github.com> Date: Fri, 5 Jan 2024 16:30:30 +0000 Subject: [PATCH 3/7] raaagh --- src/main/java/com/hbm/items/tool/ItemPipette.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/hbm/items/tool/ItemPipette.java b/src/main/java/com/hbm/items/tool/ItemPipette.java index 6358bb521..f0b8fb026 100644 --- a/src/main/java/com/hbm/items/tool/ItemPipette.java +++ b/src/main/java/com/hbm/items/tool/ItemPipette.java @@ -1,19 +1,23 @@ package com.hbm.items.tool; import api.hbm.fluid.IFillableItem; + import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; +import com.hbm.items.ModItems; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; + import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import com.hbm.items.ModItems; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; import net.minecraft.world.World; + import java.util.List; public class ItemPipette extends Item implements IFillableItem { @@ -24,7 +28,7 @@ public class ItemPipette extends Item implements IFillableItem { @SideOnly(Side.CLIENT) protected IIcon overlayIcon; - public int amount; + public int amount = this.getMaxFill(); public FluidType type = Fluids.NONE; @@ -40,7 +44,6 @@ public class ItemPipette extends Item implements IFillableItem { stack.stackTagCompound = new NBTTagCompound(); this.setFill(stack, type, 0); - this.amount = getMaxFill() } public void setFill(ItemStack stack, FluidType type, int fill) { From 56682e5c27c1fe5ba848acf2f858d59141edfc6e Mon Sep 17 00:00:00 2001 From: BallOfEnergy <66693744+BallOfEnergy1@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:07:43 -0600 Subject: [PATCH 4/7] Small fix --- src/main/java/com/hbm/items/tool/ItemPipette.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/hbm/items/tool/ItemPipette.java b/src/main/java/com/hbm/items/tool/ItemPipette.java index f0b8fb026..f18bdd681 100644 --- a/src/main/java/com/hbm/items/tool/ItemPipette.java +++ b/src/main/java/com/hbm/items/tool/ItemPipette.java @@ -64,7 +64,6 @@ public class ItemPipette extends Item implements IFillableItem { } @Override - @SideOnly(Side.CLIENT) public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if(!stack.hasTagCompound()) { From 5fc297a7b10761a1170de179575926c5a2e84df3 Mon Sep 17 00:00:00 2001 From: BallOfEnergy <66693744+BallOfEnergy1@users.noreply.github.com> Date: Sat, 6 Jan 2024 02:18:38 -0600 Subject: [PATCH 5/7] 2:15 am forgive my terrible coding --- .../java/com/hbm/crafting/ToolRecipes.java | 5 +- .../inventory/recipes/AssemblerRecipes.java | 6 + .../java/com/hbm/items/tool/ItemPipette.java | 110 ++++++++++++------ src/main/resources/assets/hbm/lang/en_US.lang | 6 +- .../assets/hbm/textures/items/pipette.png | Bin 186 -> 250 bytes .../hbm/textures/items/pipette_boron.png | Bin 0 -> 280 bytes .../hbm/textures/items/pipette_laboratory.png | Bin 0 -> 366 bytes .../items/pipette_laboratory_overlay.png | Bin 0 -> 141 bytes .../hbm/textures/items/pipette_overlay.png | Bin 159 -> 222 bytes 9 files changed, 87 insertions(+), 40 deletions(-) create mode 100644 src/main/resources/assets/hbm/textures/items/pipette_boron.png create mode 100644 src/main/resources/assets/hbm/textures/items/pipette_laboratory.png create mode 100644 src/main/resources/assets/hbm/textures/items/pipette_laboratory_overlay.png diff --git a/src/main/java/com/hbm/crafting/ToolRecipes.java b/src/main/java/com/hbm/crafting/ToolRecipes.java index 8b8f2c27c..0247bd6cc 100644 --- a/src/main/java/com/hbm/crafting/ToolRecipes.java +++ b/src/main/java/com/hbm/crafting/ToolRecipes.java @@ -128,7 +128,10 @@ public class ToolRecipes { CraftingManager.addRecipeAuto(new ItemStack(ModItems.bismuth_tool, 1), new Object[] { "TBT", "SRS", "SCS", 'T', TA.nugget(), 'B', ModItems.nugget_bismuth, 'S', ANY_RESISTANTALLOY.ingot(), 'R', ModItems.reacher, 'C', ModItems.circuit_aluminium }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.sat_designator, 1), new Object[] { "RRD", "PIC", " P", 'P', GOLD.plate(), 'R', Items.redstone, 'C', ModItems.circuit_gold, 'D', ModItems.sat_chip, 'I', GOLD.ingot() }); CraftingManager.addShapelessAuto(new ItemStack(ModItems.sat_relay), new Object[] { ModItems.sat_chip, ModItems.ducttape, ModItems.radar_linker }); - + + CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette, 1), new Object[] { " L", " G ", "G ", 'L', ModItems.ingot_biorubber, 'G', KEY_CLEARGLASS}); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette_boron, 1), new Object[] { " P", " B ", "B ", 'P', ANY_RUBBER.ingot(), 'B', ModBlocks.glass_boron}); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.mirror_tool), new Object[] { " A ", " IA", "I ", 'A', AL.ingot(), 'I', IRON.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.rbmk_tool), new Object[] { " A ", " IA", "I ", 'A', PB.ingot(), 'I', IRON.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.power_net_tool), new Object[] { "WRW", " I ", " B ", 'W', ModItems.wire_red_copper, 'R', REDSTONE.dust(), 'I', IRON.ingot(), 'B', ModItems.battery_su }); diff --git a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java index 315ac6eef..cc918d0cc 100644 --- a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java @@ -696,6 +696,12 @@ public class AssemblerRecipes { new ComparableStack(ModItems.motor, 2), }, 200); + makeRecipe(new ComparableStack(ModItems.pipette_laboratory, 1),new AStack[] { + new ComparableStack(ModBlocks.glass_boron, 2), + new OreDictStack(ANY_HARDPLASTIC.ingot(), 1), + new ComparableStack(ModItems.circuit_aluminium, 2) + }, 30); + makeRecipe(new ComparableStack(ModBlocks.turret_chekhov, 1), new AStack[] { new ComparableStack(ModBlocks.machine_battery, 1), new OreDictStack(STEEL.ingot(), 16), diff --git a/src/main/java/com/hbm/items/tool/ItemPipette.java b/src/main/java/com/hbm/items/tool/ItemPipette.java index f18bdd681..b59d6c42a 100644 --- a/src/main/java/com/hbm/items/tool/ItemPipette.java +++ b/src/main/java/com/hbm/items/tool/ItemPipette.java @@ -5,6 +5,7 @@ import api.hbm.fluid.IFillableItem; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; import com.hbm.items.ModItems; +import com.hbm.util.I18nUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -23,16 +24,13 @@ import java.util.List; public class ItemPipette extends Item implements IFillableItem { public ItemPipette() { - this.setMaxDamage(0); + this.canRepair = false; + this.setMaxDamage(1); } @SideOnly(Side.CLIENT) protected IIcon overlayIcon; - public int amount = this.getMaxFill(); - - public FluidType type = Fluids.NONE; - - public int getMaxFill() { + public short getMaxFill() { if(this == ModItems.pipette_laboratory) return 50; else @@ -43,24 +41,41 @@ public class ItemPipette extends Item implements IFillableItem { stack.stackTagCompound = new NBTTagCompound(); - this.setFill(stack, type, 0); + this.setFill(stack, Fluids.NONE, (short) 0); //sets "type" and "fill" NBT + stack.stackTagCompound.setShort("capacity", this.getMaxFill()); //set "capacity" } - public void setFill(ItemStack stack, FluidType type, int fill) { + public FluidType getType(ItemStack stack) { if(!stack.hasTagCompound()) { initNBT(stack); } - this.type = type; - stack.stackTagCompound.setInteger(type.getName(), fill); + return Fluids.fromID(stack.stackTagCompound.getShort("type")); } - public int getFill(ItemStack stack, FluidType type) { + public short getCapacity(ItemStack stack) { if(!stack.hasTagCompound()) { initNBT(stack); } - return stack.stackTagCompound.getInteger(type.getName()); + return stack.stackTagCompound.getShort("capacity"); + } + + public void setFill(ItemStack stack, FluidType type, short fill) { + if(!stack.hasTagCompound()) { + initNBT(stack); + } + + stack.stackTagCompound.setShort("type", (short) type.getID()); + stack.stackTagCompound.setShort("fill", fill); + } + + public short getFill(ItemStack stack) { + if(!stack.hasTagCompound()) { + initNBT(stack); + } + + return stack.stackTagCompound.getShort("fill"); } @Override @@ -71,17 +86,19 @@ public class ItemPipette extends Item implements IFillableItem { } if(!world.isRemote) { - if (this.getFill(stack, type) == 0) { - - if(this != ModItems.pipette_laboratory) - this.amount = player.isSneaking() ? Math.min(this.amount + 50, 1_000) : Math.max(this.amount - 50, 50); - else - this.amount = player.isSneaking() ? Math.min(this.amount + 1, 50) : Math.max(this.amount - 1, 1); - - - player.addChatMessage(new ChatComponentText(this.amount + "/" + this.getMaxFill() + "mB")); + // ok i need to add some explanation + if (this.getFill(stack) == 0) { //if the pipette is empty + int a; + if(this == ModItems.pipette_laboratory) //if the pipette is a laboratory pipette + //if the player is sneaking then the capacity should increase, else it should decrease (Math.min and Math.max for negative numbers/going over capacity) + a = player.isSneaking() ? Math.min(this.getCapacity(stack) + 1, 50) : Math.max(this.getCapacity(stack) - 1, 1); + else //if its not a laboratory pipette + //if the player is sneaking then the capacity should increase, else it should decrease + a = player.isSneaking() ? Math.min(this.getCapacity(stack) + 50, 1_000) : Math.max(this.getCapacity(stack) - 50, 50); + stack.stackTagCompound.setShort("capacity", (short) a); // set the capacity to the new value + player.addChatMessage(new ChatComponentText(a + "/" + this.getMaxFill() + "mB")); // send new value in chat for player to see } else { - player.addChatMessage(new ChatComponentText("Pipette not empty!")); + player.addChatMessage(new ChatComponentText(I18nUtil.resolveKey("desc.item.pipette.noEmpty"))); // if pipette is not empty, no chance in capacity and tell player } } return stack; @@ -89,17 +106,21 @@ public class ItemPipette extends Item implements IFillableItem { @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { - if(this == ModItems.pipette_laboratory) - list.add("Now with 50x more precision!"); - list.add("Fluid: " + type.getLocalizedName()); - list.add("Amount: " + this.getFill(stack, type) + "/" + amount + "mB (" + this.getMaxFill() + "mB)"); + if(this == ModItems.pipette_laboratory) { + list.add(I18nUtil.resolveKey("desc.item.pipette.corrosive")); + list.add(I18nUtil.resolveKey("desc.item.pipette.laboratory")); + } + if(this == ModItems.pipette_boron) + list.add(I18nUtil.resolveKey("desc.item.pipette.corrosive")); + if(this == ModItems.pipette) + list.add(I18nUtil.resolveKey("desc.item.pipette.noCorrosive")); + list.add("Fluid: " + this.getType(stack).getLocalizedName()); + list.add("Amount: " + this.getFill(stack) + "/" + this.getCapacity(stack) + "mB (" + this.getMaxFill() + "mB)"); } @Override public boolean acceptsFluid(FluidType type, ItemStack stack) { - if(this == ModItems.pipette_boron || this == ModItems.pipette_laboratory) - return (type == this.type || this.getFill(stack, type) == 0 && !type.isAntimatter()); - return (type == this.type || this.getFill(stack, type) == 0) && (!type.isCorrosive() && !type.isAntimatter()); + return (type == this.getType(stack) || this.getFill(stack) == 0) && (!type.isAntimatter()); } @Override @@ -108,27 +129,37 @@ public class ItemPipette extends Item implements IFillableItem { if(!acceptsFluid(type, stack)) return amount; - if(this.getFill(stack, type) == 0) - this.setFill(stack, type, 0); + if(this.getFill(stack) == 0) + this.setFill(stack, type, (short) 0); - int req = this.amount - this.getFill(stack, type); + int req = this.getCapacity(stack) - this.getFill(stack); int toFill = Math.min(req, amount); - this.setFill(stack, type, this.getFill(stack, type) + toFill); + this.setFill(stack, type, (short) (this.getFill(stack) + toFill)); + + //fizzling checks + if(this.getFill(stack) > 0 && (this.getType(stack).isCorrosive() && type != Fluids.ACID)) /*hydrogen peroxide corroding glass? unheard of! */ { + if(this == ModItems.pipette) { + //fizzle it! + stack.stackSize = 0; + } + } return amount - toFill; } @Override public boolean providesFluid(FluidType type, ItemStack stack) { - return this.type == type; + return this.getType(stack) == type; } @Override public int tryEmpty(FluidType type, int amount, ItemStack stack) { if(providesFluid(type, stack)) { - int toUnload = Math.min(amount, this.getFill(stack, type)); - this.setFill(stack, type,this.getFill(stack, type) - toUnload); + int toUnload = Math.min(amount, this.getFill(stack)); + this.setFill(stack, type,(short) (this.getFill(stack) - toUnload)); + if(this.getFill(stack) == 0) + this.setFill(stack, Fluids.NONE, (short) 0); return toUnload; } return amount; @@ -140,7 +171,10 @@ public class ItemPipette extends Item implements IFillableItem { @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister icon) { super.registerIcons(icon); - this.overlayIcon = icon.registerIcon("hbm:pipette_overlay"); + if (this == ModItems.pipette_laboratory) + this.overlayIcon = icon.registerIcon("hbm:pipette_laboratory_overlay"); + else + this.overlayIcon = icon.registerIcon("hbm:pipette_overlay"); } @Override @@ -161,7 +195,7 @@ public class ItemPipette extends Item implements IFillableItem { if(pass == 0) { return 0xffffff; } else { - int j = Fluids.fromID(stack.getItemDamage()).getColor(); + int j = this.getType(stack).getColor(); if(j < 0) { j = 0xffffff; diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 401e6b48f..b091bfe19 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -1003,7 +1003,11 @@ desc.item.kitArmor=Armor will be displaced by new set. desc.item.kitHaz=Armor will be displaced by hazmat suit. desc.item.kitPack=What a bargain! desc.item.kitPool=Please empty inventory before opening! -desc.item.pileRod=§eUse on drilled graphite to insert$§eUse screwdriver to extract$ +desc.item.pileRod=§eUse on drilled graphite to insert$§eUse screwdriver to extract$ +desc.item.pipette.corrosive=Can handle corrosive liquids. +desc.item.pipette.laboratory=Now with 50x more precision! +desc.item.pipette.noCorrosive=§eCannot handle corrosive liquids. +desc.item.pipette.noEmpty=§ePipette not empty! desc.item.rtgDecay=Decays to: %s desc.item.rtgHeat=Power Level: %s desc.item.storage.capacity=Capacity %s%%s diff --git a/src/main/resources/assets/hbm/textures/items/pipette.png b/src/main/resources/assets/hbm/textures/items/pipette.png index 00ebcd67423fdf013dbc4b3cac6c2339cb30d27a..b4c5c7e2275107903c7128234c030d494f8d342f 100644 GIT binary patch delta 172 zcmV;d08{_E0r~-uR)3F4L_t(IPh+4v*tBWWe-MUp85p57Q2?az+qZ9E_V3@n8De8& z8JWO5BEZRa|No2I_<}Wp3<1$Z1CVAYlVQb^|NrOBn+N9;1h>B+G=sprhp2qK0A2H@ z7bIwY^@9SN(KUno4P_Dr557`hGYBAuI7xm60hnfxlSy(m2qnOrPO?TA0NGBmlLrA{ aU;qH_#%$%hC*|}20000f{a-&hU7Mr9 z-ZnT%-yKvj~bQf3rCef$61IX{c} z3KoAQ7D}?H#XCKH%=%*1^t%d+`6ORsvcZlIEljf=87z-@elq4bVA4Ft zXVPXzhG!*{Ob;FS^|}22I1y13Hf{HNrE^*Ox&H$mRfI5V#aP P8AN%y`njxgN@xNA9nEF| literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/pipette_laboratory.png b/src/main/resources/assets/hbm/textures/items/pipette_laboratory.png new file mode 100644 index 0000000000000000000000000000000000000000..314f232058bce08647d5f447235165df72ac3620 GIT binary patch literal 366 zcmV-!0g?WRP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0Ru@yK~y+TV;~2V z?t1?p$|N78F1tazA?0hY!4-e`^5s8FbK?ASgbk_P`T(q`anGy&Ak8mcy!e0j?p?S> zMktLHH12-!zur{>tOlg<$B!QjfB*hv`1kK0SYB0Cm5~X|!U2#qS65e~XrA{}22A61 z0SJJc&BMdP0CYB3Gsuv+kHi_e-2@pskN^CS*MOzh{{MgToq@qe;2vDFhK2@;9%d+w z0cKxqQX2aKYzazlqk20gk@?PB>-Z0t2U+GQhw90J~e2Q!#9U2mk;8 M07*qoM6N<$f=Jh$AOHXW literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/pipette_laboratory_overlay.png b/src/main/resources/assets/hbm/textures/items/pipette_laboratory_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..8b1d9fef83cff6a7d8c78046da069a7ebd7e28db GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucK_yQY#}EtuWC_;A2_gwi-tzzdw;Oq~i)7aQ g>18@Qg^`VoK}VZA>h`1$&Op@+p00i_>zopr0Lt1Vo&W#< literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/pipette_overlay.png b/src/main/resources/assets/hbm/textures/items/pipette_overlay.png index 7615025c908ca3a3f87d77f8fc5cd59ff08ec233..c6bf6aadb19ac2f570b7dff1c3831c26b9c83d68 100644 GIT binary patch delta 144 zcmV;B0B`@F0p0-9G+qGG$j8FK@cai< z00}TcX`BG0`RgAB25z7My8Mh7>hZb&ruh>PW77-*I9))ZbN00{s|MNUMnLSTZ%Bs$dq delta 80 zcmcb|IG=Gsn5T)Si(`m|f3gJYVMYU|%$NuEQ`i{SWPOx$2r%Y&FiFA7n8Uy^GlpS( jS`5R@Z-EX11_lfaOzT+K;!VVu7=Xaj)z4*}Q$iB}0sa?} From 67d0b833c7bed23c70d6e63761073f05a18814b7 Mon Sep 17 00:00:00 2001 From: BallOfEnergy <66693744+BallOfEnergy1@users.noreply.github.com> Date: Sat, 6 Jan 2024 02:28:36 -0600 Subject: [PATCH 6/7] swapping the sneaking control for changing capacity, seems more natural to shift to decrease. --- src/main/java/com/hbm/items/tool/ItemPipette.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hbm/items/tool/ItemPipette.java b/src/main/java/com/hbm/items/tool/ItemPipette.java index b59d6c42a..a09ff9809 100644 --- a/src/main/java/com/hbm/items/tool/ItemPipette.java +++ b/src/main/java/com/hbm/items/tool/ItemPipette.java @@ -91,10 +91,10 @@ public class ItemPipette extends Item implements IFillableItem { int a; if(this == ModItems.pipette_laboratory) //if the pipette is a laboratory pipette //if the player is sneaking then the capacity should increase, else it should decrease (Math.min and Math.max for negative numbers/going over capacity) - a = player.isSneaking() ? Math.min(this.getCapacity(stack) + 1, 50) : Math.max(this.getCapacity(stack) - 1, 1); + a = !player.isSneaking() ? Math.min(this.getCapacity(stack) + 1, 50) : Math.max(this.getCapacity(stack) - 1, 1); else //if its not a laboratory pipette //if the player is sneaking then the capacity should increase, else it should decrease - a = player.isSneaking() ? Math.min(this.getCapacity(stack) + 50, 1_000) : Math.max(this.getCapacity(stack) - 50, 50); + a = !player.isSneaking() ? Math.min(this.getCapacity(stack) + 50, 1_000) : Math.max(this.getCapacity(stack) - 50, 50); stack.stackTagCompound.setShort("capacity", (short) a); // set the capacity to the new value player.addChatMessage(new ChatComponentText(a + "/" + this.getMaxFill() + "mB")); // send new value in chat for player to see } else { From 534daf7782919fb77e5a72e6af55fd27068ea7b4 Mon Sep 17 00:00:00 2001 From: BallOfEnergy <66693744+BallOfEnergy1@users.noreply.github.com> Date: Sun, 14 Jan 2024 14:15:46 -0600 Subject: [PATCH 7/7] changed lab pipette from assembler to anvil, fixed rubber shit, should be done (circuits are because its considered a "micropipette" and is therefore much more complex than a normal pipette.) --- src/main/java/com/hbm/crafting/ToolRecipes.java | 4 ++-- .../java/com/hbm/inventory/recipes/AssemblerRecipes.java | 6 ------ .../java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java | 7 +++++++ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/hbm/crafting/ToolRecipes.java b/src/main/java/com/hbm/crafting/ToolRecipes.java index 0247bd6cc..bc5cdd935 100644 --- a/src/main/java/com/hbm/crafting/ToolRecipes.java +++ b/src/main/java/com/hbm/crafting/ToolRecipes.java @@ -129,8 +129,8 @@ public class ToolRecipes { CraftingManager.addRecipeAuto(new ItemStack(ModItems.sat_designator, 1), new Object[] { "RRD", "PIC", " P", 'P', GOLD.plate(), 'R', Items.redstone, 'C', ModItems.circuit_gold, 'D', ModItems.sat_chip, 'I', GOLD.ingot() }); CraftingManager.addShapelessAuto(new ItemStack(ModItems.sat_relay), new Object[] { ModItems.sat_chip, ModItems.ducttape, ModItems.radar_linker }); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette, 1), new Object[] { " L", " G ", "G ", 'L', ModItems.ingot_biorubber, 'G', KEY_CLEARGLASS}); - CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette_boron, 1), new Object[] { " P", " B ", "B ", 'P', ANY_RUBBER.ingot(), 'B', ModBlocks.glass_boron}); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette, 1), new Object[] { " L", " G ", "G ", 'L', ANY_RUBBER.ingot(), 'G', KEY_CLEARGLASS}); + CraftingManager.addRecipeAuto(new ItemStack(ModItems.pipette_boron, 1), new Object[] { " P", " B ", "B ", 'P', RUBBER.ingot(), 'B', ModBlocks.glass_boron}); CraftingManager.addRecipeAuto(new ItemStack(ModItems.mirror_tool), new Object[] { " A ", " IA", "I ", 'A', AL.ingot(), 'I', IRON.ingot() }); CraftingManager.addRecipeAuto(new ItemStack(ModItems.rbmk_tool), new Object[] { " A ", " IA", "I ", 'A', PB.ingot(), 'I', IRON.ingot() }); diff --git a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java index cc918d0cc..315ac6eef 100644 --- a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java @@ -696,12 +696,6 @@ public class AssemblerRecipes { new ComparableStack(ModItems.motor, 2), }, 200); - makeRecipe(new ComparableStack(ModItems.pipette_laboratory, 1),new AStack[] { - new ComparableStack(ModBlocks.glass_boron, 2), - new OreDictStack(ANY_HARDPLASTIC.ingot(), 1), - new ComparableStack(ModItems.circuit_aluminium, 2) - }, 30); - makeRecipe(new ComparableStack(ModBlocks.turret_chekhov, 1), new AStack[] { new ComparableStack(ModBlocks.machine_battery, 1), new OreDictStack(STEEL.ingot(), 16), diff --git a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java index 86921434e..a5dd5e1ba 100644 --- a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java @@ -422,6 +422,13 @@ public class AnvilRecipes { new ComparableStack(Items.leather, 4), new ComparableStack(Items.feather, 24) }, new AnvilOutput(new ItemStack(ModItems.wings_limp))).setTier(2)); + + constructionRecipes.add(new AnvilConstructionRecipe( + new AStack[] { + new ComparableStack(ModBlocks.glass_boron, 2), + new OreDictStack(ANY_HARDPLASTIC.ingot(), 1), + new ComparableStack(ModItems.circuit_aluminium, 2) + }, new AnvilOutput(new ItemStack(ModItems.pipette_laboratory))).setTier(3)); constructionRecipes.add(new AnvilConstructionRecipe( new AStack[] {