diff --git a/assets/hbm/lang/de_DE.lang b/assets/hbm/lang/de_DE.lang index b817d3fb5..73a0d3d6c 100644 --- a/assets/hbm/lang/de_DE.lang +++ b/assets/hbm/lang/de_DE.lang @@ -4,8 +4,24 @@ itemGroup.tabBlocks=NTM Blöcke und Maschinen itemGroup.tabNuke=NTM Bomben und Ausrüstung itemGroup.tabMachine=NTM Vorlagen -achievement.getTitanium=Es ist ein Anfang -achievement.getTitanium.desc=Finde etwas Titanerz +hbmfluid.none=Nichts +hbmfluid.water=Wasser +hbmfluid.lava=Lava +hbmfluid.uf6=Uranhexafluorid +hbmfluid.puf6=Plutoniumhexafluorid +hbmfluid.deuterium=Deuterium +hbmfluid.tritium=Tritium +hbmfluid.oil=Rohöl +hbmfluid.smear=Industrieöl +hbmfluid.reclaimed=Wiederaufbetreitetes Industrieöl +hbmfluid.petroil=Gemisch +hbmfluid.lubricant=Schmiermittel +hbmfluid.diesel=Diesel +hbmfluid.kerosene=Kerosin +hbmfluid.gas=Erdgas +hbmfluid.coolant=Kühlflüssigkeit +hbmfluid.amat=Antimaterie +hbmfluid.aschrab=Antischrabidium item.record.lc.desc=Valve - Diabolic Adrenaline Guitar/Lambda Core item.record.ss.desc=Valve - Sector Sweep diff --git a/assets/hbm/lang/en_US.lang b/assets/hbm/lang/en_US.lang index b010200e5..0ee551e08 100644 --- a/assets/hbm/lang/en_US.lang +++ b/assets/hbm/lang/en_US.lang @@ -4,9 +4,6 @@ itemGroup.tabBlocks=NTM Blocks and Machines itemGroup.tabNuke=NTM Bombs and Gear itemGroup.tabMachine=NTM Templates -achievement.getTitanium=It's A Start -achievement.getTitanium.desc=Collect titanium ore - hbmfluid.none=None hbmfluid.water=Water hbmfluid.lava=Lava @@ -16,10 +13,15 @@ hbmfluid.deuterium=Deuterium hbmfluid.tritium=Tritium hbmfluid.oil=Crude Oil hbmfluid.smear=Industrial Oil +hbmfluid.reclaimed=Reclaimed Industrial Oil +hbmfluid.petroil=Petroil hbmfluid.lubricant=Engine Lubricant hbmfluid.diesel=Diesel hbmfluid.kerosene=Kerosene hbmfluid.gas=Natural Gas +hbmfluid.coolant=Coolant +hbmfluid.amat=Antimatter +hbmfluid.aschrab=Antischrabidium item.record.lc.desc=Valve - Diabolic Adrenaline Guitar/Lambda Core item.record.ss.desc=Valve - Sector Sweep diff --git a/assets/hbm/textures/gui/gui_nei_assembler.png b/assets/hbm/textures/gui/gui_nei_assembler.png new file mode 100644 index 000000000..d0fdbc18f Binary files /dev/null and b/assets/hbm/textures/gui/gui_nei_assembler.png differ diff --git a/assets/hbm/textures/gui/gui_nei_refinery.png b/assets/hbm/textures/gui/gui_nei_refinery.png index dc2c7f996..dd343b706 100644 Binary files a/assets/hbm/textures/gui/gui_nei_refinery.png and b/assets/hbm/textures/gui/gui_nei_refinery.png differ diff --git a/com/hbm/handler/AssemblerRecipeHandler.java b/com/hbm/handler/AssemblerRecipeHandler.java new file mode 100644 index 000000000..b3c6923c5 --- /dev/null +++ b/com/hbm/handler/AssemblerRecipeHandler.java @@ -0,0 +1,215 @@ +package com.hbm.handler; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import com.hbm.inventory.MachineRecipes; +import com.hbm.inventory.gui.GUIMachineAssembler; +import com.hbm.inventory.gui.GUIMachineCMBFactory; +import com.hbm.inventory.gui.GUIMachineShredder; +import com.hbm.inventory.gui.GUITestDiFurnace; +import com.hbm.lib.RefStrings; + +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.FurnaceRecipeHandler; +import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.recipe.FurnaceRecipeHandler.FuelPair; +import codechicken.nei.recipe.FurnaceRecipeHandler.SmeltingPair; +import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe; +import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; +import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRectHandler; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.gui.inventory.GuiFurnace; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.FurnaceRecipes; + +public class AssemblerRecipeHandler extends TemplateRecipeHandler { + + public LinkedList transferRectsRec = new LinkedList(); + public LinkedList transferRectsGui = new LinkedList(); + public LinkedList> guiRec = new LinkedList>(); + public LinkedList> guiGui = new LinkedList>(); + + public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe + { + PositionedStack input1; + PositionedStack input2; + PositionedStack input3; + PositionedStack input4; + PositionedStack input5; + PositionedStack input6; + PositionedStack input7; + PositionedStack input8; + PositionedStack input9; + PositionedStack input10; + PositionedStack input11; + PositionedStack input12; + PositionedStack template; + PositionedStack result; + + public SmeltingSet(ItemStack input1, ItemStack input2, ItemStack input3, + ItemStack input4, ItemStack input5, ItemStack input6, ItemStack input7, + ItemStack input8, ItemStack input9, ItemStack input10, ItemStack input11, + ItemStack input12, ItemStack template, ItemStack result) { + this.input1 = new PositionedStack(input1, 66 - 36, 6); + this.input2 = new PositionedStack(input2, 66 - 18, 6); + this.input3 = new PositionedStack(input3, 66, 6); + this.input4 = new PositionedStack(input4, 66 + 18, 6); + this.input5 = new PositionedStack(input5, 66 - 36, 6 + 18); + this.input6 = new PositionedStack(input6, 66 - 18, 6 + 18); + this.input7 = new PositionedStack(input7, 66, 6 + 18); + this.input8 = new PositionedStack(input8, 66 + 18, 6 + 18); + this.input9 = new PositionedStack(input9, 66 - 36, 6 + 36); + this.input10 = new PositionedStack(input10, 66 - 18, 6 + 36); + this.input11 = new PositionedStack(input11, 66, 6 + 36); + this.input12 = new PositionedStack(input12, 66 + 18, 6 + 36); + this.template = new PositionedStack(template, 66 + 45, 6); + this.result = new PositionedStack(result, 138, 24); + } + + public List getIngredients() { + return getCycledIngredients(cycleticks / 48, Arrays.asList(new PositionedStack[] {input1, input2, input3, input4, input5, input6, input7, input8, input9, input10, input11, input12, template})); + } + + public PositionedStack getResult() { + return result; + } + } + + @Override + public String getRecipeName() { + return "Assembler"; + } + + @Override + public String getGuiTexture() { + return RefStrings.MODID + ":textures/gui/gui_nei_assembler.png"; + } + + public void loadCraftingRecipes(String outputId, Object... results) { + if ((outputId.equals("assembly")) && getClass() == AssemblerRecipeHandler.class) { + Map recipes = MachineRecipes.instance().getAssemblyRecipes(); + for (Map.Entry recipe : recipes.entrySet()) { + this.arecipes.add(new SmeltingSet( + (ItemStack)recipe.getKey()[0], + (ItemStack)recipe.getKey()[1], + (ItemStack)recipe.getKey()[2], + (ItemStack)recipe.getKey()[3], + (ItemStack)recipe.getKey()[4], + (ItemStack)recipe.getKey()[5], + (ItemStack)recipe.getKey()[6], + (ItemStack)recipe.getKey()[7], + (ItemStack)recipe.getKey()[8], + (ItemStack)recipe.getKey()[9], + (ItemStack)recipe.getKey()[10], + (ItemStack)recipe.getKey()[11], + (ItemStack)recipe.getKey()[12], + (ItemStack)recipe.getValue())); + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + public void loadCraftingRecipes(ItemStack result) { + Map recipes = MachineRecipes.instance().getAssemblyRecipes(); + for (Map.Entry recipe : recipes.entrySet()) { + if (NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue(), result)) + this.arecipes.add(new SmeltingSet( + (ItemStack)recipe.getKey()[0], + (ItemStack)recipe.getKey()[1], + (ItemStack)recipe.getKey()[2], + (ItemStack)recipe.getKey()[3], + (ItemStack)recipe.getKey()[4], + (ItemStack)recipe.getKey()[5], + (ItemStack)recipe.getKey()[6], + (ItemStack)recipe.getKey()[7], + (ItemStack)recipe.getKey()[8], + (ItemStack)recipe.getKey()[9], + (ItemStack)recipe.getKey()[10], + (ItemStack)recipe.getKey()[11], + (ItemStack)recipe.getKey()[12], + (ItemStack)recipe.getValue())); + } + } + + public void loadUsageRecipes(String inputId, Object... ingredients) { + if ((inputId.equals("assembly")) && getClass() == AssemblerRecipeHandler.class) { + loadCraftingRecipes("assembly", new Object[0]); + } else { + super.loadUsageRecipes(inputId, ingredients); + } + } + + public void loadUsageRecipes(ItemStack ingredient) { + Map recipes = MachineRecipes.instance().getAssemblyRecipes(); + for (Map.Entry recipe : recipes.entrySet()) { + if (NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[0]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[1]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[2]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[3]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[4]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[5]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[6]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[7]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[8]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[9]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[10]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[11]) || + NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()[12])) + this.arecipes.add(new SmeltingSet( + (ItemStack)recipe.getKey()[0], + (ItemStack)recipe.getKey()[1], + (ItemStack)recipe.getKey()[2], + (ItemStack)recipe.getKey()[3], + (ItemStack)recipe.getKey()[4], + (ItemStack)recipe.getKey()[5], + (ItemStack)recipe.getKey()[6], + (ItemStack)recipe.getKey()[7], + (ItemStack)recipe.getKey()[8], + (ItemStack)recipe.getKey()[9], + (ItemStack)recipe.getKey()[10], + (ItemStack)recipe.getKey()[11], + (ItemStack)recipe.getKey()[12], + (ItemStack)recipe.getValue())); + } + } + + @Override + public Class getGuiClass() { + //return GUITestDiFurnace.class; + return null; + } + + @Override + public void loadTransferRects() { + transferRectsGui = new LinkedList(); + guiGui = new LinkedList>(); + + transferRects.add(new RecipeTransferRect(new Rectangle(138 - 1 - 36, 23, 36, 18), "assembly")); + transferRectsGui.add(new RecipeTransferRect(new Rectangle(18 * 2 + 2, 89 - 7 - 11, 18 * 5 - 4, 18 + 16), "assembly")); + guiGui.add(GUIMachineAssembler.class); + RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects); + RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui); + } + + @Override + public void drawExtras(int recipe) { + + drawProgressBar(83 - (18 * 4) - 9 + 1, 6, 0, 86, 16, 18 * 3 - 2, 480, 7); + + drawProgressBar(83 - 3 + 16 + 5, 5 + 18, 16, 86, 36, 18, 48, 0); + } + + @Override + public TemplateRecipeHandler newInstance() { + return super.newInstance(); + } + +} diff --git a/com/hbm/handler/FluidTypeHandler.java b/com/hbm/handler/FluidTypeHandler.java index 83b128db8..9d4d1553f 100644 --- a/com/hbm/handler/FluidTypeHandler.java +++ b/com/hbm/handler/FluidTypeHandler.java @@ -5,13 +5,24 @@ import com.hbm.items.tool.ItemAssemblyTemplate.EnumAssemblyTemplate; public class FluidTypeHandler { public enum FluidType { - NONE(0x888888, 8947848, 0, 0, "hbmfluid.none"), WATER(0x3333FF, 3355647, 1, 0, "hbmfluid.water"), - LAVA(0xFF3300, 16724736, 2, 0, "hbmfluid.lava"), UF6(0xD1CEBE, 13749950, 3, 0, "hbmfluid.uf6"), - PUF6(0x4C4C4C, 5000268, 0, 1, "hbmfluid.puf6"), DEUTERIUM(0x0000FF, 255, 1, 1, "hbmfluid.deuterium"), - TRITIUM(0x000099, 153, 2, 1, "hbmfluid.tritium"), OIL(0x020202, 131586, 3, 1, "hbmfluid.oil"), - SMEAR(0x190f01, 1642241, 0, 2, "hbmfluid.smear"), LUBRICANT(0x606060, 6316128, 1, 2, "hbmfluid.lubricant"), - DIESEL(0xf2eed5, 15920853, 2, 2, "hbmfluid.diesel"), KEROSENE(0xffa5d2, 16754130, 3, 2, "hbmfluid.kerosene"), - GAS(0xfffeed, 16776941, 0, 3, "hbmfluid.gas"); + NONE (0x888888, 8947848, 0, 0, "hbmfluid.none"), + WATER (0x3333FF, 3355647, 1, 0, "hbmfluid.water"), + COOLANT (0xd8fcff, 14220543, 1, 0, "hbmfluid.coolant"), + LAVA (0xFF3300, 16724736, 2, 0, "hbmfluid.lava"), + DEUTERIUM (0x0000FF, 255, 1, 1, "hbmfluid.deuterium"), + TRITIUM (0x000099, 153, 2, 1, "hbmfluid.tritium"), + OIL (0x020202, 131586, 3, 1, "hbmfluid.oil"), + SMEAR (0x190f01, 1642241, 0, 2, "hbmfluid.smear"), + RECLAIMED (0x332b22, 3353378, 1, 3, "hbmfluid.reclaimed"), + PETROIL (0x44413d, 4473149, 2, 3, "hbmfluid.petroil"), + LUBRICANT (0x606060, 6316128, 1, 2, "hbmfluid.lubricant"), + DIESEL (0xf2eed5, 15920853, 2, 2, "hbmfluid.diesel"), + KEROSENE (0xffa5d2, 16754130, 3, 2, "hbmfluid.kerosene"), + GAS (0xfffeed, 16776941, 0, 3, "hbmfluid.gas"), + UF6 (0xD1CEBE, 13749950, 3, 0, "hbmfluid.uf6"), + PUF6 (0x4C4C4C, 5000268, 0, 1, "hbmfluid.puf6"), + AMAT (0x010101, 65793, 3, 0, "hbmfluid.amat"), + ASCHRAB (0xb50000, 11862016, 0, 1, "hbmfluid.aschrab"); private int color; private int msa; diff --git a/com/hbm/handler/RefineryRecipeHandler.java b/com/hbm/handler/RefineryRecipeHandler.java new file mode 100644 index 000000000..5264f0c92 --- /dev/null +++ b/com/hbm/handler/RefineryRecipeHandler.java @@ -0,0 +1,145 @@ +package com.hbm.handler; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import com.hbm.handler.AlloyFurnaceRecipeHandler.Fuel; +import com.hbm.handler.AlloyFurnaceRecipeHandler.SmeltingSet; +import com.hbm.inventory.MachineRecipes; +import com.hbm.inventory.gui.GUIMachineAssembler; +import com.hbm.inventory.gui.GUIMachineCentrifuge; +import com.hbm.inventory.gui.GUITestDiFurnace; +import com.hbm.lib.RefStrings; + +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.FurnaceRecipeHandler; +import codechicken.nei.recipe.TemplateRecipeHandler; +import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRect; +import codechicken.nei.recipe.TemplateRecipeHandler.RecipeTransferRectHandler; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; + +public class RefineryRecipeHandler extends TemplateRecipeHandler { + + public LinkedList transferRectsRec = new LinkedList(); + public LinkedList transferRectsGui = new LinkedList(); + public LinkedList> guiRec = new LinkedList>(); + public LinkedList> guiGui = new LinkedList>(); + + public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe + { + PositionedStack input; + PositionedStack result1; + PositionedStack result2; + PositionedStack result3; + PositionedStack result4; + PositionedStack result5; + + public SmeltingSet(ItemStack input, ItemStack result1, ItemStack result2, ItemStack result3, ItemStack result4, ItemStack result5) { + input.stackSize = 1; + this.input = new PositionedStack(input, 21 + 27, 6 + 18); + this.result1 = new PositionedStack(result1, 129 - 18, 6); + this.result2 = new PositionedStack(result2, 147 - 18, 6 + 9); + this.result3 = new PositionedStack(result3, 129 - 18, 42 - 18); + this.result4 = new PositionedStack(result4, 147 - 18, 42 - 9); + this.result5 = new PositionedStack(result5, 147 - 36, 42); + } + + public List getIngredients() { + return getCycledIngredients(cycleticks / 48, Arrays.asList(new PositionedStack[] {input})); + } + + public List getOtherStacks() { + List stacks = new ArrayList(); + stacks.add(result2); + stacks.add(result3); + stacks.add(result4); + stacks.add(result5); + return stacks; + } + + public PositionedStack getResult() { + return result1; + } + } + + @Override + public String getRecipeName() { + return "Refinery"; + } + + @Override + public String getGuiTexture() { + return RefStrings.MODID + ":textures/gui/gui_nei_refinery.png"; + } + + @Override + public Class getGuiClass() { + return null; + } + + @Override + public TemplateRecipeHandler newInstance() { + return super.newInstance(); + } + + public void loadCraftingRecipes(String outputId, Object... results) { + if ((outputId.equals("refinery")) && getClass() == RefineryRecipeHandler.class) { + Map recipes = MachineRecipes.instance().getRefineryRecipe(); + for (Map.Entry recipe : recipes.entrySet()) { + this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(), (ItemStack)recipe.getValue()[0], (ItemStack)recipe.getValue()[1], (ItemStack)recipe.getValue()[2], (ItemStack)recipe.getValue()[3], (ItemStack)recipe.getValue()[4])); + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + public void loadCraftingRecipes(ItemStack result) { + Map recipes = MachineRecipes.instance().getRefineryRecipe(); + for (Map.Entry recipe : recipes.entrySet()) { + if (NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[0], result) || NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[1], result) || NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[2], result) || NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[3], result) || NEIServerUtils.areStacksSameType((ItemStack)recipe.getValue()[4], result)) + this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(), (ItemStack)recipe.getValue()[0], (ItemStack)recipe.getValue()[1], (ItemStack)recipe.getValue()[2], (ItemStack)recipe.getValue()[3], (ItemStack)recipe.getValue()[4])); + } + } + + public void loadUsageRecipes(String inputId, Object... ingredients) { + if ((inputId.equals("refinery")) && getClass() == RefineryRecipeHandler.class) { + loadCraftingRecipes("refinery", new Object[0]); + } else { + super.loadUsageRecipes(inputId, ingredients); + } + } + + public void loadUsageRecipes(ItemStack ingredient) { + Map recipes = MachineRecipes.instance().getRefineryRecipe(); + for (Map.Entry recipe : recipes.entrySet()) { + if (NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey())) + this.arecipes.add(new SmeltingSet((ItemStack)recipe.getKey(), (ItemStack)recipe.getValue()[0], (ItemStack)recipe.getValue()[1], (ItemStack)recipe.getValue()[2], (ItemStack)recipe.getValue()[3], (ItemStack)recipe.getValue()[4])); + } + } + + @Override + public void drawExtras(int recipe) { + drawProgressBar(83 - (18 * 4) - 9 + 1, 6, 0, 86, 16, 18 * 3 - 2, 480, 7); + + drawProgressBar(56 + 22, 5 + 19, 16, 86, 24, 17, 48, 0); + } + + @Override + public void loadTransferRects() { + transferRectsGui = new LinkedList(); + guiGui = new LinkedList>(); + + transferRects.add(new RecipeTransferRect(new Rectangle(138 - 1 - 36, 23, 36, 18), "refinery")); + transferRectsGui.add(new RecipeTransferRect(new Rectangle(18 * 2 + 2, 89 - 7 - 11, 18 * 5 - 4, 18 + 16), "refinery")); + guiGui.add(GUIMachineAssembler.class); + RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects); + RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui); + } + +} diff --git a/com/hbm/interfaces/IFluidContainer.java b/com/hbm/interfaces/IFluidContainer.java index e153dc986..f134cef58 100644 --- a/com/hbm/interfaces/IFluidContainer.java +++ b/com/hbm/interfaces/IFluidContainer.java @@ -1,8 +1,13 @@ package com.hbm.interfaces; +import com.hbm.handler.FluidTypeHandler.FluidType; + public interface IFluidContainer { - + //Args: fill, what the fill should be set to; index, index for array if there are multiple tanks public void setFillstate(int fill, int index); + + //Args: type, what the type should be set to; index, index for array if there are multiple tanks + public void setType(FluidType type, int index); } diff --git a/com/hbm/inventory/FluidContainerRegistry.java b/com/hbm/inventory/FluidContainerRegistry.java index 4f66a366f..beb11bd58 100644 --- a/com/hbm/inventory/FluidContainerRegistry.java +++ b/com/hbm/inventory/FluidContainerRegistry.java @@ -41,7 +41,9 @@ public class FluidContainerRegistry { sta.stackSize = 1; for(FluidContainer container : instance.allContainers) { - if(container.type.name().equals(type.name()) && getEmptyContainer(sta) != null) + if(container.type.name().equals(type.name()) && + ItemStack.areItemStacksEqual(container.fullContainer, sta) && + ItemStack.areItemStackTagsEqual(container.fullContainer, sta)) return container.content; } diff --git a/com/hbm/inventory/FluidTank.java b/com/hbm/inventory/FluidTank.java index 13e577f16..81f65b034 100644 --- a/com/hbm/inventory/FluidTank.java +++ b/com/hbm/inventory/FluidTank.java @@ -5,6 +5,7 @@ import java.util.Arrays; import com.hbm.handler.FluidTypeHandler.FluidType; import com.hbm.inventory.gui.GuiFluidContainer; import com.hbm.items.ModItems; +import com.hbm.items.tool.ItemFluidIdentifier; import com.hbm.packet.PacketDispatcher; import com.hbm.packet.TEAssemblerPacket; import com.hbm.packet.TEFluidPacket; @@ -33,10 +34,14 @@ public class FluidTank { fluid = i; } + public void setTankType(FluidType type) { + this.type = type; + } + //Called on TE update public void updateTank(int x, int y, int z) { - PacketDispatcher.wrapper.sendToAll(new TEFluidPacket(x, y, z, fluid, index)); + PacketDispatcher.wrapper.sendToAll(new TEFluidPacket(x, y, z, fluid, index, type)); } //Fills tank from canisters @@ -91,6 +96,20 @@ public class FluidTank { } } + //Changes tank type + public void setType(int in, int out, ItemStack[] slots) { + + if(slots[in] != null && slots[out] == null && slots[in].getItem() instanceof ItemFluidIdentifier) { + FluidType newType = ItemFluidIdentifier.getType(slots[in].copy()); + if(!type.name().equals(newType.name())) { + type = newType; + slots[out] = slots[in].copy(); + slots[in] = null; + fluid = 0; + } + } + } + //Used in the GUI rendering, renders correct fluid type in container with progress public void renderTank(GuiContainer gui, int x, int y, int tx, int ty, int width, int height) { diff --git a/com/hbm/inventory/MachineRecipes.java b/com/hbm/inventory/MachineRecipes.java index 8ca7e8f7d..9cac2f24e 100644 --- a/com/hbm/inventory/MachineRecipes.java +++ b/com/hbm/inventory/MachineRecipes.java @@ -2023,8 +2023,9 @@ public class MachineRecipes { list.add(new ItemStack(ModItems.ingot_steel, 6)); list.add(new ItemStack(ModItems.plate_lead, 8)); list.add(new ItemStack(ModItems.plate_copper, 4)); - list.add(new ItemStack(ModItems.rod_lead, 12)); + list.add(new ItemStack(ModItems.ingot_lead, 12)); list.add(new ItemStack(ModItems.ingot_red_copper, 6)); + list.add(new ItemStack(ModItems.circuit_copper, 8)); list.add(new ItemStack(ModItems.circuit_red_copper, 4)); break; case INDUSTRIAL_GENERATOR: @@ -2036,6 +2037,7 @@ public class MachineRecipes { list.add(new ItemStack(ModItems.wire_gold, 8)); list.add(new ItemStack(ModBlocks.red_wire_coated, 2)); list.add(new ItemStack(ModItems.pedestal_steel, 2)); + list.add(new ItemStack(ModItems.circuit_copper, 4)); break; case CYCLOTRON: list.add(new ItemStack(ModItems.cyclotron_tower, 1)); @@ -2076,7 +2078,7 @@ public class MachineRecipes { list.add(new ItemStack(ModItems.plate_steel, 4)); list.add(new ItemStack(ModItems.motor, 2)); list.add(new ItemStack(ModItems.wire_red_copper, 2)); - list.add(new ItemStack(ModBlocks.steel_poles, 2)); + list.add(new ItemStack(ModBlocks.steel_beam, 2)); list.add(new ItemStack(Blocks.iron_bars, 2)); list.add(new ItemStack(ModBlocks.red_wire_coated, 1)); break; @@ -2089,7 +2091,7 @@ public class MachineRecipes { break; case DERRICK: list.add(new ItemStack(ModBlocks.steel_scaffold, 20)); - list.add(new ItemStack(ModBlocks.steel_poles, 8)); + list.add(new ItemStack(ModBlocks.steel_beam, 8)); list.add(new ItemStack(ModItems.tank_steel, 2)); list.add(new ItemStack(ModItems.motor, 1)); list.add(new ItemStack(ModItems.pipes_steel, 3)); @@ -2461,4 +2463,41 @@ public class MachineRecipes { return output; } + + public Map getAssemblyRecipes() { + + Map recipes = new HashMap(); + + for (int i = 0; i < EnumAssemblyTemplate.values().length; ++i) + { + ItemStack[] array = new ItemStack[13]; + array[12] = new ItemStack(ModItems.assembly_template, 1, i); + List list = MachineRecipes.getRecipeFromTempate(array[12]); + + for(int j = 0; j < list.size(); j++) + array[j] = list.get(j).copy(); + + for(int j = 0; j < 12; j++) + if(array[j] == null) + array[j] = new ItemStack(ModItems.nothing); + + recipes.put(array, MachineRecipes.getOutputFromTempate(array[12])); + } + + return recipes; + } + + public Map getRefineryRecipe() { + + Map recipes = new HashMap(); + + recipes.put(new ItemStack(ModItems.canister_oil, 1) , new ItemStack[] { + new ItemStack(ModItems.canister_smear, 1), + new ItemStack(ModItems.canister_canola, 1), + new ItemStack(ModItems.canister_fuel, 1), + new ItemStack(ModItems.canister_kerosene, 1), + new ItemStack(ModItems.sulfur, 1) }); + + return recipes; + } } diff --git a/com/hbm/items/tool/ItemAssemblyTemplate.java b/com/hbm/items/tool/ItemAssemblyTemplate.java index 5e164f34e..ed405500c 100644 --- a/com/hbm/items/tool/ItemAssemblyTemplate.java +++ b/com/hbm/items/tool/ItemAssemblyTemplate.java @@ -342,6 +342,8 @@ public class ItemAssemblyTemplate extends Item { if(stacks.get(i) != null) list.add(stacks.get(i).stackSize + "x " + stacks.get(i).getDisplayName()); } + list.add("Production time:"); + list.add(Math.floor((float)(getProcessTime(stack)) / 20 * 100) / 100 + " seconds"); } catch(Exception e) { list.add("###INVALID###"); list.add("0x334077-0x6A298F-0xDF3795-0x334077"); diff --git a/com/hbm/items/tool/ItemFluidIdentifier.java b/com/hbm/items/tool/ItemFluidIdentifier.java index 6177ca9f0..b648950b4 100644 --- a/com/hbm/items/tool/ItemFluidIdentifier.java +++ b/com/hbm/items/tool/ItemFluidIdentifier.java @@ -77,6 +77,13 @@ public class ItemFluidIdentifier extends Item { list.add(" " + I18n.format(FluidType.getEnum(stack.getItemDamage()).getUnlocalizedName())); } + public static FluidType getType(ItemStack stack) { + if(stack != null && stack.getItem() instanceof ItemFluidIdentifier) + return FluidType.getEnum(stack.getItemDamage()); + else + return FluidType.NONE; + } + @Override public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int i, float f1, float f2, float f3) { diff --git a/com/hbm/main/ClientProxy.java b/com/hbm/main/ClientProxy.java index 6b9049c71..9eeb37a68 100644 --- a/com/hbm/main/ClientProxy.java +++ b/com/hbm/main/ClientProxy.java @@ -142,6 +142,7 @@ import com.hbm.render.item.ItemRenderMP; import com.hbm.render.item.ItemRenderMP40; import com.hbm.render.item.ItemRenderMiniNuke; import com.hbm.render.item.ItemRenderMultitool; +import com.hbm.render.item.ItemRenderNukeGadget; import com.hbm.render.item.ItemRenderOSIPR; import com.hbm.render.item.ItemRenderOverkill; import com.hbm.render.item.ItemRenderPoleTop; @@ -272,6 +273,7 @@ public class ClientProxy extends ServerProxy ClientRegistry.bindTileEntitySpecialRenderer(TileEntityObjTester.class, new RendererObjTester()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityNukeGadget.class, new RenderNukeGadget()); + //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.nuke_gadget), new ItemRenderNukeGadget()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityNukeBoy.class, new RenderNukeBoy()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityNukeCustom.class, new RenderNukeCustom()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineCentrifuge.class, new RenderCentrifuge()); diff --git a/com/hbm/main/MainRegistry.java b/com/hbm/main/MainRegistry.java index da90f55fd..da925dc90 100644 --- a/com/hbm/main/MainRegistry.java +++ b/com/hbm/main/MainRegistry.java @@ -788,18 +788,34 @@ public class MainRegistry recipes.PrintRecipes(); - FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.canister_oil), new ItemStack(ModItems.canister_empty), FluidType.LAVA, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(Items.water_bucket), new ItemStack(Items.bucket), FluidType.WATER, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(Items.lava_bucket), new ItemStack(Items.bucket), FluidType.LAVA, 1000)); + + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.rod_water), new ItemStack(ModItems.rod_empty), FluidType.WATER, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.rod_dual_water), new ItemStack(ModItems.rod_dual_empty), FluidType.WATER, 2000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.rod_quad_water), new ItemStack(ModItems.rod_quad_empty), FluidType.WATER, 4000)); + + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.rod_coolant), new ItemStack(ModItems.rod_empty), FluidType.COOLANT, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.rod_dual_coolant), new ItemStack(ModItems.rod_dual_empty), FluidType.COOLANT, 2000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.rod_quad_coolant), new ItemStack(ModItems.rod_quad_empty), FluidType.COOLANT, 4000)); + + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.canister_oil), new ItemStack(ModItems.canister_empty), FluidType.OIL, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.canister_smear), new ItemStack(ModItems.canister_empty), FluidType.SMEAR, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.canister_reoil), new ItemStack(ModItems.canister_empty), FluidType.RECLAIMED, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.canister_petroil), new ItemStack(ModItems.canister_empty), FluidType.PETROIL, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.canister_canola), new ItemStack(ModItems.canister_empty), FluidType.LUBRICANT, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.canister_fuel), new ItemStack(ModItems.canister_empty), FluidType.DIESEL, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.canister_kerosene), new ItemStack(ModItems.canister_empty), FluidType.KEROSENE, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.cell_deuterium), new ItemStack(ModItems.cell_empty), FluidType.DEUTERIUM, 1000)); FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.cell_tritium), new ItemStack(ModItems.cell_empty), FluidType.TRITIUM, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.rod_tritium), new ItemStack(ModItems.rod_empty), FluidType.TRITIUM, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.rod_dual_tritium), new ItemStack(ModItems.rod_dual_empty), FluidType.TRITIUM, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.rod_quad_tritium), new ItemStack(ModItems.rod_quad_empty), FluidType.TRITIUM, 1000)); FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.cell_uf6), new ItemStack(ModItems.cell_empty), FluidType.UF6, 1000)); FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.cell_puf6), new ItemStack(ModItems.cell_empty), FluidType.PUF6, 1000)); - - /*System.out.println(FluidContainerRegistry.getEmptyContainer(new ItemStack(ModItems.cell_deuterium))); //cell_empty - System.out.println(FluidContainerRegistry.getEmptyContainer(new ItemStack(ModItems.board_copper))); //null - System.out.println(FluidContainerRegistry.getFluidContent(new ItemStack(ModItems.cell_deuterium), FluidType.DEUTERIUM)); //1000 - System.out.println(FluidContainerRegistry.getFluidContent(new ItemStack(ModItems.cell_deuterium), FluidType.WATER)); //0 - System.out.println(FluidContainerRegistry.containsFluid(new ItemStack(ModItems.cell_deuterium), FluidType.DEUTERIUM)); //true - System.out.println(FluidContainerRegistry.containsFluid(new ItemStack(ModItems.cell_deuterium), FluidType.WATER)); //false*/ + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.cell_antimatter), new ItemStack(ModItems.cell_empty), FluidType.AMAT, 1000)); + FluidContainerRegistry.instance.registerContainer(new FluidContainer(new ItemStack(ModItems.cell_anti_schrabidium), new ItemStack(ModItems.cell_empty), FluidType.ASCHRAB, 1000)); } @EventHandler diff --git a/com/hbm/main/NEIConfig.java b/com/hbm/main/NEIConfig.java index 18879cf2d..1004fd97b 100644 --- a/com/hbm/main/NEIConfig.java +++ b/com/hbm/main/NEIConfig.java @@ -2,10 +2,12 @@ package com.hbm.main; import com.hbm.blocks.ModBlocks; import com.hbm.handler.AlloyFurnaceRecipeHandler; +import com.hbm.handler.AssemblerRecipeHandler; import com.hbm.handler.CMBFurnaceRecipeHandler; import com.hbm.handler.CentrifugeRecipeHandler; import com.hbm.handler.CyclotronRecipeHandler; import com.hbm.handler.ReactorRecipeHandler; +import com.hbm.handler.RefineryRecipeHandler; import com.hbm.handler.ShredderRecipeHandler; import com.hbm.inventory.gui.GUITestDiFurnace; import com.hbm.items.ModItems; @@ -32,6 +34,10 @@ public class NEIConfig implements IConfigureNEI { API.registerUsageHandler(new CMBFurnaceRecipeHandler()); API.registerRecipeHandler(new CyclotronRecipeHandler()); API.registerUsageHandler(new CyclotronRecipeHandler()); + API.registerRecipeHandler(new AssemblerRecipeHandler()); + API.registerUsageHandler(new AssemblerRecipeHandler()); + API.registerRecipeHandler(new RefineryRecipeHandler()); + API.registerUsageHandler(new RefineryRecipeHandler()); //Some things are even beyond my control...or are they? API.hideItem(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_coal_on))); diff --git a/com/hbm/packet/LoopedSoundPacket.java b/com/hbm/packet/LoopedSoundPacket.java index b813d7f75..a6203e3d3 100644 --- a/com/hbm/packet/LoopedSoundPacket.java +++ b/com/hbm/packet/LoopedSoundPacket.java @@ -12,6 +12,8 @@ import com.hbm.tileentity.TileEntityPylonRedWire; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.tileentity.TileEntity; @@ -52,10 +54,11 @@ public class LoopedSoundPacket implements IMessage { public static class Handler implements IMessageHandler { @Override + //Tamaized, I love you! + @SideOnly(Side.CLIENT) public IMessage onMessage(LoopedSoundPacket m, MessageContext ctx) { TileEntity te = Minecraft.getMinecraft().theWorld.getTileEntity(m.x, m.y, m.z); - try { if (te != null && te instanceof TileEntityMachineMiningDrill) { boolean flag = true; @@ -64,11 +67,8 @@ public class LoopedSoundPacket implements IMessage { flag = false; } - //if(flag && te.getWorldObj().isRemote) - // Minecraft.getMinecraft(). - } - } catch(Exception ex) { - System.out.println("Sorry folks, not today."); + if(flag && te.getWorldObj().isRemote && ((TileEntityMachineMiningDrill)te).torque > 0.2F) + Minecraft.getMinecraft().getSoundHandler().playSound(new SoundLoopMiner(new ResourceLocation("hbm:block.minerOperate"), te)); } return null; } diff --git a/com/hbm/packet/PacketDispatcher.java b/com/hbm/packet/PacketDispatcher.java index 8d92fd706..e30530e97 100644 --- a/com/hbm/packet/PacketDispatcher.java +++ b/com/hbm/packet/PacketDispatcher.java @@ -35,7 +35,7 @@ public class PacketDispatcher { wrapper.registerMessage(TEMissilePacket.Handler.class, TEMissilePacket.class, i++, Side.CLIENT); //Fluid packet for GUI wrapper.registerMessage(TEFluidPacket.Handler.class, TEFluidPacket.class, i++, Side.CLIENT); - //Sound packet that keeps client and server seperated + //Sound packet that keeps client and server separated wrapper.registerMessage(LoopedSoundPacket.Handler.class, LoopedSoundPacket.class, i++, Side.CLIENT); } diff --git a/com/hbm/packet/TEFluidPacket.java b/com/hbm/packet/TEFluidPacket.java index 25779690c..eab5d07dc 100644 --- a/com/hbm/packet/TEFluidPacket.java +++ b/com/hbm/packet/TEFluidPacket.java @@ -1,8 +1,10 @@ package com.hbm.packet; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import com.hbm.handler.FluidTypeHandler.FluidType; import com.hbm.interfaces.IFluidContainer; import com.hbm.tileentity.TileEntityMachineAssembler; import com.hbm.tileentity.TileEntityMachineIGenerator; @@ -23,19 +25,21 @@ public class TEFluidPacket implements IMessage { int z; int fill; int index; + int type; public TEFluidPacket() { } - public TEFluidPacket(int x, int y, int z, int fill, int index) + public TEFluidPacket(int x, int y, int z, int fill, int index, FluidType type) { this.x = x; this.y = y; this.z = z; this.fill = fill; this.index = index; + this.type = Arrays.asList(FluidType.values()).indexOf(type); } @Override @@ -45,6 +49,7 @@ public class TEFluidPacket implements IMessage { z = buf.readInt(); fill = buf.readInt(); index = buf.readInt(); + type = buf.readInt(); } @Override @@ -54,6 +59,7 @@ public class TEFluidPacket implements IMessage { buf.writeInt(z); buf.writeInt(fill); buf.writeInt(index); + buf.writeInt(type); } public static class Handler implements IMessageHandler { @@ -66,6 +72,7 @@ public class TEFluidPacket implements IMessage { IFluidContainer gen = (IFluidContainer) te; gen.setFillstate(m.fill, m.index); + gen.setType(FluidType.getEnum(m.type), m.index); } return null; } diff --git a/com/hbm/render/item/ItemRenderNukeGadget.java b/com/hbm/render/item/ItemRenderNukeGadget.java index 62df3db47..8dbeb2c50 100644 --- a/com/hbm/render/item/ItemRenderNukeGadget.java +++ b/com/hbm/render/item/ItemRenderNukeGadget.java @@ -40,9 +40,6 @@ public class ItemRenderNukeGadget implements IItemRenderer { @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { - f += 0.1F; - if(f > 1.0F) - f = -1.0F; switch(type) { case EQUIPPED: case EQUIPPED_FIRST_PERSON: diff --git a/com/hbm/tileentity/TileEntityMachineMiningDrill.java b/com/hbm/tileentity/TileEntityMachineMiningDrill.java index fb98db486..336824b68 100644 --- a/com/hbm/tileentity/TileEntityMachineMiningDrill.java +++ b/com/hbm/tileentity/TileEntityMachineMiningDrill.java @@ -56,7 +56,7 @@ public class TileEntityMachineMiningDrill extends TileEntity implements ISidedIn boolean flag = true; public float torque; public float rotation; - //SoundLoopMachine sound; + SoundLoopMachine sound; private static final int[] slots_top = new int[] {1}; private static final int[] slots_bottom = new int[] {2, 0}; @@ -461,24 +461,8 @@ public class TileEntityMachineMiningDrill extends TileEntity implements ISidedIn PacketDispatcher.wrapper.sendToAll(new TEDrillPacket(xCoord, yCoord, zCoord, rotation)); PacketDispatcher.wrapper.sendToAll(new TEDrillSoundPacket(xCoord, yCoord, zCoord, torque)); - //PacketDispatcher.wrapper.sendToAll(new LoopedSoundPacket(xCoord, yCoord, zCoord)); + PacketDispatcher.wrapper.sendToAll(new LoopedSoundPacket(xCoord, yCoord, zCoord)); } - - /*if(worldObj.isRemote) { - if(torque > 0) { - if(sound == null) { - sound = new SoundLoopMachine(new ResourceLocation("hbm:block.minerOperate"), this); - sound.setVolume(2.5F); - Minecraft.getMinecraft().getSoundHandler().playSound(sound); - } - } else { - if(sound != null) { - sound.stop(); - sound = null; - } - } - }*/ - } public boolean tryFillContainer(IInventory inventory, int slot) { @@ -534,6 +518,9 @@ public class TileEntityMachineMiningDrill extends TileEntity implements ISidedIn return false; } + //Method: isOre + //"make it oreo!" + //"ok" public boolean isOreo(int x, int y, int z) { Block b = worldObj.getBlock(x, y, z); diff --git a/com/hbm/tileentity/TileEntityMachineUF6Tank.java b/com/hbm/tileentity/TileEntityMachineUF6Tank.java index efac1cf4d..a6f559717 100644 --- a/com/hbm/tileentity/TileEntityMachineUF6Tank.java +++ b/com/hbm/tileentity/TileEntityMachineUF6Tank.java @@ -193,6 +193,7 @@ public class TileEntityMachineUF6Tank extends TileEntity implements ISidedInvent if(!worldObj.isRemote) { tank.loadTank(0, 1, slots); + tank.setType(0, 1, slots); tank.unloadTank(2, 3, slots); tank.updateTank(xCoord, yCoord, zCoord); } @@ -214,4 +215,9 @@ public class TileEntityMachineUF6Tank extends TileEntity implements ISidedInvent public void setFillstate(int fill, int index) { tank.setFill(fill); } + + @Override + public void setType(FluidType type, int index) { + tank.setTankType(type); + } }