From 05c78126859231a68e199dc34613689bd0978e2f Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Mon, 11 Apr 2016 19:44:54 +0300 Subject: Initial commit --- .../AchesonFurnaceRecipeHandler.java | 98 ++++ .../ChemicalReactorRecipeHandler.java | 140 ++++++ ihl/nei_integration/ChimneyKneeRecipeHandler.java | 73 +++ ihl/nei_integration/CrucibleRecipeHandler.java | 86 ++++ .../CryogenicDistillerRecipeHandler.java | 111 +++++ .../DetonationSprayingMachineRecipeHandler.java | 88 ++++ .../ElectricEvaporatorRecipeHandler.java | 81 ++++ .../ElectrolysisBathRecipeHandler.java | 74 +++ ihl/nei_integration/EvaporatorRecipeHandler.java | 80 ++++ ihl/nei_integration/ExtruderRecipeHandler.java | 73 +++ .../FluidizedBedReactorRecipeHandler.java | 112 +++++ .../FractionationColumnRecipeHandler.java | 73 +++ .../GasWeldingStationGasRecipeHandler.java | 81 ++++ ihl/nei_integration/IHLBlockHighlightHandler.java | 51 ++ ihl/nei_integration/IHLPositionedStack.java | 15 + ihl/nei_integration/IHLRecipeHandler.java | 240 ++++++++++ .../ImpregnatingMachineRecipeHandler.java | 112 +++++ .../InjectionMoldRecipeHandler.java | 73 +++ .../IronWorkbenchRecipeHandler.java | 297 ++++++++++++ .../LabElectrolyzerRecipeHandler.java | 74 +++ ihl/nei_integration/LeadOvenRecipeHandler.java | 100 ++++ ihl/nei_integration/LoomRecipeHandler.java | 81 ++++ ihl/nei_integration/MachineRecipeHandler.java | 514 +++++++++++++++++++++ .../MuffleFurnaceRecipeHandler.java | 89 ++++ ihl/nei_integration/NEIIHLConfig.java | 121 +++++ ihl/nei_integration/PaperMachineRecipeHandler.java | 74 +++ .../PrecipitatorCondenserRecipeHandler.java | 73 +++ .../RollingMachineRecipeHandler.java | 73 +++ .../VulcanizationExtrudingMoldRecipeHandler.java | 73 +++ ihl/nei_integration/WireMillRecipeHandler.java | 109 +++++ .../WoodenRollingMachineRecipeHandler.java | 80 ++++ 31 files changed, 3419 insertions(+) create mode 100644 ihl/nei_integration/AchesonFurnaceRecipeHandler.java create mode 100644 ihl/nei_integration/ChemicalReactorRecipeHandler.java create mode 100644 ihl/nei_integration/ChimneyKneeRecipeHandler.java create mode 100644 ihl/nei_integration/CrucibleRecipeHandler.java create mode 100644 ihl/nei_integration/CryogenicDistillerRecipeHandler.java create mode 100644 ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java create mode 100644 ihl/nei_integration/ElectricEvaporatorRecipeHandler.java create mode 100644 ihl/nei_integration/ElectrolysisBathRecipeHandler.java create mode 100644 ihl/nei_integration/EvaporatorRecipeHandler.java create mode 100644 ihl/nei_integration/ExtruderRecipeHandler.java create mode 100644 ihl/nei_integration/FluidizedBedReactorRecipeHandler.java create mode 100644 ihl/nei_integration/FractionationColumnRecipeHandler.java create mode 100644 ihl/nei_integration/GasWeldingStationGasRecipeHandler.java create mode 100644 ihl/nei_integration/IHLBlockHighlightHandler.java create mode 100644 ihl/nei_integration/IHLPositionedStack.java create mode 100644 ihl/nei_integration/IHLRecipeHandler.java create mode 100644 ihl/nei_integration/ImpregnatingMachineRecipeHandler.java create mode 100644 ihl/nei_integration/InjectionMoldRecipeHandler.java create mode 100644 ihl/nei_integration/IronWorkbenchRecipeHandler.java create mode 100644 ihl/nei_integration/LabElectrolyzerRecipeHandler.java create mode 100644 ihl/nei_integration/LeadOvenRecipeHandler.java create mode 100644 ihl/nei_integration/LoomRecipeHandler.java create mode 100644 ihl/nei_integration/MachineRecipeHandler.java create mode 100644 ihl/nei_integration/MuffleFurnaceRecipeHandler.java create mode 100644 ihl/nei_integration/NEIIHLConfig.java create mode 100644 ihl/nei_integration/PaperMachineRecipeHandler.java create mode 100644 ihl/nei_integration/PrecipitatorCondenserRecipeHandler.java create mode 100644 ihl/nei_integration/RollingMachineRecipeHandler.java create mode 100644 ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java create mode 100644 ihl/nei_integration/WireMillRecipeHandler.java create mode 100644 ihl/nei_integration/WoodenRollingMachineRecipeHandler.java (limited to 'ihl/nei_integration') diff --git a/ihl/nei_integration/AchesonFurnaceRecipeHandler.java b/ihl/nei_integration/AchesonFurnaceRecipeHandler.java new file mode 100644 index 0000000..63dc0c8 --- /dev/null +++ b/ihl/nei_integration/AchesonFurnaceRecipeHandler.java @@ -0,0 +1,98 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import codechicken.nei.PositionedStack; +import ihl.processing.metallurgy.AchesonFurnaceGui; +import ihl.processing.metallurgy.AchesonFurnanceTileEntity; +import ihl.recipes.RecipeInputOreDictionaryList; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import ihl.utils.IHLUtils; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class AchesonFurnaceRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return AchesonFurnaceGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{34-5,34-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{41-11,23-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{107-5,107-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{41-11,23-11}; + } + + @Override + public String getRecipeName() + { + return "Acheson Furnace"; + } + + @Override + public String getRecipeId() + { + return "ihl.achesonFurnace"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIAchesonFurnaceNEI.png"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(40-5, 55-11, 90, 30), this.getRecipeId(), new Object[0])); + } + + @Override + public String getOverlayIdentifier() + { + return "achesonFurnace"; + } + + @Override + public Map getRecipeList() + { + return AchesonFurnanceTileEntity.getRecipes(); + } + + @Override + public List getAdditionalIngredients() + { + List ps = new ArrayList(); + RecipeInputOreDictionaryList ari = new RecipeInputOreDictionaryList(new String[] {"stickCoal","stickGraphite"}); + ps.add(new PositionedStack(ari.getInputs(),16-5,41-11)); + ps.add(new PositionedStack(ari.getInputs(),52-5,41-11)); + ps.add(new PositionedStack(IHLUtils.getOreDictItemStack("stickGraphite"),89-5,41-11)); + ps.add(new PositionedStack(IHLUtils.getOreDictItemStack("stickGraphite"),125-5,41-11)); + return ps; + } + +} diff --git a/ihl/nei_integration/ChemicalReactorRecipeHandler.java b/ihl/nei_integration/ChemicalReactorRecipeHandler.java new file mode 100644 index 0000000..161bdfe --- /dev/null +++ b/ihl/nei_integration/ChemicalReactorRecipeHandler.java @@ -0,0 +1,140 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; +import ihl.processing.chemistry.ChemicalReactorGui; +import ihl.processing.chemistry.ChemicalReactorTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; + + +public class ChemicalReactorRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return ChemicalReactorGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{104-5,122-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{15-11}; + } + + @Override + protected int[] getFluidInputPosX() + { + return new int[]{42-5,60-5}; + } + + @Override + protected int[] getFluidInputPosY() + { + return new int[]{15-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{104-5,122-5}; + } + + @Override + protected int[] getFluidOutputPosX() + { + return new int[]{42-5,60-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{51-11}; + } + + @Override + protected int[] getFluidOutputPosY() + { + return new int[]{51-11}; + } + + @Override + public String getRecipeName() + { + return "Chemical reactor"; + } + + @Override + public String getRecipeId() + { + return "ihl.chemicalReactor"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIChemicalReactor.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "chemicalReactor"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(103-5,32-10, 36, 18), this.getRecipeId(), new Object[0])); + } + + @Override + public void drawExtras(int recipeNumber) + { + super.drawExtras(recipeNumber); + MachineRecipeHandler.CachedIORecipe recipe = (CachedIORecipe) this.arecipes.get(recipeNumber); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.drawTexturedModalRect(103-18-5, 52-11, 246, 226+6*(this.ticks%4),10,6); + if(recipe.specialConditions) + { + GuiDraw.drawTexturedModalRect(0, 32-11, 0, 166,134,18); + GuiDraw.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("ihl.use_with_cryogenic_distiller"), 0, 27, 16777215); + } + } + + @Override + public void drawBackground(int i) + { + super.drawBackground(i); + GuiDraw.drawTexturedModalRect(41-5, 14-11, 59, 14, 18, 18); + GuiDraw.drawTexturedModalRect(41-5, 50-11, 59, 50, 18, 18); + } + + @Override + public Map getRecipeList() + { + return ChemicalReactorTileEntity.getRecipes(); + } + + private int getFrameY(int number) + { + return (number % 10) * 24 + 14; + } + + private int getFrameX(int number) + { + return (number / 10) * 24 + 176; + } +} diff --git a/ihl/nei_integration/ChimneyKneeRecipeHandler.java b/ihl/nei_integration/ChimneyKneeRecipeHandler.java new file mode 100644 index 0000000..d60c251 --- /dev/null +++ b/ihl/nei_integration/ChimneyKneeRecipeHandler.java @@ -0,0 +1,73 @@ +package ihl.nei_integration; + +import java.util.Map; + +import ihl.processing.chemistry.GoldChimneyKneeTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class ChimneyKneeRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return null; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{6-5,6-5,106-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{33-11,53-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{96-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{35-11,31-11}; + } + + + @Override + public String getRecipeName() + { + return "Chimney knee"; + } + + @Override + public String getRecipeId() + { + return "ihl.chimneyKnee"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIChimneyKneeNEI.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "chimneyKnee"; + } + + @Override + public Map getRecipeList() + { + return GoldChimneyKneeTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/CrucibleRecipeHandler.java b/ihl/nei_integration/CrucibleRecipeHandler.java new file mode 100644 index 0000000..dc2c012 --- /dev/null +++ b/ihl/nei_integration/CrucibleRecipeHandler.java @@ -0,0 +1,86 @@ +package ihl.nei_integration; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import codechicken.nei.PositionedStack; +import ihl.processing.metallurgy.Crucible; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import ihl.utils.IHLUtils; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class CrucibleRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return null; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{11-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{15-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{106-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{51-11}; + } + + + @Override + public String getRecipeName() + { + return "Crucible"; + } + + @Override + public String getRecipeId() + { + return "ihl.crucible"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUICrucibleNEI.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "crucible"; + } + + @Override + public Map getRecipeList() + { + return Crucible.getRecipes(); + } + + @Override + public List getAdditionalIngredients() + { + List ps = new ArrayList(); + ps.add(new PositionedStack(IHLUtils.getThisModItemStackWithDamage("crucible", 0),61-5,15-11)); + ps.add(new PositionedStack(IHLUtils.getThisModItemStackWithDamage("crucible", 1),106-5,15-11)); + return ps; + } +} diff --git a/ihl/nei_integration/CryogenicDistillerRecipeHandler.java b/ihl/nei_integration/CryogenicDistillerRecipeHandler.java new file mode 100644 index 0000000..c3bcff3 --- /dev/null +++ b/ihl/nei_integration/CryogenicDistillerRecipeHandler.java @@ -0,0 +1,111 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Iterator; +import java.util.Map; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; +import ic2.core.item.ItemFluidCell; +import ihl.processing.chemistry.CryogenicDistillerGui; +import ihl.processing.chemistry.CryogenicDistillerTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.util.StatCollector; +import net.minecraftforge.fluids.FluidStack; + + +public class CryogenicDistillerRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return CryogenicDistillerGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{103-5}; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(102-5, 32-10, 18, 18), this.getRecipeId(), new Object[0])); + } + + @Override + protected int[] getInputPosY() + { + return new int[]{51-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{123-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{33-11,51-11}; + } + + + @Override + public String getRecipeName() + { + return "Cryogenic distiller"; + } + + @Override + public String getRecipeId() + { + return "ihl.cryogenicDistiller"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUICryogenicDistiller.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "cryogenicDistiller"; + } + + @Override + public void drawExtras(int recipeNumber) + { + MachineRecipeHandler.CachedIORecipe recipe = (MachineRecipeHandler.CachedIORecipe) this.arecipes.get(recipeNumber); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + if(recipe.specialConditions) + { + GuiDraw.drawTexturedModalRect(0, 0, 0, 166, 97, 69); + String note = StatCollector.translateToLocal("ihl.as_byproduct_of_processing_of"); + FluidStack fstack = ((ItemFluidCell)recipe.getIngredients().get(0).item.getItem()).getFluid(recipe.getIngredients().get(0).item); + note+=" "+ fstack.getLocalizedName(); + note+=" "+ StatCollector.translateToLocal("ihl.in_chemical_reactor"); + Iterator noteListIterator = GuiDraw.fontRenderer.listFormattedStringToWidth(note, 90).iterator(); + int yTextPos=0; + while(noteListIterator.hasNext()) + { + GuiDraw.fontRenderer.drawStringWithShadow(noteListIterator.next(), 0, yTextPos, 16777215); + yTextPos+=10; + } + GuiDraw.fontRenderer.drawStringWithShadow(StatCollector.translateToLocal("ihl.check_usage"), 0, 44, 16777215); + } + } + + @Override + public Map getRecipeList() + { + return CryogenicDistillerTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java b/ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java new file mode 100644 index 0000000..07385dd --- /dev/null +++ b/ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java @@ -0,0 +1,88 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import codechicken.lib.gui.GuiDraw; +import ihl.processing.metallurgy.DetonationSprayingMachineGui; +import ihl.processing.metallurgy.DetonationSprayingMachineTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class DetonationSprayingMachineRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return DetonationSprayingMachineGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{10-5,98-5,117-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{17-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{10-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{53-11}; + } + + @Override + public String getRecipeName() + { + return "Detonation Spraying Machine"; + } + + @Override + public String getRecipeId() + { + return "ihl.detonationSprayingMachine"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIDetonationSprayingMachine.png"; + } + + @Override + public void drawBackground(int i) + { + super.drawBackground(i); + GuiDraw.drawTexturedModalRect(9-5, 34-11, 176, 0, 18, 36); + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(30-5,0, 60, 30), this.getRecipeId(), new Object[0])); + } + + @Override + public String getOverlayIdentifier() + { + return "detonationSprayingMachine"; + } + + @Override + public Map getRecipeList() + { + return DetonationSprayingMachineTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/ElectricEvaporatorRecipeHandler.java b/ihl/nei_integration/ElectricEvaporatorRecipeHandler.java new file mode 100644 index 0000000..1c9cff3 --- /dev/null +++ b/ihl/nei_integration/ElectricEvaporatorRecipeHandler.java @@ -0,0 +1,81 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import ihl.processing.chemistry.ElectricEvaporatorGui; +import ihl.processing.chemistry.ElectricEvaporatorTileEntity; +import ihl.processing.chemistry.EvaporatorTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class ElectricEvaporatorRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return ElectricEvaporatorGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{39}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{3}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{112}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{21}; + } + + @Override + public String getRecipeName() + { + return "Electric Evaporator"; + } + + @Override + public String getRecipeId() + { + return "ihl.electricEvaporator"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIElectricEvaporator.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "electricEvaporator"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(99-5,34-10, 17, 13), this.getRecipeId(), new Object[0])); + } + + @Override + public Map getRecipeList() + { + return EvaporatorTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/ElectrolysisBathRecipeHandler.java b/ihl/nei_integration/ElectrolysisBathRecipeHandler.java new file mode 100644 index 0000000..38f10ee --- /dev/null +++ b/ihl/nei_integration/ElectrolysisBathRecipeHandler.java @@ -0,0 +1,74 @@ +package ihl.nei_integration; + +import java.util.Map; + +import ihl.processing.chemistry.ElectrolysisBathGui; +import ihl.processing.chemistry.ElectrolysisBathTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class ElectrolysisBathRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return ElectrolysisBathGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{6-5,98-5,78-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{16-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{6-5,87-5,106-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{52-11,51-11,15-11}; + } + + + @Override + public String getRecipeName() + { + return "Electrolysis bath"; + } + + @Override + public String getRecipeId() + { + return "ihl.electrolysisBath"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIElectrolysisBath.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "electrolysisBath"; + } + + @Override + public Map getRecipeList() + { + return ElectrolysisBathTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/EvaporatorRecipeHandler.java b/ihl/nei_integration/EvaporatorRecipeHandler.java new file mode 100644 index 0000000..bfb697e --- /dev/null +++ b/ihl/nei_integration/EvaporatorRecipeHandler.java @@ -0,0 +1,80 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import ihl.processing.chemistry.EvaporatorGui; +import ihl.processing.chemistry.EvaporatorTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class EvaporatorRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return EvaporatorGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{39}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{3}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{112}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{21}; + } + + @Override + public String getRecipeName() + { + return "Evaporator"; + } + + @Override + public String getRecipeId() + { + return "ihl.evaporator"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUISolidFuelEvaporator.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "evaporator"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(99-5,34-10, 17, 13), this.getRecipeId(), new Object[0])); + } + + @Override + public Map getRecipeList() + { + return EvaporatorTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/ExtruderRecipeHandler.java b/ihl/nei_integration/ExtruderRecipeHandler.java new file mode 100644 index 0000000..3dae277 --- /dev/null +++ b/ihl/nei_integration/ExtruderRecipeHandler.java @@ -0,0 +1,73 @@ +package ihl.nei_integration; + +import java.util.Map; + +import ihl.processing.metallurgy.ExtruderGui; +import ihl.processing.metallurgy.ExtruderTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class ExtruderRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return ExtruderGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{39-5,57-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{32-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{92-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{32-11}; + } + + @Override + public String getRecipeName() + { + return "Extruder"; + } + + @Override + public String getRecipeId() + { + return "ihl.extruder"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIExtruder.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "extruder"; + } + + @Override + public Map getRecipeList() + { + return ExtruderTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java b/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java new file mode 100644 index 0000000..9f90536 --- /dev/null +++ b/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java @@ -0,0 +1,112 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import codechicken.lib.gui.GuiDraw; +import ihl.processing.chemistry.FluidizedBedReactorGui; +import ihl.processing.chemistry.FluidizedBedReactorTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class FluidizedBedReactorRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return FluidizedBedReactorGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{8-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{23-11,41-11}; + } + + @Override + protected int[] getFluidInputPosX() + { + return new int[]{102-5,84-5}; + } + + @Override + protected int[] getFluidInputPosY() + { + return new int[]{15-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{43-5}; + } + + @Override + protected int[] getFluidOutputPosX() + { + return new int[]{102-5,84-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{33-11}; + } + + @Override + protected int[] getFluidOutputPosY() + { + return new int[]{51-11,51-11}; + } + @Override + public void drawBackground(int i) + { + super.drawBackground(i); + GuiDraw.drawTexturedModalRect(83-5, 14-11, 101, 14, 18, 18); + GuiDraw.drawTexturedModalRect(83-5, 50-11, 101, 14, 18, 18); + } + + @Override + public String getRecipeName() + { + return "Fluidized bed reactor"; + } + + @Override + public String getRecipeId() + { + return "ihl.fluidizedBedReactor"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIFluidizedBedReactor.png"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(25-5,34-10, 17, 13), this.getRecipeId(), new Object[0])); + } + + @Override + public String getOverlayIdentifier() + { + return "fluidizedBedReactor"; + } + + @Override + public Map getRecipeList() + { + return FluidizedBedReactorTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/FractionationColumnRecipeHandler.java b/ihl/nei_integration/FractionationColumnRecipeHandler.java new file mode 100644 index 0000000..eda5896 --- /dev/null +++ b/ihl/nei_integration/FractionationColumnRecipeHandler.java @@ -0,0 +1,73 @@ +package ihl.nei_integration; + +import java.util.Map; + +import ihl.processing.chemistry.FractionatorBottomTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class FractionationColumnRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return null; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{6-5,61-5,106-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{33-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{76-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{51-11,31-11}; + } + + + @Override + public String getRecipeName() + { + return "Fractionation column"; + } + + @Override + public String getRecipeId() + { + return "ihl.fractionator"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIFractionationColumn.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "fractionator"; + } + + @Override + public Map getRecipeList() + { + return FractionatorBottomTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/GasWeldingStationGasRecipeHandler.java b/ihl/nei_integration/GasWeldingStationGasRecipeHandler.java new file mode 100644 index 0000000..0f3a85a --- /dev/null +++ b/ihl/nei_integration/GasWeldingStationGasRecipeHandler.java @@ -0,0 +1,81 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import ihl.processing.metallurgy.GasWeldingStationGui; +import ihl.processing.metallurgy.GasWeldingStationTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class GasWeldingStationGasRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return GasWeldingStationGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{44-5,62-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{15-11,51-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{62-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{15-11,33-11}; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(80-5, 15-11, 50, 50), this.getRecipeId(), new Object[0])); + } + + + @Override + public String getRecipeName() + { + return "Gas welding station"; + } + + @Override + public String getRecipeId() + { + return "ihl.gasWeldingStationGas"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIGasWeldingStation.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "gasWeldingStationGas"; + } + + @Override + public Map getRecipeList() + { + return GasWeldingStationTileEntity.getGasRecipes(); + } +} diff --git a/ihl/nei_integration/IHLBlockHighlightHandler.java b/ihl/nei_integration/IHLBlockHighlightHandler.java new file mode 100644 index 0000000..c6f8359 --- /dev/null +++ b/ihl/nei_integration/IHLBlockHighlightHandler.java @@ -0,0 +1,51 @@ +package ihl.nei_integration; + +import codechicken.nei.api.IHighlightHandler; +import codechicken.nei.api.ItemInfo; +import codechicken.nei.guihook.GuiContainerManager; +import net.minecraft.block.BlockRedstoneWire; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import ihl.flexible_cable.RectifierTransformerUnitTileEntity; + +import java.util.List; + +public class IHLBlockHighlightHandler implements IHighlightHandler +{ + @Override + public List handleTextData(ItemStack stack, World world, EntityPlayer player, MovingObjectPosition movingObjectPosition, List currenttip, ItemInfo.Layout layout) + { + TileEntity tile = world.getTileEntity(movingObjectPosition.blockX, movingObjectPosition.blockY, movingObjectPosition.blockZ); + if(tile instanceof RectifierTransformerUnitTileEntity) + { + RectifierTransformerUnitTileEntity rtu = (RectifierTransformerUnitTileEntity)tile; + currenttip.add("Current mode: "+EnumChatFormatting.RED+getMode(rtu.mode)+"x V"); + currenttip.add("R.Click: "+EnumChatFormatting.RED+getMode(Math.min(rtu.mode*RectifierTransformerUnitTileEntity.modeMultiplier,RectifierTransformerUnitTileEntity.modeMax))+"x V"); + currenttip.add("IC2 Mode+R.Click: "+EnumChatFormatting.RED+getMode(Math.max(rtu.mode/RectifierTransformerUnitTileEntity.modeMultiplier,RectifierTransformerUnitTileEntity.modeMin))+"x V"); + } + return currenttip; + } + + private String getMode(float value) + { + if(value>=1f) + { + return Integer.toString(Math.round(value)); + } + else + { + return "1/"+Integer.toString(Math.round(1f/value)); + } + } + @Override + public ItemStack identifyHighlight(World world, EntityPlayer player, MovingObjectPosition mop) { + return null; + } +} diff --git a/ihl/nei_integration/IHLPositionedStack.java b/ihl/nei_integration/IHLPositionedStack.java new file mode 100644 index 0000000..5c81ba9 --- /dev/null +++ b/ihl/nei_integration/IHLPositionedStack.java @@ -0,0 +1,15 @@ +package ihl.nei_integration; + +import ihl.recipes.RecipeOutputItemStack; +import codechicken.nei.PositionedStack; + +public class IHLPositionedStack extends PositionedStack { + + public final float sQuantity; + public IHLPositionedStack(RecipeOutputItemStack object, int x, int y) + { + super(object.itemStack.copy(), x, y); + sQuantity=object.quantity; + } + +} diff --git a/ihl/nei_integration/IHLRecipeHandler.java b/ihl/nei_integration/IHLRecipeHandler.java new file mode 100644 index 0000000..4c0ada6 --- /dev/null +++ b/ihl/nei_integration/IHLRecipeHandler.java @@ -0,0 +1,240 @@ +package ihl.nei_integration; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import ic2.api.recipe.IRecipeInput; +import ic2.api.recipe.RecipeOutput; +import ic2.core.util.StackUtil; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.item.ItemStack; +import org.lwjgl.opengl.GL11; + +public abstract class IHLRecipeHandler extends TemplateRecipeHandler +{ + protected int ticks; + + @Override + public abstract String getRecipeName(); + + public abstract String getRecipeId(); + + @Override + public abstract String getGuiTexture(); + + @Override + public abstract String getOverlayIdentifier(); + + public abstract Map getRecipeList(); + + @Override + public void drawBackground(int i) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 5, 11, 140, 65); + } + + @Override + public void drawExtras(int i) + { + float f = this.ticks >= 20 ? (this.ticks - 20) % 20 / 20.0F : 0.0F; + this.drawProgressBar(74, 23, 176, 14, 25, 16, f, 0); + f = this.ticks <= 20 ? this.ticks / 20.0F : 1.0F; + this.drawProgressBar(51, 25, 176, 0, 14, 14, f, 3); + } + + @Override + public void onUpdate() + { + super.onUpdate(); + ++this.ticks; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 25, 16), this.getRecipeId(), new Object[0])); + } + + @Override + public void loadCraftingRecipes(String outputId, Object ... results) + { + if (outputId.equals(this.getRecipeId())) + { + Iterator i$ = this.getRecipeList().entrySet().iterator(); + + while (i$.hasNext()) + { + Entry entry = (Entry)i$.next(); + this.arecipes.add(new IHLRecipeHandler.CachedIORecipe((IRecipeInput)entry.getKey(), (RecipeOutput)entry.getValue())); + } + } + else + { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) + { + Iterator i$ = this.getRecipeList().entrySet().iterator(); + + while (i$.hasNext()) + { + Entry entry = (Entry)i$.next(); + Iterator i$1 = ((RecipeOutput)entry.getValue()).items.iterator(); + + while (i$1.hasNext()) + { + ItemStack output = (ItemStack)i$1.next(); + + if (NEIServerUtils.areStacksSameTypeCrafting(output, result)) + { + this.arecipes.add(new IHLRecipeHandler.CachedIORecipe((IRecipeInput)entry.getKey(), (RecipeOutput)entry.getValue())); + break; + } + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) + { + Iterator i$ = this.getRecipeList().entrySet().iterator(); + + while (i$.hasNext()) + { + Entry entry = (Entry)i$.next(); + + if (((IRecipeInput)entry.getKey()).matches(ingredient)) + { + this.arecipes.add(new IHLRecipeHandler.CachedIORecipe((IRecipeInput)entry.getKey(), (RecipeOutput)entry.getValue())); + } + } + } + + protected int getInputPosX() + { + return 51; + } + + protected int getInputPosY() + { + return 6; + } + + protected int getOutputPosX() + { + return 111; + } + + protected int getOutputPosY() + { + return 24; + } + + protected boolean isOutputsVertical() + { + return true; + } + + public class CachedIORecipe extends CachedRecipe + { + private final List ingredients = new ArrayList(); + private final PositionedStack output; + private final List otherStacks = new ArrayList(); + + @Override + public List getIngredients() + { + return this.getCycledIngredients(IHLRecipeHandler.this.cycleticks / 20, this.ingredients); + } + + @Override + public PositionedStack getResult() + { + return this.output; + } + + @Override + public List getOtherStacks() + { + return this.otherStacks; + } + + public CachedIORecipe(ItemStack input, ItemStack output1) + { + super(); + + if (input == null) + { + throw new NullPointerException("Input must not be null (recipe " + input + " -> " + output1 + ")."); + } + else if (output1 == null) + { + throw new NullPointerException("Output must not be null (recipe " + input + " -> " + output1 + ")."); + } + else + { + this.ingredients.add(new PositionedStack(input, IHLRecipeHandler.this.getInputPosX(), IHLRecipeHandler.this.getInputPosY())); + this.output = new PositionedStack(output1, IHLRecipeHandler.this.getOutputPosX(), IHLRecipeHandler.this.getOutputPosY()); + } + } + + public CachedIORecipe(IRecipeInput input, RecipeOutput output1) + { + super(); + + if (input == null) + { + throw new NullPointerException("Input must not be null (recipe " + input + " -> " + output1 + ")."); + } + else if (output1 == null) + { + throw new NullPointerException("Output must not be null (recipe " + input + " -> " + output1 + ")."); + } + else if (output1.items.isEmpty()) + { + throw new IllegalArgumentException("Output must not be empty (recipe " + input + " -> " + output1 + ")."); + } + else if (output1.items.contains((Object)null)) + { + throw new IllegalArgumentException("Output must not contain null (recipe " + input + " -> " + output1 + ")."); + } + else + { + ArrayList items = new ArrayList(); + Iterator i = input.getInputs().iterator(); + + while (i.hasNext()) + { + ItemStack item = (ItemStack)i.next(); + items.add(StackUtil.copyWithSize(item, input.getAmount())); + } + + this.ingredients.add(new PositionedStack(items, IHLRecipeHandler.this.getInputPosX(), IHLRecipeHandler.this.getInputPosY())); + this.output = new PositionedStack(output1.items.get(0), IHLRecipeHandler.this.getOutputPosX(), IHLRecipeHandler.this.getOutputPosY()); + + for (int var7 = 1; var7 < output1.items.size(); ++var7) + { + if (IHLRecipeHandler.this.isOutputsVertical()) + { + this.otherStacks.add(new PositionedStack(output1.items.get(var7), IHLRecipeHandler.this.getOutputPosX(), IHLRecipeHandler.this.getOutputPosY() + var7 * 18)); + } + else + { + this.otherStacks.add(new PositionedStack(output1.items.get(var7), IHLRecipeHandler.this.getOutputPosX() + var7 * 18, IHLRecipeHandler.this.getOutputPosY())); + } + } + } + } + } +} diff --git a/ihl/nei_integration/ImpregnatingMachineRecipeHandler.java b/ihl/nei_integration/ImpregnatingMachineRecipeHandler.java new file mode 100644 index 0000000..d1f172e --- /dev/null +++ b/ihl/nei_integration/ImpregnatingMachineRecipeHandler.java @@ -0,0 +1,112 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import codechicken.lib.gui.GuiDraw; +import ihl.processing.metallurgy.ImpregnatingMachineGui; +import ihl.processing.metallurgy.ImpregnatingMachineTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class ImpregnatingMachineRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return ImpregnatingMachineGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{116-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{16-11}; + } + + @Override + protected int[] getFluidInputPosX() + { + return new int[]{24-5,6-5}; + } + + @Override + protected int[] getFluidInputPosY() + { + return new int[]{16-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{116-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{41-11,59-11}; + } + + @Override + protected int[] getFluidOutputPosX() + { + return new int[]{24-5}; + } + + @Override + protected int[] getFluidOutputPosY() + { + return new int[]{52-11}; + } + + @Override + public String getRecipeName() + { + return "Bronze tub"; + } + + @Override + public String getRecipeId() + { + return "ihl.impregnatingMachine"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUITubBronze.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "impregnatingMachine"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(134-5, 0, 35, 65), this.getRecipeId(), new Object[0])); + } + + @Override + public void drawBackground(int i) + { + super.drawBackground(i); + GuiDraw.drawTexturedModalRect(5-5, 15-11, 23, 15, 18, 18); + } + + @Override + public Map getRecipeList() + { + return ImpregnatingMachineTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/InjectionMoldRecipeHandler.java b/ihl/nei_integration/InjectionMoldRecipeHandler.java new file mode 100644 index 0000000..106b41b --- /dev/null +++ b/ihl/nei_integration/InjectionMoldRecipeHandler.java @@ -0,0 +1,73 @@ +package ihl.nei_integration; + +import java.util.Map; + +import ihl.processing.metallurgy.InjectionMoldTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class InjectionMoldRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return null; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{65-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{15-11,51-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{101-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{51-11}; + } + + + @Override + public String getRecipeName() + { + return "Injection mold"; + } + + @Override + public String getRecipeId() + { + return "ihl.casting"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUICastingNEI.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "casting"; + } + + @Override + public Map getRecipeList() + { + return InjectionMoldTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/IronWorkbenchRecipeHandler.java b/ihl/nei_integration/IronWorkbenchRecipeHandler.java new file mode 100644 index 0000000..1589f36 --- /dev/null +++ b/ihl/nei_integration/IronWorkbenchRecipeHandler.java @@ -0,0 +1,297 @@ +package ihl.nei_integration; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import ic2.api.recipe.IRecipeInput; +import ic2.core.Ic2Items; +import ihl.IHLMod; +import ihl.recipes.IronWorkbenchRecipe; +import ihl.utils.IHLUtils; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; +import org.lwjgl.opengl.GL11; + +import ihl.flexible_cable.IronWorkbenchGui; +import ihl.flexible_cable.IronWorkbenchTileEntity; +import ihl.interfaces.IWire; + +public class IronWorkbenchRecipeHandler extends TemplateRecipeHandler +{ + private static final int workspaceItemsPosX=8-7; + private static final int workspaceItemsPosY=8-7; + private static final int toolsPosX=26-7; + private static final int toolsPosY=8-7; + private static final int materialsPosX=65-7; + private static final int materialsPosY=8-7; + private static final int outputPosX=116-7; + private static final int outputPosY=8-7; + + @Override + public Class getGuiClass() + { + return IronWorkbenchGui.class; + } + + @Override + public String getRecipeName() + { + return "Iron workbench"; + } + + @Override + public int recipiesPerPage() + { + return 1; + } + + public String getRecipeId() + { + return "ihl.ironWorkbench"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIIronWorkbench.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "ironWorkbench"; + } + + public List getRecipeList() + { + return IronWorkbenchTileEntity.recipes; + } + + + @Override + public void drawBackground(int recipeNumber) + { + IronWorkbenchRecipeHandler.CachedIORecipe recipe = (CachedIORecipe) this.arecipes.get(recipeNumber); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 7, 7, 162, 108); + } + + @Override + public void drawExtras(int i) + { + /* + float f = this.ticks >= 20 ? (float)((this.ticks - 20) % 20) / 20.0F : 0.0F; + this.drawProgressBar(74, 23, 176, 14, 25, 16, f, 0); + f = this.ticks <= 20 ? (float)this.ticks / 20.0F : 1.0F; + this.drawProgressBar(51, 25, 176, 0, 14, 14, f, 3); + */ + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(104-10, 9-10, 15, 108), this.getRecipeId(), new Object[0])); + } + + @Override + public void loadCraftingRecipes(String outputId, Object ... results) + { + if (outputId.equals(this.getRecipeId())) + { + Iterator i$ = this.getRecipeList().iterator(); + + while (i$.hasNext()) + { + IronWorkbenchRecipe entry = i$.next(); + this.arecipes.add(new IronWorkbenchRecipeHandler.CachedIORecipe(entry)); + } + } + else + { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) + { + Iterator i$ = this.getRecipeList().iterator(); + + while (i$.hasNext()) + { + IronWorkbenchRecipe entry = i$.next(); + Iterator i$1 = entry.outputs.iterator(); + while (i$1.hasNext()) + { + ItemStack output = (ItemStack)i$1.next(); + if (NEIServerUtils.areStacksSameTypeCrafting(output, result)) + { + this.arecipes.add(new IronWorkbenchRecipeHandler.CachedIORecipe(entry)); + break; + } + } + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) + { + Iterator i$ = this.getRecipeList().iterator(); + while (i$.hasNext()) + { + IronWorkbenchRecipe entry = i$.next(); + if(entry.workspaceElements!=null && !entry.workspaceElements.isEmpty()) + { + Iterator i$1 = entry.workspaceElements.iterator(); + while (i$1.hasNext()) + { + ItemStack output = (ItemStack)i$1.next(); + if (NEIServerUtils.areStacksSameTypeCrafting(output, ingredient) || IHLUtils.isItemsHaveSameOreDictionaryEntry(output, ingredient) || output.getItem()==ingredient.getItem()) + { + this.arecipes.add(new IronWorkbenchRecipeHandler.CachedIORecipe(entry)); + break; + } + } + } + + if(entry.tools!=null && !entry.tools.isEmpty()) + { + Iterator i$1 = entry.tools.iterator(); + while (i$1.hasNext()) + { + IRecipeInput output = i$1.next(); + if (output.matches(ingredient)) + { + this.arecipes.add(new IronWorkbenchRecipeHandler.CachedIORecipe(entry)); + break; + } + } + } + if(entry.materials!=null && !entry.materials.isEmpty()) + { + Iterator i$2 = entry.materials.iterator(); + while (i$2.hasNext()) + { + IRecipeInput output = i$2.next(); + if (output.matches(ingredient)) + { + this.arecipes.add(new IronWorkbenchRecipeHandler.CachedIORecipe(entry)); + break; + } + } + } + } + } + + public class CachedIORecipe extends CachedRecipe + { + private final List ingredients = new ArrayList(); + private final PositionedStack output; + private final List otherStacks = new ArrayList(); + + @Override + public List getIngredients() + { + return this.getCycledIngredients(IronWorkbenchRecipeHandler.this.cycleticks / 20, this.ingredients); + } + + @Override + public PositionedStack getResult() + { + return this.output; + } + + @Override + public List getOtherStacks() + { + return this.otherStacks; + } + + public CachedIORecipe(IronWorkbenchRecipe recipe) + { + super(); + if (recipe == null) + { + throw new NullPointerException("Recipe must not be null."); + } + else + { + this.ingredients.add(new PositionedStack(IHLUtils.getThisModItemStack("ironWorkbench"), workspaceItemsPosX, workspaceItemsPosY)); + if(recipe.workspaceElements!=null && !recipe.workspaceElements.isEmpty()) + { + Iterator i = recipe.workspaceElements.iterator(); + int index = 1; + while (i.hasNext()) + { + int x = workspaceItemsPosX; + int y = workspaceItemsPosY + index * 18; + ItemStack stack = (ItemStack)i.next(); + this.ingredients.add(new PositionedStack(stack, x, y)); + index++; + } + } + if(recipe.tools!=null && !recipe.tools.isEmpty()) + { + Iterator i = recipe.tools.iterator(); + int index = 0; + while (i.hasNext()) + { + int x = toolsPosX + (index % 2) * 18; + int y = toolsPosY + index / 2 * 18; + IRecipeInput rInput = (IRecipeInput)i.next(); + this.ingredients.add(new PositionedStack(rInput.getInputs(), x, y)); + index++; + } + } + + if(recipe.materials!=null && !recipe.materials.isEmpty()) + { + Iterator i = recipe.materials.iterator(); + int index = 0; + while (i.hasNext()) + { + int x = materialsPosX + (index % 2) * 18; + int y = materialsPosY + index / 2 * 18; + IRecipeInput rInput = (IRecipeInput)i.next(); + Iterator rInputsi = rInput.getInputs().iterator(); + List itemInputs = new ArrayList(); + while(rInputsi.hasNext()) + { + ItemStack stack = rInputsi.next().copy(); + if(!(stack.getItem() instanceof IWire)) + { + stack.stackSize=rInput.getAmount(); + } + itemInputs.add(stack); + } + this.ingredients.add(new PositionedStack(itemInputs, x, y)); + index++; + } + } + this.output=new PositionedStack(recipe.outputs.get(0), outputPosX, outputPosY); + Iterator i = recipe.outputs.iterator(); + int index = 0; + while (i.hasNext()) + { + int x = outputPosX + (index % 3) * 18; + int y = outputPosY + index / 3 * 18; + ItemStack stack = (ItemStack)i.next(); + if(index>0) + { + this.otherStacks.add(new PositionedStack(stack, x, y)); + } + index++; + } + } + } + + } +} diff --git a/ihl/nei_integration/LabElectrolyzerRecipeHandler.java b/ihl/nei_integration/LabElectrolyzerRecipeHandler.java new file mode 100644 index 0000000..c36e27d --- /dev/null +++ b/ihl/nei_integration/LabElectrolyzerRecipeHandler.java @@ -0,0 +1,74 @@ +package ihl.nei_integration; + +import java.util.Map; + +import ihl.processing.chemistry.LabElectrolyzerGui; +import ihl.processing.chemistry.LabElectrolyzerTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class LabElectrolyzerRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return LabElectrolyzerGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{42-5,60-5,78-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{15-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{8-5,87-5,106-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{15-11,51-11,15-11}; + } + + + @Override + public String getRecipeName() + { + return "Lab electrolyzer"; + } + + @Override + public String getRecipeId() + { + return "ihl.labElectrolyzer"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUILabElectrolyzer.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "labElectrolyzer"; + } + + @Override + public Map getRecipeList() + { + return LabElectrolyzerTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/LeadOvenRecipeHandler.java b/ihl/nei_integration/LeadOvenRecipeHandler.java new file mode 100644 index 0000000..5c43f9e --- /dev/null +++ b/ihl/nei_integration/LeadOvenRecipeHandler.java @@ -0,0 +1,100 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import codechicken.lib.gui.GuiDraw; +import ihl.processing.chemistry.LeadOvenGui; +import ihl.processing.chemistry.LeadOvenTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class LeadOvenRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return LeadOvenGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{47-5,65-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{17-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{112-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{35-11}; + } + + @Override + protected int[] getFluidOutputPosX() + { + return new int[]{112-5}; + } + + @Override + protected int[] getFluidOutputPosY() + { + return new int[]{17-11}; + } + + @Override + public String getRecipeName() + { + return "Chemically resistant oven"; + } + + @Override + public String getRecipeId() + { + return "ihl.leadOven"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUILeadOven.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "leadOven"; + } + + @Override + public void drawBackground(int i) + { + super.drawBackground(i); + GuiDraw.drawTexturedModalRect(107-5, 16-11, 199, 0, 26, 18); + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(80-10, 35-10, 22, 15), this.getRecipeId(), new Object[0])); + } + + @Override + public Map getRecipeList() + { + return LeadOvenTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/LoomRecipeHandler.java b/ihl/nei_integration/LoomRecipeHandler.java new file mode 100644 index 0000000..b7f6331 --- /dev/null +++ b/ihl/nei_integration/LoomRecipeHandler.java @@ -0,0 +1,81 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import ihl.processing.chemistry.LoomGui; +import ihl.processing.chemistry.LoomTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class LoomRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return LoomGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{8-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{44-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{127-5}; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(35-10, 0, 90, 60), this.getRecipeId(), new Object[0])); + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{44-11}; + } + + + @Override + public String getRecipeName() + { + return "Loom"; + } + + @Override + public String getRecipeId() + { + return "ihl.loom"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUILoom.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "loom"; + } + + @Override + public Map getRecipeList() + { + return LoomTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/MachineRecipeHandler.java b/ihl/nei_integration/MachineRecipeHandler.java new file mode 100644 index 0000000..aa5a30b --- /dev/null +++ b/ihl/nei_integration/MachineRecipeHandler.java @@ -0,0 +1,514 @@ +package ihl.nei_integration; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import ic2.api.recipe.IRecipeInput; +import ic2.core.Ic2Items; +import ic2.core.item.ItemFluidCell; +import ihl.interfaces.IWire; +import ihl.recipes.IRecipeInputFluid; +import ihl.recipes.RecipeOutputItemStack; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import ihl.utils.IHLUtils; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.BlockFluidBase; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; + +import org.lwjgl.opengl.GL11; + +public abstract class MachineRecipeHandler extends TemplateRecipeHandler +{ + protected int ticks; + + @Override + public abstract String getRecipeName(); + + public abstract String getRecipeId(); + + @Override + public abstract String getGuiTexture(); + + @Override + public abstract String getOverlayIdentifier(); + + public abstract Map getRecipeList(); + + @Override + public void drawBackground(int i) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 5, 11, 140, 65); + } + + @Override + public void drawExtras(int recipeNumber) + { + MachineRecipeHandler.CachedIORecipe recipe = (CachedIORecipe) this.arecipes.get(recipeNumber); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + if(recipe.output instanceof IHLPositionedStack) + { + IHLPositionedStack rOutput = (IHLPositionedStack) recipe.output; + drawFormattedString(rOutput); + } + Iterator iOs = recipe.otherStacks.iterator(); + while(iOs.hasNext()) + { + PositionedStack rOutPS = iOs.next(); + if(rOutPS instanceof IHLPositionedStack) + { + IHLPositionedStack rOutput = (IHLPositionedStack) rOutPS; + drawFormattedString(rOutput); + } + } + GuiDraw.changeTexture(this.getGuiTexture()); + } + + public void drawFormattedString(IHLPositionedStack rOutput) + { + if(Math.abs(rOutput.sQuantity-Math.round(rOutput.sQuantity))<0.01f) + { + if(Math.round(rOutput.sQuantity)!=1) + { + GuiDraw.fontRenderer.drawStringWithShadow(String.format("%d", Math.round(rOutput.sQuantity)), rOutput.relx+11, rOutput.rely+9, 16777215); + } + } + else + { + GuiDraw.fontRenderer.drawStringWithShadow(String.format("%.1f", rOutput.sQuantity), rOutput.relx+3, rOutput.rely+9, 16777215); + } + } + + @Override + public void onUpdate() + { + super.onUpdate(); + ++this.ticks; + } + + @Override + public void loadTransferRects() + { + //this.transferRects.add(new RecipeTransferRect(new Rectangle(74, 23, 25, 16), this.getRecipeId(), new Object[0])); + } + + @Override + public void loadCraftingRecipes(String outputId, Object ... results) + { + if (outputId.equals(this.getRecipeId())) + { + Iterator i$ = this.getRecipeList().entrySet().iterator(); + + while (i$.hasNext()) + { + Entry entry = (Entry)i$.next(); + this.arecipes.add(new MachineRecipeHandler.CachedIORecipe((UniversalRecipeInput)entry.getKey(), (UniversalRecipeOutput)entry.getValue(),getAdditionalIngredients())); + } + } + else + { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadCraftingRecipes(ItemStack result) + { + Iterator i$ = this.getRecipeList().entrySet().iterator(); + FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(result); + if(fluidStack==null && result.getItem() instanceof IFluidContainerItem) + { + IFluidContainerItem ifc = (IFluidContainerItem)result.getItem(); + fluidStack = ifc.getFluid(result); + } + else if(result.getItem() instanceof ItemBlock) + { + Block blockfluid = ((ItemBlock)result.getItem()).field_150939_a; + if(blockfluid instanceof BlockFluidBase) + { + Fluid fluid = ((BlockFluidBase)blockfluid).getFluid(); + if(fluid!=null) + { + fluidStack = new FluidStack(fluid,1000); + } + } + } + if(fluidStack!=null) + { + while (i$.hasNext()) + { + Entry entry = (Entry)i$.next(); + Iterator i$1 = ((UniversalRecipeOutput)entry.getValue()).getFluidOutputs().iterator(); + while (i$1.hasNext()) + { + FluidStack output = (FluidStack)i$1.next(); + if (output!=null && output.getFluid()==fluidStack.getFluid()) + { + this.arecipes.add(new MachineRecipeHandler.CachedIORecipe((UniversalRecipeInput)entry.getKey(), (UniversalRecipeOutput)entry.getValue(),getAdditionalIngredients())); + break; + } + } + } + } + else + { + while (i$.hasNext()) + { + Entry entry = (Entry)i$.next(); + Iterator i$1 = ((UniversalRecipeOutput)entry.getValue()).getItemOutputs().iterator(); + + while (i$1.hasNext()) + { + RecipeOutputItemStack output = i$1.next(); + + if (NEIServerUtils.areStacksSameTypeCrafting(output.itemStack, result) || IHLUtils.isItemsHaveSameOreDictionaryEntry(output.itemStack, result)) + { + this.arecipes.add(new MachineRecipeHandler.CachedIORecipe((UniversalRecipeInput)entry.getKey(), (UniversalRecipeOutput)entry.getValue(),getAdditionalIngredients())); + break; + } + } + } + } + } + + + public List getAdditionalIngredients() + { + return null; + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) + { + Iterator i$ = this.getRecipeList().entrySet().iterator(); + FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(ingredient); + if(fluidStack==null && ingredient.getItem() instanceof IFluidContainerItem) + { + IFluidContainerItem ifc = (IFluidContainerItem)ingredient.getItem(); + fluidStack = ifc.getFluid(ingredient); + } + else if(ingredient.getItem() instanceof ItemBlock) + { + Block blockfluid = ((ItemBlock)ingredient.getItem()).field_150939_a; + if(blockfluid instanceof BlockFluidBase) + { + Fluid fluid = ((BlockFluidBase)blockfluid).getFluid(); + if(fluid!=null) + { + fluidStack = new FluidStack(fluid,1000); + } + } + } + + if(fluidStack!=null && fluidStack.getFluid()!=null) + { + while (i$.hasNext()) + { + Entry entry = (Entry)i$.next(); + if (((UniversalRecipeInput)entry.getKey()).containFluidStack(fluidStack)) + { + this.arecipes.add(new MachineRecipeHandler.CachedIORecipe((UniversalRecipeInput)entry.getKey(), (UniversalRecipeOutput)entry.getValue(),getAdditionalIngredients())); + } + } + } + else + { + while (i$.hasNext()) + { + Entry entry = (Entry)i$.next(); + if (((UniversalRecipeInput)entry.getKey()).containItemStack(ingredient)) + { + this.arecipes.add(new MachineRecipeHandler.CachedIORecipe((UniversalRecipeInput)entry.getKey(), (UniversalRecipeOutput)entry.getValue(),getAdditionalIngredients())); + } + } + } + } + + protected int[] getFluidInputPosX() + { + return null; + } + + protected int[] getFluidInputPosY() + { + return null; + } + + protected int[] getFluidOutputPosX() + { + return null; + } + + protected int[] getFluidOutputPosY() + { + return null; + } + + protected abstract int[] getInputPosX(); + protected abstract int[] getInputPosY(); + protected abstract int[] getOutputPosX(); + protected abstract int[] getOutputPosY(); + + public class CachedIORecipe extends CachedRecipe + { + private final List ingredients = new ArrayList(); + public PositionedStack output; + public final List otherStacks = new ArrayList(); + public boolean specialConditions=false; + + @Override + public List getIngredients() + { + return this.getCycledIngredients(MachineRecipeHandler.this.cycleticks / 20, this.ingredients); + } + + @Override + public PositionedStack getResult() + { + return this.output; + } + + @Override + public List getOtherStacks() + { + return this.otherStacks; + } + + public CachedIORecipe(UniversalRecipeInput input, UniversalRecipeOutput output1, List additionalIngredients) + { + super(); + if (input == null) + { + throw new NullPointerException("Input must not be null (recipe " + input + " -> " + output1 + ")."); + } + else if (output1 == null) + { + throw new NullPointerException("Output must not be null (recipe " + input + " -> " + output1 + ")."); + } + else if ((output1.getFluidOutputs() == null || output1.getFluidOutputs().isEmpty()) && (output1.getItemOutputs() == null || output1.getItemOutputs().isEmpty())) + { + throw new NullPointerException("Output must not be null (recipe " + input + " -> " + output1 + ")."); + } + else + { + specialConditions=output1.specialConditions; + ArrayList> items = new ArrayList(); + ArrayList> fluidItems = new ArrayList(); + if(input.getFluidInputs()!=null && !input.getFluidInputs().isEmpty()) + { + Iterator i = input.getFluidInputs().iterator(); + while (i.hasNext()) + { + IRecipeInputFluid fstackRI = (IRecipeInputFluid)i.next(); + List fstackList = fstackRI.getInputs(); + List fContainers = new ArrayList(); + for(FluidStack fstack:fstackList) + { + ItemStack stack = Ic2Items.FluidCell.copy(); + ((ItemFluidCell)Ic2Items.FluidCell.copy().getItem()).fill(stack, fstack, true); + if(fstack.amount>1000) + { + stack.stackSize=fstack.amount/1000; + } + fContainers.add(stack); + } + fluidItems.add(fContainers); + } + } + + if(input.getItemInputs()!=null && !input.getItemInputs().isEmpty()) + { + Iterator i = input.getItemInputs().iterator(); + while (i.hasNext()) + { + IRecipeInput rInput = (IRecipeInput)i.next(); + Iterator rInputsi = rInput.getInputs().iterator(); + List itemInputs = new ArrayList(); + while(rInputsi.hasNext()) + { + ItemStack stack = rInputsi.next().copy(); + if(!(stack.getItem() instanceof IWire)) + { + stack.stackSize=rInput.getAmount(); + } + itemInputs.add(stack); + } + items.add(itemInputs); + } + } + + int var7=0; + int var8=0; + boolean skipOneFluidOutput=false; + if(output1.getItemOutputs()!=null && !output1.getItemOutputs().isEmpty()) + { + int x = MachineRecipeHandler.this.getOutputPosX()[0],y = MachineRecipeHandler.this.getOutputPosY()[0]; + if(output1.getItemOutputs().get(0)!=null)this.output = new IHLPositionedStack(output1.getItemOutputs().get(0), x, y); + Iterator i = output1.getItemOutputs().iterator(); + i.next(); + while (i.hasNext()) + { + RecipeOutputItemStack rOut = i.next(); + var7++; + if(var71000) + { + fluidCellStack.stackSize=output1.getFluidOutputs().get(0).amount/1000; + } + if(MachineRecipeHandler.this.getFluidOutputPosX()!=null) + { + this.output = new PositionedStack(fluidCellStack, MachineRecipeHandler.this.getFluidOutputPosX()[0], MachineRecipeHandler.this.getFluidOutputPosY()[0]); + } + else + { + this.output = new PositionedStack(fluidCellStack, MachineRecipeHandler.this.getOutputPosX()[0], MachineRecipeHandler.this.getOutputPosY()[0]); + } + skipOneFluidOutput=true; + var8++; + } + + if(output1.getFluidOutputs()!=null && !output1.getFluidOutputs().isEmpty()) + { + int x = MachineRecipeHandler.this.getOutputPosX()[0],y = MachineRecipeHandler.this.getOutputPosY()[0]; + if(MachineRecipeHandler.this.getFluidOutputPosX()!=null) + { + x = MachineRecipeHandler.this.getFluidOutputPosX()[0]; + y = MachineRecipeHandler.this.getFluidOutputPosY()[0]; + } + Iterator i = output1.getFluidOutputs().iterator(); + if(skipOneFluidOutput) + { + i.next(); + } + while (i.hasNext()) + { + FluidStack fstack = (FluidStack)i.next(); + ItemStack stack1 = Ic2Items.FluidCell.copy(); + ((ItemFluidCell)stack1.getItem()).fill(stack1, fstack, true); + if(fstack.amount>1000) + { + stack1.stackSize=fstack.amount/1000; + } + var7++; + if(MachineRecipeHandler.this.getFluidOutputPosX()!=null) + { + if(var8 getGuiClass() + { + return MuffleFurnaceGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{51-5,69-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{34-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{105-5,123-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{34-11}; + } + + @Override + public String getRecipeName() + { + return "Muffle furnace"; + } + + @Override + public String getRecipeId() + { + return "ihl.muffleFurnace"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIMuffleFurnace.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "muffleFurnace"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(40-5, 55-11, 55, 15), this.getRecipeId(), new Object[0])); + } + + + @Override + public void drawBackground(int i) + { + super.drawBackground(i); + GuiDraw.drawTexturedModalRect(86-5, 33-11, 176, 14, 54, 18); + } + + @Override + public Map getRecipeList() + { + return MuffleFurnanceTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/NEIIHLConfig.java b/ihl/nei_integration/NEIIHLConfig.java new file mode 100644 index 0000000..7ffc3fb --- /dev/null +++ b/ihl/nei_integration/NEIIHLConfig.java @@ -0,0 +1,121 @@ +package ihl.nei_integration; + +import ihl.IHLModInfo; +import ihl.processing.chemistry.ChemicalReactorGui; +import ihl.processing.chemistry.CryogenicDistillerGui; +import ihl.processing.chemistry.ElectricEvaporatorGui; +import ihl.processing.chemistry.EvaporatorGui; +import ihl.processing.chemistry.FluidizedBedReactorGui; +import ihl.processing.chemistry.LabElectrolyzerGui; +import ihl.processing.chemistry.LeadOvenGui; +import ihl.processing.chemistry.LoomGui; +import ihl.processing.chemistry.PaperMachineGui; +import ihl.processing.metallurgy.AchesonFurnaceGui; +import ihl.processing.metallurgy.DetonationSprayingMachineGui; +import ihl.processing.metallurgy.ExtruderGui; +import ihl.processing.metallurgy.GasWeldingStationGui; +import ihl.processing.metallurgy.ImpregnatingMachineGui; +import ihl.processing.metallurgy.MuffleFurnaceGui; +import ihl.processing.metallurgy.RollingMachineGui; +import ihl.processing.metallurgy.WireMillGui; +import ihl.processing.metallurgy.WoodenRollingMachineGui; +import ihl.utils.IHLUtils; +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; +import codechicken.nei.api.ItemInfo; + +public class NEIIHLConfig implements IConfigureNEI +{ + @Override + public void loadConfig() + { + API.registerHighlightHandler(new IHLBlockHighlightHandler(), ItemInfo.Layout.HEADER); + API.registerRecipeHandler(new EvaporatorRecipeHandler()); + API.registerUsageHandler(new EvaporatorRecipeHandler()); + API.registerGuiOverlay(EvaporatorGui.class, "evaporator", 5, 11); + API.registerRecipeHandler(new ElectricEvaporatorRecipeHandler()); + API.registerUsageHandler(new ElectricEvaporatorRecipeHandler()); + API.registerGuiOverlay(ElectricEvaporatorGui.class, "electricevaporator", 5, 11); + API.registerRecipeHandler(new AchesonFurnaceRecipeHandler()); + API.registerUsageHandler(new AchesonFurnaceRecipeHandler()); + API.registerGuiOverlay(AchesonFurnaceGui.class, "achesonFurnace", 5, 11); + API.registerRecipeHandler(new MuffleFurnaceRecipeHandler()); + API.registerUsageHandler(new MuffleFurnaceRecipeHandler()); + API.registerGuiOverlay(MuffleFurnaceGui.class, "muffleFurnace", 5, 11); + API.registerRecipeHandler(new DetonationSprayingMachineRecipeHandler()); + API.registerUsageHandler(new DetonationSprayingMachineRecipeHandler()); + API.registerGuiOverlay(DetonationSprayingMachineGui.class, "detonationSprayingMachine", 5, 11); + API.registerRecipeHandler(new ExtruderRecipeHandler()); + API.registerUsageHandler(new ExtruderRecipeHandler()); + API.registerGuiOverlay(ExtruderGui.class, "extruder", 5, 11); + API.registerRecipeHandler(new ImpregnatingMachineRecipeHandler()); + API.registerUsageHandler(new ImpregnatingMachineRecipeHandler()); + API.registerGuiOverlay(ImpregnatingMachineGui.class, "impregnatingMachine", 5, 11); + API.registerRecipeHandler(new LeadOvenRecipeHandler()); + API.registerUsageHandler(new LeadOvenRecipeHandler()); + API.registerGuiOverlay(LeadOvenGui.class, "leadOven", 5, 11); + API.registerRecipeHandler(new LoomRecipeHandler()); + API.registerUsageHandler(new LoomRecipeHandler()); + API.registerGuiOverlay(LoomGui.class, "loom", 5, 11); + API.registerGuiOverlay(GasWeldingStationGui.class, "gasWeldingStation", 5, 11); + API.registerRecipeHandler(new GasWeldingStationGasRecipeHandler()); + API.registerUsageHandler(new GasWeldingStationGasRecipeHandler()); + API.registerGuiOverlay(GasWeldingStationGui.class, "gasWeldingStationGas", 5, 11); + API.registerRecipeHandler(new WoodenRollingMachineRecipeHandler()); + API.registerUsageHandler(new WoodenRollingMachineRecipeHandler()); + API.registerGuiOverlay(WoodenRollingMachineGui.class, "woodenRollingMachine", 5, 11); + API.registerRecipeHandler(new CryogenicDistillerRecipeHandler()); + API.registerUsageHandler(new CryogenicDistillerRecipeHandler()); + API.registerGuiOverlay(CryogenicDistillerGui.class, "cryogenicDistiller", 5, 11); + API.registerRecipeHandler(new ChemicalReactorRecipeHandler()); + API.registerUsageHandler(new ChemicalReactorRecipeHandler()); + API.registerGuiOverlay(ChemicalReactorGui.class, "chemicalReactor", 5, 11); + API.registerRecipeHandler(new FluidizedBedReactorRecipeHandler()); + API.registerUsageHandler(new FluidizedBedReactorRecipeHandler()); + API.registerGuiOverlay(FluidizedBedReactorGui.class, "fluidizedBedReactor", 5, 11); + API.registerRecipeHandler(new LabElectrolyzerRecipeHandler()); + API.registerUsageHandler(new LabElectrolyzerRecipeHandler()); + API.registerGuiOverlay(LabElectrolyzerGui.class, "labElectrolyzer", 5, 11); + API.registerRecipeHandler(new RollingMachineRecipeHandler()); + API.registerUsageHandler(new RollingMachineRecipeHandler()); + API.registerGuiOverlay(RollingMachineGui.class, "rollingMachine", 5, 11); + API.registerRecipeHandler(new PaperMachineRecipeHandler()); + API.registerUsageHandler(new PaperMachineRecipeHandler()); + API.registerGuiOverlay(PaperMachineGui.class, "paperMachine", 5, 11); + API.registerRecipeHandler(new ElectrolysisBathRecipeHandler()); + API.registerUsageHandler(new ElectrolysisBathRecipeHandler()); + API.registerGuiOverlay(PaperMachineGui.class, "paperMachine", 5, 11); + API.registerRecipeHandler(new WireMillRecipeHandler()); + API.registerUsageHandler(new WireMillRecipeHandler()); + API.registerGuiOverlay(WireMillGui.class, "wireMill", 5, 11); + API.registerRecipeHandler(new InjectionMoldRecipeHandler()); + API.registerUsageHandler(new InjectionMoldRecipeHandler()); + API.registerRecipeHandler(new VulcanizationExtrudingMoldRecipeHandler()); + API.registerUsageHandler(new VulcanizationExtrudingMoldRecipeHandler()); + API.registerRecipeHandler(new CrucibleRecipeHandler()); + API.registerUsageHandler(new CrucibleRecipeHandler()); + API.registerRecipeHandler(new FractionationColumnRecipeHandler()); + API.registerUsageHandler(new FractionationColumnRecipeHandler()); + API.registerRecipeHandler(new ChimneyKneeRecipeHandler()); + API.registerUsageHandler(new ChimneyKneeRecipeHandler()); + API.registerRecipeHandler(new PrecipitatorCondenserRecipeHandler()); + API.registerUsageHandler(new PrecipitatorCondenserRecipeHandler()); + API.registerRecipeHandler(new IronWorkbenchRecipeHandler()); + API.registerUsageHandler(new IronWorkbenchRecipeHandler()); + this.addSubsets(); + } + + public void addSubsets() {} + + @Override + public String getName() + { + return "IHL"; + } + + @Override + public String getVersion() + { + return IHLModInfo.MODVERSION; + } +} diff --git a/ihl/nei_integration/PaperMachineRecipeHandler.java b/ihl/nei_integration/PaperMachineRecipeHandler.java new file mode 100644 index 0000000..5a6e0e2 --- /dev/null +++ b/ihl/nei_integration/PaperMachineRecipeHandler.java @@ -0,0 +1,74 @@ +package ihl.nei_integration; + +import java.util.Map; + +import ihl.processing.chemistry.PaperMachineGui; +import ihl.processing.chemistry.PaperMachineTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class PaperMachineRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return PaperMachineGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{78-5,78-5-18,122-5-18,122-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{15-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{122-5,122-5-18,78-5-18}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{51-11,51-11,51-11}; + } + + + @Override + public String getRecipeName() + { + return "Paper machine"; + } + + @Override + public String getRecipeId() + { + return "ihl.paperMachine"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIPaperMachine.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "paperMachine"; + } + + @Override + public Map getRecipeList() + { + return PaperMachineTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/PrecipitatorCondenserRecipeHandler.java b/ihl/nei_integration/PrecipitatorCondenserRecipeHandler.java new file mode 100644 index 0000000..530ebaf --- /dev/null +++ b/ihl/nei_integration/PrecipitatorCondenserRecipeHandler.java @@ -0,0 +1,73 @@ +package ihl.nei_integration; + +import java.util.Map; + +import ihl.processing.chemistry.PrecipitatorCondenserTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class PrecipitatorCondenserRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return null; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{6-5,6-5,106-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{33-11,53-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{75-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{53-11,31-11}; + } + + + @Override + public String getRecipeName() + { + return "Precipitator/Condenser"; + } + + @Override + public String getRecipeId() + { + return "ihl.precipitatorCondenser"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUICondenserNEI.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "condenser"; + } + + @Override + public Map getRecipeList() + { + return PrecipitatorCondenserTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/RollingMachineRecipeHandler.java b/ihl/nei_integration/RollingMachineRecipeHandler.java new file mode 100644 index 0000000..d550ee7 --- /dev/null +++ b/ihl/nei_integration/RollingMachineRecipeHandler.java @@ -0,0 +1,73 @@ +package ihl.nei_integration; + +import java.util.Map; + +import ihl.processing.metallurgy.RollingMachineGui; +import ihl.processing.metallurgy.RollingMachinePart1TileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class RollingMachineRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return RollingMachineGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{54-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{25-11,34-11,53-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{105-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{25-11}; + } + + @Override + public String getRecipeName() + { + return "Rolling machine"; + } + + @Override + public String getRecipeId() + { + return "ihl.rollingMachine"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIRollingMachine.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "rollingMachine"; + } + + @Override + public Map getRecipeList() + { + return RollingMachinePart1TileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java b/ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java new file mode 100644 index 0000000..0da133e --- /dev/null +++ b/ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java @@ -0,0 +1,73 @@ +package ihl.nei_integration; + +import java.util.Map; + +import ihl.processing.metallurgy.VulcanizationExtrudingMoldTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class VulcanizationExtrudingMoldRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return null; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{41-5,16-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{17-11,46-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{123-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{46-11}; + } + + + @Override + public String getRecipeName() + { + return "Vulcanization extruding mold"; + } + + @Override + public String getRecipeId() + { + return "ihl.culcanizationExtrudingMold"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIVulcanizationExtrudingMoldNEI.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "vulcanizationExtrudingMold"; + } + + @Override + public Map getRecipeList() + { + return VulcanizationExtrudingMoldTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/WireMillRecipeHandler.java b/ihl/nei_integration/WireMillRecipeHandler.java new file mode 100644 index 0000000..7a0cafe --- /dev/null +++ b/ihl/nei_integration/WireMillRecipeHandler.java @@ -0,0 +1,109 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; + +import ihl.processing.metallurgy.WireMillGui; +import ihl.processing.metallurgy.WireMillTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class WireMillRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return WireMillGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{117-5,44-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{31-11,14-11}; + } + + @Override + protected int[] getFluidInputPosX() + { + return new int[]{8-5,26-5,44-5}; + } + + @Override + protected int[] getFluidInputPosY() + { + return new int[]{14-11}; + } + + + @Override + protected int[] getOutputPosX() + { + return new int[]{152-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{31-11}; + } + + + @Override + public String getRecipeName() + { + return "Wire mill"; + } + + @Override + public String getRecipeId() + { + return "ihl.wireMill"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIWireMill.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "wireMill"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(134-5, 33-11, 18, 13), this.getRecipeId(), new Object[0])); + } + + @Override + public void drawBackground(int i) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 5, 11, 151, 65); + GuiDraw.drawTexturedModalRect(133-5+18, 30-11, 98+18, 30, 18, 18); + GuiDraw.drawTexturedModalRect(7-5+18, 13-11, 25+18, 13, 18, 18); + GuiDraw.drawTexturedModalRect(7-5, 13-11, 25+18, 13, 18, 18); + } + + @Override + public Map getRecipeList() + { + return WireMillTileEntity.getRecipes(); + } +} diff --git a/ihl/nei_integration/WoodenRollingMachineRecipeHandler.java b/ihl/nei_integration/WoodenRollingMachineRecipeHandler.java new file mode 100644 index 0000000..ea44298 --- /dev/null +++ b/ihl/nei_integration/WoodenRollingMachineRecipeHandler.java @@ -0,0 +1,80 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import ihl.processing.metallurgy.WoodenRollingMachineGui; +import ihl.processing.metallurgy.WoodenRollingMachinePart1TileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class WoodenRollingMachineRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return WoodenRollingMachineGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{123-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{15-11,34-11,53-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{54-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{25-11}; + } + + @Override + public String getRecipeName() + { + return "Wooden rolling machine"; + } + + @Override + public String getRecipeId() + { + return "ihl.woodenRollingMachine"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIWoodenRollingMachine.png"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(74-5,16-11, 46, 48), this.getRecipeId(), new Object[0])); + } + + @Override + public String getOverlayIdentifier() + { + return "woodenRollingMachine"; + } + + @Override + public Map getRecipeList() + { + return WoodenRollingMachinePart1TileEntity.getRecipes(); + } +} -- cgit v1.2.3