From 0427ab89f1753a44b30cbc35ce021cbbdc845109 Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Thu, 10 Aug 2017 18:52:45 +0300 Subject: fix missing source folder --- .../AchesonFurnaceRecipeHandler.java | 74 ++++ .../ChemicalReactorRecipeHandler.java | 125 +++++++ .../ihl/nei_integration/CrucibleRecipeHandler.java | 79 ++++ .../CryogenicDistillerRecipeHandler.java | 106 ++++++ .../DetonationSprayingMachineRecipeHandler.java | 82 ++++ .../ElectricEvaporatorRecipeHandler.java | 74 ++++ .../ElectrolysisBathRecipeHandler.java | 74 ++++ .../nei_integration/EvaporatorRecipeHandler.java | 74 ++++ .../ihl/nei_integration/ExtruderRecipeHandler.java | 63 ++++ .../FluidizedBedReactorRecipeHandler.java | 106 ++++++ .../FractionationColumnRecipeHandler.java | 66 ++++ .../GasWeldingStationGasRecipeHandler.java | 74 ++++ .../nei_integration/IHLBlockHighlightHandler.java | 46 +++ .../ihl/nei_integration/IHLPositionedStack.java | 45 +++ .../java/ihl/nei_integration/IHLRecipeHandler.java | 242 ++++++++++++ .../ImpregnatingMachineRecipeHandler.java | 106 ++++++ .../InjectionMoldRecipeHandler.java | 64 ++++ .../IronWorkbenchRecipeHandler.java | 283 ++++++++++++++ .../LabElectrolyzerRecipeHandler.java | 77 ++++ .../ihl/nei_integration/LeadOvenRecipeHandler.java | 83 +++++ .../ihl/nei_integration/LoomRecipeHandler.java | 74 ++++ .../ihl/nei_integration/MachineRecipeHandler.java | 413 +++++++++++++++++++++ .../MuffleFurnaceRecipeHandler.java | 83 +++++ .../java/ihl/nei_integration/NEIIHLConfig.java | 116 ++++++ .../nei_integration/PaperMachineRecipeHandler.java | 75 ++++ .../RollingMachineRecipeHandler.java | 67 ++++ .../VulcanizationExtrudingMoldRecipeHandler.java | 66 ++++ .../ihl/nei_integration/WireMillRecipeHandler.java | 101 +++++ .../WoodenRollingMachineRecipeHandler.java | 74 ++++ 29 files changed, 3012 insertions(+) create mode 100644 src/main/java/ihl/nei_integration/AchesonFurnaceRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/ChemicalReactorRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/CrucibleRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/CryogenicDistillerRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/ElectricEvaporatorRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/ElectrolysisBathRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/EvaporatorRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/ExtruderRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/FractionationColumnRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/GasWeldingStationGasRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/IHLBlockHighlightHandler.java create mode 100644 src/main/java/ihl/nei_integration/IHLPositionedStack.java create mode 100644 src/main/java/ihl/nei_integration/IHLRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/ImpregnatingMachineRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/InjectionMoldRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/IronWorkbenchRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/LabElectrolyzerRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/LeadOvenRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/LoomRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/MachineRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/MuffleFurnaceRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/NEIIHLConfig.java create mode 100644 src/main/java/ihl/nei_integration/PaperMachineRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/RollingMachineRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/WireMillRecipeHandler.java create mode 100644 src/main/java/ihl/nei_integration/WoodenRollingMachineRecipeHandler.java (limited to 'src/main/java/ihl/nei_integration') diff --git a/src/main/java/ihl/nei_integration/AchesonFurnaceRecipeHandler.java b/src/main/java/ihl/nei_integration/AchesonFurnaceRecipeHandler.java new file mode 100644 index 0000000..2ffa450 --- /dev/null +++ b/src/main/java/ihl/nei_integration/AchesonFurnaceRecipeHandler.java @@ -0,0 +1,74 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import ihl.processing.metallurgy.AchesonFurnaceGui; +import ihl.processing.metallurgy.AchesonFurnanceTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +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[]{40-5,40-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{40-11,22-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{98-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{32-11}; + } + + @Override + public String getRecipeId() + { + return "ihl.achesonFurnace"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIAchesonFurnace.png"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(57-5, 29-11, 40, 30), this.getRecipeId(), new Object[0])); + } + + @Override + public String getOverlayIdentifier() + { + return "achesonFurnace"; + } + + @Override + public Map getRecipeList() + { + return AchesonFurnanceTileEntity.getRecipes(); + } +} diff --git a/src/main/java/ihl/nei_integration/ChemicalReactorRecipeHandler.java b/src/main/java/ihl/nei_integration/ChemicalReactorRecipeHandler.java new file mode 100644 index 0000000..53eeb8d --- /dev/null +++ b/src/main/java/ihl/nei_integration/ChemicalReactorRecipeHandler.java @@ -0,0 +1,125 @@ +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[]{60-5,42-5,24-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 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(23-5, 14-11, 59, 14, 18, 18); + 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(); + } +} diff --git a/src/main/java/ihl/nei_integration/CrucibleRecipeHandler.java b/src/main/java/ihl/nei_integration/CrucibleRecipeHandler.java new file mode 100644 index 0000000..87bd6a2 --- /dev/null +++ b/src/main/java/ihl/nei_integration/CrucibleRecipeHandler.java @@ -0,0 +1,79 @@ +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 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/src/main/java/ihl/nei_integration/CryogenicDistillerRecipeHandler.java b/src/main/java/ihl/nei_integration/CryogenicDistillerRecipeHandler.java new file mode 100644 index 0000000..374d66e --- /dev/null +++ b/src/main/java/ihl/nei_integration/CryogenicDistillerRecipeHandler.java @@ -0,0 +1,106 @@ +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(57-5, 32-10, 63, 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 getRecipeId() + { + return "ihl.cryogenicDistiller"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUICryogenicDistiller.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "cryogenicDistiller"; + } + + @SuppressWarnings("unchecked") + @Override + public void drawExtras(int recipeNumber) + { + super.drawExtras(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/src/main/java/ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java b/src/main/java/ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java new file mode 100644 index 0000000..e821bef --- /dev/null +++ b/src/main/java/ihl/nei_integration/DetonationSprayingMachineRecipeHandler.java @@ -0,0 +1,82 @@ +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 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/src/main/java/ihl/nei_integration/ElectricEvaporatorRecipeHandler.java b/src/main/java/ihl/nei_integration/ElectricEvaporatorRecipeHandler.java new file mode 100644 index 0000000..349601a --- /dev/null +++ b/src/main/java/ihl/nei_integration/ElectricEvaporatorRecipeHandler.java @@ -0,0 +1,74 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import ihl.processing.chemistry.ElectricEvaporatorGui; +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 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/src/main/java/ihl/nei_integration/ElectrolysisBathRecipeHandler.java b/src/main/java/ihl/nei_integration/ElectrolysisBathRecipeHandler.java new file mode 100644 index 0000000..bf91f03 --- /dev/null +++ b/src/main/java/ihl/nei_integration/ElectrolysisBathRecipeHandler.java @@ -0,0 +1,74 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +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 getRecipeId() + { + return "ihl.electrolysisBath"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIElectrolysisBath.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "electrolysisBath"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(115-5,10-10, 172-115, 72), this.getRecipeId(), new Object[0])); + } + + @Override + public Map getRecipeList() + { + return ElectrolysisBathTileEntity.getRecipes(); + } +} diff --git a/src/main/java/ihl/nei_integration/EvaporatorRecipeHandler.java b/src/main/java/ihl/nei_integration/EvaporatorRecipeHandler.java new file mode 100644 index 0000000..54eb4e9 --- /dev/null +++ b/src/main/java/ihl/nei_integration/EvaporatorRecipeHandler.java @@ -0,0 +1,74 @@ +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 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/src/main/java/ihl/nei_integration/ExtruderRecipeHandler.java b/src/main/java/ihl/nei_integration/ExtruderRecipeHandler.java new file mode 100644 index 0000000..64dd072 --- /dev/null +++ b/src/main/java/ihl/nei_integration/ExtruderRecipeHandler.java @@ -0,0 +1,63 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +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 getRecipeId() { + return "ihl.extruder"; + } + + @Override + public String getGuiTexture() { + return "ihl:textures/gui/GUIExtruder.png"; + } + + @Override + public String getOverlayIdentifier() { + return "extruder"; + } + + @Override + public void loadTransferRects() { + this.transferRects + .add(new RecipeTransferRect(new Rectangle(74 - 5, 31 - 10, 18, 18), this.getRecipeId(), new Object[0])); + } + + @Override + public Map getRecipeList() { + return ExtruderTileEntity.getRecipes(); + } +} diff --git a/src/main/java/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java b/src/main/java/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java new file mode 100644 index 0000000..2f9c581 --- /dev/null +++ b/src/main/java/ihl/nei_integration/FluidizedBedReactorRecipeHandler.java @@ -0,0 +1,106 @@ +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[]{41-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[]{76-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 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(58-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/src/main/java/ihl/nei_integration/FractionationColumnRecipeHandler.java b/src/main/java/ihl/nei_integration/FractionationColumnRecipeHandler.java new file mode 100644 index 0000000..693dce2 --- /dev/null +++ b/src/main/java/ihl/nei_integration/FractionationColumnRecipeHandler.java @@ -0,0 +1,66 @@ +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 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/src/main/java/ihl/nei_integration/GasWeldingStationGasRecipeHandler.java b/src/main/java/ihl/nei_integration/GasWeldingStationGasRecipeHandler.java new file mode 100644 index 0000000..eef6b75 --- /dev/null +++ b/src/main/java/ihl/nei_integration/GasWeldingStationGasRecipeHandler.java @@ -0,0 +1,74 @@ +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 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/src/main/java/ihl/nei_integration/IHLBlockHighlightHandler.java b/src/main/java/ihl/nei_integration/IHLBlockHighlightHandler.java new file mode 100644 index 0000000..1fc3666 --- /dev/null +++ b/src/main/java/ihl/nei_integration/IHLBlockHighlightHandler.java @@ -0,0 +1,46 @@ +package ihl.nei_integration; + +import java.util.List; + +import codechicken.nei.api.IHighlightHandler; +import codechicken.nei.api.ItemInfo; +import ihl.flexible_cable.RectifierTransformerUnitTileEntity; +import net.minecraft.entity.player.EntityPlayer; +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; + +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/src/main/java/ihl/nei_integration/IHLPositionedStack.java b/src/main/java/ihl/nei_integration/IHLPositionedStack.java new file mode 100644 index 0000000..d00083d --- /dev/null +++ b/src/main/java/ihl/nei_integration/IHLPositionedStack.java @@ -0,0 +1,45 @@ +package ihl.nei_integration; + +import java.util.Arrays; +import java.util.List; + +import codechicken.nei.PositionedStack; +import ic2.core.Ic2Items; +import ic2.core.item.ItemFluidCell; +import ihl.recipes.RecipeOutputItemStack; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +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; + } + + public IHLPositionedStack(FluidStack fluidStack, int x, int y) + { + super(Ic2Items.FluidCell.copy(), x, y); + ItemStack fluidCellStack = this.items[0]; + ((ItemFluidCell)fluidCellStack.getItem()).fill(fluidCellStack, fluidStack, true); + sQuantity=fluidStack.amount/1000f; + this.item=this.items[0]=fluidCellStack; + } + + + public IHLPositionedStack(List list, int x, int y) { + super(Ic2Items.FluidCell.copy(),x,y); + sQuantity = list.get(0).amount/1000f; + this.items = new ItemStack[list.size()]; + for(int i=0;i 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 = 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 = i$.next(); + Iterator i$1 = ((RecipeOutput)entry.getValue()).items.iterator(); + + while (i$1.hasNext()) + { + ItemStack output = 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 = 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 = 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/src/main/java/ihl/nei_integration/ImpregnatingMachineRecipeHandler.java b/src/main/java/ihl/nei_integration/ImpregnatingMachineRecipeHandler.java new file mode 100644 index 0000000..9abad4b --- /dev/null +++ b/src/main/java/ihl/nei_integration/ImpregnatingMachineRecipeHandler.java @@ -0,0 +1,106 @@ +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 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/src/main/java/ihl/nei_integration/InjectionMoldRecipeHandler.java b/src/main/java/ihl/nei_integration/InjectionMoldRecipeHandler.java new file mode 100644 index 0000000..e125b54 --- /dev/null +++ b/src/main/java/ihl/nei_integration/InjectionMoldRecipeHandler.java @@ -0,0 +1,64 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +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 getRecipeId() { + return "ihl.casting"; + } + + @Override + public String getGuiTexture() { + return "ihl:textures/gui/GUICastingNEI.png"; + } + + @Override + public String getOverlayIdentifier() { + return "casting"; + } + + @Override + public void loadTransferRects() { + this.transferRects + .add(new RecipeTransferRect(new Rectangle(64 - 5, 32 - 10, 18, 18), this.getRecipeId(), new Object[0])); + this.transferRects + .add(new RecipeTransferRect(new Rectangle(82 - 5, 50 - 10, 18, 18), this.getRecipeId(), new Object[0])); + } + + @Override + public Map getRecipeList() { + return InjectionMoldTileEntity.getRecipes(); + } +} diff --git a/src/main/java/ihl/nei_integration/IronWorkbenchRecipeHandler.java b/src/main/java/ihl/nei_integration/IronWorkbenchRecipeHandler.java new file mode 100644 index 0000000..c060bb7 --- /dev/null +++ b/src/main/java/ihl/nei_integration/IronWorkbenchRecipeHandler.java @@ -0,0 +1,283 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import ic2.api.recipe.IRecipeInput; +import ihl.flexible_cable.IronWorkbenchGui; +import ihl.flexible_cable.IronWorkbenchTileEntity; +import ihl.interfaces.IWire; +import ihl.recipes.IronWorkbenchRecipe; +import ihl.utils.IHLUtils; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; + +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 StatCollector.translateToLocal(getRecipeId()); + } + + @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) + { + 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 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 = 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 = 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 = 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 = i.next(); + if(index>0) + { + this.otherStacks.add(new PositionedStack(stack, x, y)); + } + index++; + } + } + } + + } +} diff --git a/src/main/java/ihl/nei_integration/LabElectrolyzerRecipeHandler.java b/src/main/java/ihl/nei_integration/LabElectrolyzerRecipeHandler.java new file mode 100644 index 0000000..a9df742 --- /dev/null +++ b/src/main/java/ihl/nei_integration/LabElectrolyzerRecipeHandler.java @@ -0,0 +1,77 @@ +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.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[] { 63 - 5, 46 - 5, 29 - 5 }; + } + + @Override + protected int[] getInputPosY() { + return new int[] { 11 - 10 }; + } + + @Override + protected int[] getOutputPosX() { + return new int[] { 29 - 5, 63 - 5, 109 - 5 }; + } + + @Override + protected int[] getOutputPosY() { + return new int[] { 47 - 10 }; + } + + @Override + public String getRecipeId() { + return "ihl.labElectrolyzer"; + } + + @Override + public String getGuiTexture() { + return "ihl:textures/gui/GUILabElectrolyzer.png"; + } + + @Override + public void loadTransferRects() { + this.transferRects + .add(new RecipeTransferRect(new Rectangle(28 - 5, 28 - 10, 18, 18), this.getRecipeId(), new Object[0])); + this.transferRects + .add(new RecipeTransferRect(new Rectangle(108 - 5, 32 - 10, 18, 18), this.getRecipeId(), new Object[0])); + } + + @Override + public String getOverlayIdentifier() { + return "labElectrolyzer"; + } + + @Override + public void drawBackground(int recipeNumber) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiDraw.changeTexture(this.getGuiTexture()); + GuiDraw.drawTexturedModalRect(0, 0, 5, 10, 140, 54); + GuiDraw.drawTexturedModalRect(46-5, 10-10, 62, 10, 18, 18); + } + + @Override + public Map getRecipeList() { + return LabElectrolyzerTileEntity.getRecipes(); + } +} diff --git a/src/main/java/ihl/nei_integration/LeadOvenRecipeHandler.java b/src/main/java/ihl/nei_integration/LeadOvenRecipeHandler.java new file mode 100644 index 0000000..8a7f686 --- /dev/null +++ b/src/main/java/ihl/nei_integration/LeadOvenRecipeHandler.java @@ -0,0 +1,83 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +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[] { 9 - 5 }; + } + + @Override + protected int[] getFluidOutputPosY() { + return new int[] { 53 - 11 }; + } + + @Override + protected int[] getFluidInputPosX() { + return new int[] { 9 - 5 }; + } + + @Override + protected int[] getFluidInputPosY() { + return new int[] { 17 - 11 }; + } + + @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 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/src/main/java/ihl/nei_integration/LoomRecipeHandler.java b/src/main/java/ihl/nei_integration/LoomRecipeHandler.java new file mode 100644 index 0000000..d34f505 --- /dev/null +++ b/src/main/java/ihl/nei_integration/LoomRecipeHandler.java @@ -0,0 +1,74 @@ +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 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/src/main/java/ihl/nei_integration/MachineRecipeHandler.java b/src/main/java/ihl/nei_integration/MachineRecipeHandler.java new file mode 100644 index 0000000..eba0855 --- /dev/null +++ b/src/main/java/ihl/nei_integration/MachineRecipeHandler.java @@ -0,0 +1,413 @@ +package ihl.nei_integration; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.lwjgl.opengl.GL11; + +import codechicken.lib.gui.GuiDraw; +import codechicken.nei.NEIServerUtils; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.TemplateRecipeHandler; +import ic2.api.recipe.IRecipeInput; +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 net.minecraft.block.Block; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +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; + +public abstract class MachineRecipeHandler extends TemplateRecipeHandler { + protected int ticks; + + @Override + public String getRecipeName() { + return StatCollector.translateToLocal(getRecipeId()); + } + + 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); + for (PositionedStack stack : recipe.ingredients) { + if (stack.item.stackSize == 0) { + GuiDraw.fontRenderer.drawStringWithShadow("0.001", stack.relx + 3, stack.rely + 9, 16777215); + } + if (stack instanceof IHLPositionedStack) + drawFormattedString((IHLPositionedStack) stack); + + } + for (PositionedStack stack : recipe.otherStacks) { + if (stack instanceof IHLPositionedStack) + drawFormattedString((IHLPositionedStack) stack); + } + if (recipe.output instanceof IHLPositionedStack) { + IHLPositionedStack rOutput = (IHLPositionedStack) recipe.output; + 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 = i$.next(); + this.arecipes.add(new MachineRecipeHandler.CachedIORecipe(entry.getKey(), 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 = i$.next(); + Iterator i$1 = ((UniversalRecipeOutput) entry.getValue()).getFluidOutputs().iterator(); + while (i$1.hasNext()) { + FluidStack output = 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 = i$.next(); + Iterator i$1 = (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(entry.getKey(), 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 = i$.next(); + if (((UniversalRecipeInput) entry.getKey()).containFluidStack(fluidStack)) { + this.arecipes.add(new MachineRecipeHandler.CachedIORecipe(entry.getKey(), entry.getValue(), + getAdditionalIngredients())); + } + } + } else { + while (i$.hasNext()) { + Entry entry = i$.next(); + if (((UniversalRecipeInput) entry.getKey()).containItemStack(ingredient)) { + this.arecipes.add(new MachineRecipeHandler.CachedIORecipe(entry.getKey(), 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; + public UniversalRecipeInput urInput; + public UniversalRecipeOutput urOutput; + + @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 { + this.urInput = input; + this.urOutput = output1; + 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(); + fluidItems.add(fstackList); + } + } + + 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 (var7 < MachineRecipeHandler.this.getOutputPosX().length) { + x = MachineRecipeHandler.this.getOutputPosX()[var7]; + } + if (var7 < MachineRecipeHandler.this.getOutputPosY().length) { + y = MachineRecipeHandler.this.getOutputPosY()[var7]; + } + if (rOut != null) { + this.otherStacks.add(new IHLPositionedStack(rOut, x, y)); + } + } + } else { + if (MachineRecipeHandler.this.getFluidOutputPosX() != null) { + this.output = new IHLPositionedStack(output1.getFluidOutputs().get(0), + MachineRecipeHandler.this.getFluidOutputPosX()[0], + MachineRecipeHandler.this.getFluidOutputPosY()[0]); + } else { + this.output = new IHLPositionedStack(output1.getFluidOutputs().get(0), 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(); + var7++; + if (MachineRecipeHandler.this.getFluidOutputPosX() != null) { + if (var8 < MachineRecipeHandler.this.getFluidOutputPosX().length) { + x = MachineRecipeHandler.this.getFluidOutputPosX()[var8]; + } + if (var8 < MachineRecipeHandler.this.getFluidOutputPosY().length) { + y = MachineRecipeHandler.this.getFluidOutputPosY()[var8]; + } + var8++; + } else { + if (var7 < MachineRecipeHandler.this.getOutputPosX().length) { + x = MachineRecipeHandler.this.getOutputPosX()[var7]; + } + if (var7 < MachineRecipeHandler.this.getOutputPosY().length) { + y = MachineRecipeHandler.this.getOutputPosY()[var7]; + } + } + this.otherStacks.add(new IHLPositionedStack(fstack, x, y)); + } + } + + if (MachineRecipeHandler.this.getFluidInputPosX() != null) { + int x = MachineRecipeHandler.this.getFluidInputPosX()[0], + y = MachineRecipeHandler.this.getFluidInputPosY()[0]; + for (int i = 0; i < fluidItems.size(); i++) { + if (i < MachineRecipeHandler.this.getFluidInputPosX().length) { + x = MachineRecipeHandler.this.getFluidInputPosX()[i]; + } + if (i < MachineRecipeHandler.this.getFluidInputPosY().length) { + y = MachineRecipeHandler.this.getFluidInputPosY()[i]; + } + this.ingredients.add(new IHLPositionedStack(fluidItems.get(i), x, y)); + } + x = MachineRecipeHandler.this.getInputPosX()[0]; + y = MachineRecipeHandler.this.getInputPosY()[0]; + for (int i = 0; i < items.size(); i++) { + if (i < MachineRecipeHandler.this.getInputPosX().length) { + x = MachineRecipeHandler.this.getInputPosX()[i]; + } + if (i < MachineRecipeHandler.this.getInputPosY().length) { + y = MachineRecipeHandler.this.getInputPosY()[i]; + } + this.ingredients.add(new PositionedStack(items.get(i), x, y)); + } + } else { + int x = MachineRecipeHandler.this.getInputPosX()[0], + y = MachineRecipeHandler.this.getInputPosY()[0]; + for (int i = 0; i < fluidItems.size() + items.size(); i++) { + if (i < MachineRecipeHandler.this.getInputPosX().length) { + x = MachineRecipeHandler.this.getInputPosX()[i]; + } + if (i < MachineRecipeHandler.this.getInputPosY().length) { + y = MachineRecipeHandler.this.getInputPosY()[i]; + } + if (i < fluidItems.size()) { + this.ingredients.add(new IHLPositionedStack(fluidItems.get(i), x, y)); + } else { + this.ingredients.add(new PositionedStack(items.get(i - fluidItems.size()), x, y)); + } + } + } + if (additionalIngredients != null) { + this.ingredients.addAll(additionalIngredients); + } + } + } + } +} diff --git a/src/main/java/ihl/nei_integration/MuffleFurnaceRecipeHandler.java b/src/main/java/ihl/nei_integration/MuffleFurnaceRecipeHandler.java new file mode 100644 index 0000000..c5ff0c9 --- /dev/null +++ b/src/main/java/ihl/nei_integration/MuffleFurnaceRecipeHandler.java @@ -0,0 +1,83 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +import java.util.Map; + +import codechicken.lib.gui.GuiDraw; +import ihl.processing.metallurgy.MuffleFurnaceGui; +import ihl.processing.metallurgy.MuffleFurnanceTileEntity; +import ihl.recipes.UniversalRecipeInput; +import ihl.recipes.UniversalRecipeOutput; +import net.minecraft.client.gui.inventory.GuiContainer; + + +public class MuffleFurnaceRecipeHandler extends MachineRecipeHandler +{ + @Override + public Class getGuiClass() + { + return MuffleFurnaceGui.class; + } + + @Override + protected int[] getInputPosX() + { + return new int[]{40-5,40-5}; + } + + @Override + protected int[] getInputPosY() + { + return new int[]{40-11,22-11}; + } + + @Override + protected int[] getOutputPosX() + { + return new int[]{98-5}; + } + + @Override + protected int[] getOutputPosY() + { + return new int[]{32-11}; + } + + @Override + public String getRecipeId() + { + return "ihl.muffleFurnace"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIAchesonFurnace.png"; + } + + @Override + public String getOverlayIdentifier() + { + return "muffleFurnace"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(57-5, 29-11, 40, 30), 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/src/main/java/ihl/nei_integration/NEIIHLConfig.java b/src/main/java/ihl/nei_integration/NEIIHLConfig.java new file mode 100644 index 0000000..c1867a7 --- /dev/null +++ b/src/main/java/ihl/nei_integration/NEIIHLConfig.java @@ -0,0 +1,116 @@ +package ihl.nei_integration; + +import codechicken.nei.api.API; +import codechicken.nei.api.IConfigureNEI; +import codechicken.nei.api.ItemInfo; +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; + +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 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/src/main/java/ihl/nei_integration/PaperMachineRecipeHandler.java b/src/main/java/ihl/nei_integration/PaperMachineRecipeHandler.java new file mode 100644 index 0000000..0a5fc90 --- /dev/null +++ b/src/main/java/ihl/nei_integration/PaperMachineRecipeHandler.java @@ -0,0 +1,75 @@ +package ihl.nei_integration; + +import java.awt.Rectangle; +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 getRecipeId() + { + return "ihl.paperMachine"; + } + + @Override + public String getGuiTexture() + { + return "ihl:textures/gui/GUIPaperMachine.png"; + } + + @Override + public void loadTransferRects() + { + this.transferRects.add(new RecipeTransferRect(new Rectangle(25-5, 11-11, 52, 74), this.getRecipeId(), new Object[0])); + } + + + @Override + public String getOverlayIdentifier() + { + return "paperMachine"; + } + + @Override + public Map getRecipeList() + { + return PaperMachineTileEntity.getRecipes(); + } +} diff --git a/src/main/java/ihl/nei_integration/RollingMachineRecipeHandler.java b/src/main/java/ihl/nei_integration/RollingMachineRecipeHandler.java new file mode 100644 index 0000000..1a8e4ee --- /dev/null +++ b/src/main/java/ihl/nei_integration/RollingMachineRecipeHandler.java @@ -0,0 +1,67 @@ +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 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/src/main/java/ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java b/src/main/java/ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java new file mode 100644 index 0000000..2ca3b46 --- /dev/null +++ b/src/main/java/ihl/nei_integration/VulcanizationExtrudingMoldRecipeHandler.java @@ -0,0 +1,66 @@ +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 getRecipeId() + { + return "ihl.vulcanizationExtrudingMold"; + } + + @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/src/main/java/ihl/nei_integration/WireMillRecipeHandler.java b/src/main/java/ihl/nei_integration/WireMillRecipeHandler.java new file mode 100644 index 0000000..aebf85e --- /dev/null +++ b/src/main/java/ihl/nei_integration/WireMillRecipeHandler.java @@ -0,0 +1,101 @@ +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 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/src/main/java/ihl/nei_integration/WoodenRollingMachineRecipeHandler.java b/src/main/java/ihl/nei_integration/WoodenRollingMachineRecipeHandler.java new file mode 100644 index 0000000..f8adb4f --- /dev/null +++ b/src/main/java/ihl/nei_integration/WoodenRollingMachineRecipeHandler.java @@ -0,0 +1,74 @@ +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 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