From 836dd3c22a755d7287b0000f779d1ab2019d3b5d Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Fri, 10 Jan 2014 12:58:05 -0500 Subject: [PATCH] Electrolytic Separator NEI plugin --- .../{ChemicalInput.java => ChemicalPair.java} | 20 +- common/mekanism/api/RecipeHelper.java | 8 +- .../nei/ChemicalInfuserRecipeHandler.java | 14 +- .../ElectrolyticSeparatorRecipeHandler.java | 334 +++++++++++++++++- .../client/nei/NEIMekanismConfig.java | 5 + .../RotaryCondensentratorRecipeHandler.java | 14 +- common/mekanism/common/Mekanism.java | 12 +- .../mekanism/common/recipe/RecipeHandler.java | 24 +- .../tile/TileEntityElectrolyticSeparator.java | 8 +- .../mekanism/gui/GuiElectrolyticSeparator.png | Bin 4193 -> 4280 bytes 10 files changed, 387 insertions(+), 52 deletions(-) rename common/mekanism/api/{ChemicalInput.java => ChemicalPair.java} (82%) diff --git a/common/mekanism/api/ChemicalInput.java b/common/mekanism/api/ChemicalPair.java similarity index 82% rename from common/mekanism/api/ChemicalInput.java rename to common/mekanism/api/ChemicalPair.java index 5721d44ee..cd79ed24e 100644 --- a/common/mekanism/api/ChemicalInput.java +++ b/common/mekanism/api/ChemicalPair.java @@ -8,7 +8,7 @@ import mekanism.api.gas.GasTank; * @author aidancbrady * */ -public class ChemicalInput +public class ChemicalPair { /** The left gas of this chemical input */ public GasStack leftGas; @@ -21,7 +21,7 @@ public class ChemicalInput * @param left - left gas * @param right - right gas */ - public ChemicalInput(GasStack left, GasStack right) + public ChemicalPair(GasStack left, GasStack right) { leftGas = left; rightGas = right; @@ -41,7 +41,7 @@ public class ChemicalInput * @param input - input to check * @return if the input meets this input's requirements */ - public boolean meetsInput(ChemicalInput input) + public boolean meetsInput(ChemicalPair input) { return meets(input) || meets(input.swap()); } @@ -50,9 +50,9 @@ public class ChemicalInput * Swaps the right gas and left gas of this input. * @return a swapped ChemicalInput */ - public ChemicalInput swap() + public ChemicalPair swap() { - return new ChemicalInput(rightGas, leftGas); + return new ChemicalPair(rightGas, leftGas); } /** @@ -62,12 +62,12 @@ public class ChemicalInput */ public void draw(GasTank leftTank, GasTank rightTank) { - if(meets(new ChemicalInput(leftTank.getGas(), rightTank.getGas()))) + if(meets(new ChemicalPair(leftTank.getGas(), rightTank.getGas()))) { leftTank.draw(leftGas.amount, true); rightTank.draw(rightGas.amount, true); } - else if(meets(new ChemicalInput(rightTank.getGas(), leftTank.getGas()))) + else if(meets(new ChemicalPair(rightTank.getGas(), leftTank.getGas()))) { leftTank.draw(rightGas.amount, true); rightTank.draw(leftGas.amount, true); @@ -94,7 +94,7 @@ public class ChemicalInput * @param input - input to check * @return if the input meets this input's requirements */ - private boolean meets(ChemicalInput input) + private boolean meets(ChemicalPair input) { if(input == null || !input.isValid()) { @@ -109,8 +109,8 @@ public class ChemicalInput return input.leftGas.amount >= leftGas.amount && input.rightGas.amount >= rightGas.amount; } - public ChemicalInput copy() + public ChemicalPair copy() { - return new ChemicalInput(leftGas.copy(), rightGas.copy()); + return new ChemicalPair(leftGas.copy(), rightGas.copy()); } } diff --git a/common/mekanism/api/RecipeHelper.java b/common/mekanism/api/RecipeHelper.java index 65c664257..4fc59c4eb 100644 --- a/common/mekanism/api/RecipeHelper.java +++ b/common/mekanism/api/RecipeHelper.java @@ -115,11 +115,11 @@ public final class RecipeHelper * @param input - input ChemicalInput * @param output - output GasStack */ - public static void addChemicalInfuserRecipe(ChemicalInput input, GasStack output) + public static void addChemicalInfuserRecipe(ChemicalPair input, GasStack output) { try { Class recipeClass = Class.forName("mekanism.common.RecipeHandler"); - Method m = recipeClass.getMethod("addChemicalInfuserRecipe", ChemicalInput.class, GasStack.class); + Method m = recipeClass.getMethod("addChemicalInfuserRecipe", ChemicalPair.class, GasStack.class); m.invoke(null, input, output); } catch(Exception e) { System.err.println("[Mekanism] Error while adding recipe: " + e.getMessage()); @@ -147,11 +147,11 @@ public final class RecipeHelper * @param input - input ItemStack * @param output - output ItemStack */ - public static void addElectrolyticSeparatorRecipe(FluidStack input, ChemicalInput output) + public static void addElectrolyticSeparatorRecipe(FluidStack input, ChemicalPair output) { try { Class recipeClass = Class.forName("mekanism.common.RecipeHandler"); - Method m = recipeClass.getMethod("addElectrolyticSeparatorRecipe", FluidStack.class, ChemicalInput.class); + Method m = recipeClass.getMethod("addElectrolyticSeparatorRecipe", FluidStack.class, ChemicalPair.class); m.invoke(null, input, output); } catch(Exception e) { System.err.println("[Mekanism] Error while adding recipe: " + e.getMessage()); diff --git a/common/mekanism/client/nei/ChemicalInfuserRecipeHandler.java b/common/mekanism/client/nei/ChemicalInfuserRecipeHandler.java index 7f94312ab..4762558e9 100644 --- a/common/mekanism/client/nei/ChemicalInfuserRecipeHandler.java +++ b/common/mekanism/client/nei/ChemicalInfuserRecipeHandler.java @@ -10,7 +10,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import mekanism.api.ChemicalInput; +import mekanism.api.ChemicalPair; import mekanism.api.gas.GasStack; import mekanism.client.gui.GuiChemicalInfuser; import mekanism.client.nei.ChemicalOxidizerRecipeHandler.CachedIORecipe; @@ -63,7 +63,7 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler return "mekanism.chemicalinfuser"; } - public Set> getRecipes() + public Set> getRecipes() { return Recipe.CHEMICAL_INFUSER.get().entrySet(); } @@ -127,7 +127,7 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler } else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack) { - for(Map.Entry irecipe : getRecipes()) + for(Map.Entry irecipe : getRecipes()) { if(((GasStack)results[0]).isGasEqual(irecipe.getValue())) { @@ -145,7 +145,7 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler { if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack) { - for(Map.Entry irecipe : getRecipes()) + for(Map.Entry irecipe : getRecipes()) { if(irecipe.getKey().containsType((GasStack)ingredients[0])) { @@ -278,7 +278,7 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe { - public ChemicalInput chemicalInput; + public ChemicalPair chemicalInput; public GasStack outputStack; @Override @@ -287,7 +287,7 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler return null; } - public CachedIORecipe(ChemicalInput input, GasStack output) + public CachedIORecipe(ChemicalPair input, GasStack output) { chemicalInput = input; outputStack = output; @@ -295,7 +295,7 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler public CachedIORecipe(Map.Entry recipe) { - this((ChemicalInput)recipe.getKey(), (GasStack)recipe.getValue()); + this((ChemicalPair)recipe.getKey(), (GasStack)recipe.getValue()); } } } diff --git a/common/mekanism/client/nei/ElectrolyticSeparatorRecipeHandler.java b/common/mekanism/client/nei/ElectrolyticSeparatorRecipeHandler.java index f78673533..a773eecc3 100644 --- a/common/mekanism/client/nei/ElectrolyticSeparatorRecipeHandler.java +++ b/common/mekanism/client/nei/ElectrolyticSeparatorRecipeHandler.java @@ -1,6 +1,336 @@ package mekanism.client.nei; -public class ElectrolyticSeparatorRecipeHandler //extends BaseRecipeHandler -{ +import static codechicken.core.gui.GuiDraw.changeTexture; +import static codechicken.core.gui.GuiDraw.drawTexturedModalRect; +import java.awt.Point; +import java.awt.Rectangle; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import mekanism.api.ChemicalPair; +import mekanism.api.gas.GasStack; +import mekanism.client.gui.GuiElectrolyticSeparator; +import mekanism.common.ObfuscatedNames; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.util.MekanismUtils; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraftforge.fluids.FluidStack; + +import org.lwjgl.opengl.GL11; + +import codechicken.core.gui.GuiDraw; +import codechicken.nei.NEIClientConfig; +import codechicken.nei.PositionedStack; +import codechicken.nei.recipe.GuiRecipe; +import codechicken.nei.recipe.TemplateRecipeHandler; + +public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler +{ + private int ticksPassed; + + public static int xOffset = 5; + public static int yOffset = 9; + + @Override + public String getRecipeName() + { + return "Electrolytic Separator"; + } + + @Override + public String getOverlayIdentifier() + { + return "electrolyticseparator"; + } + + @Override + public String getGuiTexture() + { + return "mekanism:gui/GuiElectrolyticSeparator.png"; + } + + @Override + public Class getGuiClass() + { + return GuiElectrolyticSeparator.class; + } + + public String getRecipeId() + { + return "mekanism.electrolyticseparator"; + } + + public Set> getRecipes() + { + return Recipe.ELECTROLYTIC_SEPARATOR.get().entrySet(); + } + + @Override + public void drawBackground(int i) + { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + changeTexture(getGuiTexture()); + drawTexturedModalRect(-1, 0, 4, yOffset, 167, 62); + } + + @Override + public void drawExtras(int i) + { + CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i); + + float f = ticksPassed <= 20 ? ticksPassed / 20.0F : 1.0F; + drawProgressBar(165-xOffset, 17-yOffset, 176, 0, 4, 52, f, 3); + + if(recipe.fluidInput != null) + { + displayGauge(58, 6-xOffset, 11-yOffset, 176, 68, 58, recipe.fluidInput, null); + } + + if(recipe.outputPair.leftGas != null) + { + displayGauge(28, 59-xOffset, 19-yOffset, 176, 68, 28, null, recipe.outputPair.leftGas); + } + + if(recipe.outputPair.rightGas != null) + { + displayGauge(28, 101-xOffset, 19-yOffset, 176, 68, 28, null, recipe.outputPair.rightGas); + } + } + + @Override + public void onUpdate() + { + super.onUpdate(); + + ticksPassed++; + } + + @Override + public void loadTransferRects() + { + transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(80-xOffset, 30-yOffset, 16, 6), getRecipeId(), new Object[0])); + } + + @Override + public void loadCraftingRecipes(String outputId, Object... results) + { + if(outputId.equals(getRecipeId())) + { + for(Map.Entry irecipe : getRecipes()) + { + arecipes.add(new CachedIORecipe(irecipe)); + } + } + else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack) + { + for(Map.Entry irecipe : getRecipes()) + { + if(irecipe.getValue().containsType((GasStack)results[0])) + { + arecipes.add(new CachedIORecipe(irecipe)); + } + } + } + else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadUsageRecipes(String inputId, Object... ingredients) + { + if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack) + { + for(Map.Entry irecipe : getRecipes()) + { + if(irecipe.getKey().isFluidEqual((FluidStack)ingredients[0])) + { + arecipes.add(new CachedIORecipe(irecipe)); + } + } + } + else { + super.loadUsageRecipes(inputId, ingredients); + } + } + + @Override + public List handleTooltip(GuiRecipe gui, List currenttip, int recipe) + { + Point point = GuiDraw.getMousePosition(); + + int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); + int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); + + if(xAxis >= 6 && xAxis <= 22 && yAxis >= 11+7 && yAxis <= 69+7) + { + currenttip.add(((CachedIORecipe)arecipes.get(recipe)).fluidInput.getFluid().getLocalizedName()); + } + else if(xAxis >= 59 && xAxis <= 75 && yAxis >= 19+7 && yAxis <= 47+7) + { + currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.leftGas.getGas().getLocalizedName()); + } + else if(xAxis >= 101 && xAxis <= 117 && yAxis >= 19+7 && yAxis <= 47+7) + { + currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.rightGas.getGas().getLocalizedName()); + } + + return super.handleTooltip(gui, currenttip, recipe); + } + + @Override + public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) + { + Point point = GuiDraw.getMousePosition(); + + int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); + int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); + + GasStack gas = null; + FluidStack fluid = null; + + if(xAxis >= 6 && xAxis <= 22 && yAxis >= 11+7 && yAxis <= 22+7) + { + fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidInput; + } + else if(xAxis >= 59 && xAxis <= 75 && yAxis >= 19+7 && yAxis <= 47+7) + { + gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.leftGas; + } + else if(xAxis >= 101 && xAxis <= 117 && yAxis >= 19+7 && yAxis <= 47+7) + { + gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.rightGas; + } + + if(gas != null) + { + if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) + { + if(doGasLookup(gas, false)) + { + return true; + } + } + else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) + { + if(doGasLookup(gas, true)) + { + return true; + } + } + } + else if(fluid != null) + { + if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) + { + if(doFluidLookup(fluid, false)) + { + return true; + } + } + else if(keyCode == NEIClientConfig.getKeyBinding("gui.usage")) + { + if(doFluidLookup(fluid, true)) + { + return true; + } + } + } + + return super.keyTyped(gui, keyChar, keyCode, recipe); + } + + @Override + public boolean mouseClicked(GuiRecipe gui, int button, int recipe) + { + Point point = GuiDraw.getMousePosition(); + + int xAxis = point.x - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); + int yAxis = point.y - (Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); + + GasStack gas = null; + FluidStack fluid = null; + + if(xAxis >= 6 && xAxis <= 22 && yAxis >= 11+7 && yAxis <= 22+7) + { + fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidInput; + } + else if(xAxis >= 59 && xAxis <= 75 && yAxis >= 19+7 && yAxis <= 47+7) + { + gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.leftGas; + } + else if(xAxis >= 101 && xAxis <= 117 && yAxis >= 19+7 && yAxis <= 47+7) + { + gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.rightGas; + } + + if(gas != null) + { + if(button == 0) + { + if(doGasLookup(gas, false)) + { + return true; + } + } + else if(button == 1) + { + if(doGasLookup(gas, true)) + { + return true; + } + } + } + else if(fluid != null) + { + if(button == 0) + { + if(doFluidLookup(fluid, false)) + { + return true; + } + } + else if(button == 1) + { + if(doFluidLookup(fluid, true)) + { + return true; + } + } + } + + return super.mouseClicked(gui, button, recipe); + } + + @Override + public int recipiesPerPage() + { + return 1; + } + + public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe + { + public FluidStack fluidInput; + public ChemicalPair outputPair; + + @Override + public PositionedStack getResult() + { + return null; + } + + public CachedIORecipe(FluidStack input, ChemicalPair pair) + { + fluidInput = input; + outputPair = pair; + } + + public CachedIORecipe(Map.Entry recipe) + { + this((FluidStack)recipe.getKey(), (ChemicalPair)recipe.getValue()); + } + } } diff --git a/common/mekanism/client/nei/NEIMekanismConfig.java b/common/mekanism/client/nei/NEIMekanismConfig.java index de80cfb23..5081c44f4 100644 --- a/common/mekanism/client/nei/NEIMekanismConfig.java +++ b/common/mekanism/client/nei/NEIMekanismConfig.java @@ -5,6 +5,7 @@ import mekanism.client.gui.GuiChemicalInjectionChamber; import mekanism.client.gui.GuiChemicalOxidizer; import mekanism.client.gui.GuiCombiner; import mekanism.client.gui.GuiCrusher; +import mekanism.client.gui.GuiElectrolyticSeparator; import mekanism.client.gui.GuiEnrichmentChamber; import mekanism.client.gui.GuiMetallurgicInfuser; import mekanism.client.gui.GuiOsmiumCompressor; @@ -52,6 +53,9 @@ public class NEIMekanismConfig implements IConfigureNEI API.registerRecipeHandler(new RotaryCondensentratorRecipeHandler()); API.registerUsageHandler(new RotaryCondensentratorRecipeHandler()); + API.registerRecipeHandler(new ElectrolyticSeparatorRecipeHandler()); + API.registerUsageHandler(new ElectrolyticSeparatorRecipeHandler()); + API.setGuiOffset(GuiEnrichmentChamber.class, 16, 6); API.setGuiOffset(GuiOsmiumCompressor.class, 16, 6); API.setGuiOffset(GuiCrusher.class, 16, 6); @@ -62,6 +66,7 @@ public class NEIMekanismConfig implements IConfigureNEI API.setGuiOffset(GuiChemicalOxidizer.class, ChemicalOxidizerRecipeHandler.xOffset, ChemicalOxidizerRecipeHandler.yOffset); API.setGuiOffset(GuiChemicalInfuser.class, ChemicalInfuserRecipeHandler.xOffset, ChemicalInfuserRecipeHandler.yOffset); API.setGuiOffset(GuiRotaryCondensentrator.class, RotaryCondensentratorRecipeHandler.xOffset, RotaryCondensentratorRecipeHandler.yOffset); + API.setGuiOffset(GuiElectrolyticSeparator.class, ElectrolyticSeparatorRecipeHandler.xOffset, ElectrolyticSeparatorRecipeHandler.yOffset); API.hideItem(Mekanism.boundingBlockID); API.hideItem(Mekanism.ItemProxy.itemID); diff --git a/common/mekanism/client/nei/RotaryCondensentratorRecipeHandler.java b/common/mekanism/client/nei/RotaryCondensentratorRecipeHandler.java index 5457fba82..684662f8e 100644 --- a/common/mekanism/client/nei/RotaryCondensentratorRecipeHandler.java +++ b/common/mekanism/client/nei/RotaryCondensentratorRecipeHandler.java @@ -35,7 +35,7 @@ public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler @Override public String getRecipeName() { - return "Rotary Condensentrator"; + return "R. Condensentrator"; } @Override @@ -182,11 +182,11 @@ public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); int yAxis = point.y-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiTop); - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+13 && yAxis <= 72+13) + if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+4 && yAxis <= 72+4) { currenttip.add(((CachedIORecipe)arecipes.get(recipe)).gasStack.getGas().getLocalizedName()); } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13) + else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4) { currenttip.add(((CachedIORecipe)arecipes.get(recipe)).fluidStack.getFluid().getLocalizedName()); } @@ -205,11 +205,11 @@ public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler GasStack gas = null; FluidStack fluid = null; - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+13 && yAxis <= 72+13) + if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+4 && yAxis <= 72+4) { gas = ((CachedIORecipe)arecipes.get(recipe)).gasStack; } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13) + else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+4 && yAxis <= 72+4) { fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidStack; } @@ -263,11 +263,11 @@ public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler GasStack gas = null; FluidStack fluid = null; - if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+13 && yAxis <= 72+13) + if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14+18 && yAxis <= 72+18) { gas = ((CachedIORecipe)arecipes.get(recipe)).gasStack; } - else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+13 && yAxis <= 72+13) + else if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14+18 && yAxis <= 72+18) { fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidStack; } diff --git a/common/mekanism/common/Mekanism.java b/common/mekanism/common/Mekanism.java index 4787da548..c7194d533 100644 --- a/common/mekanism/common/Mekanism.java +++ b/common/mekanism/common/Mekanism.java @@ -10,7 +10,7 @@ import java.util.Map; import java.util.Set; import java.util.logging.Logger; -import mekanism.api.ChemicalInput; +import mekanism.api.ChemicalPair; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.gas.Gas; @@ -645,13 +645,13 @@ public class Mekanism RecipeHandler.addChemicalOxidizerRecipe(new ItemStack(Mekanism.Dust, 1, 10), new GasStack(GasRegistry.getGas("sulfurDioxideGas"), 100)); //Chemical Infuser Recipes - RecipeHandler.addChemicalInfuserRecipe(new ChemicalInput(new GasStack(GasRegistry.getGas("oxygen"), 1), new GasStack(GasRegistry.getGas("sulfurDioxideGas"), 2)), new GasStack(GasRegistry.getGas("sulfurTrioxideGas"), 2)); - RecipeHandler.addChemicalInfuserRecipe(new ChemicalInput(new GasStack(GasRegistry.getGas("sulfurTrioxideGas"), 1), new GasStack(GasRegistry.getGas("water"), 1)), new GasStack(GasRegistry.getGas("sulfuricAcid"), 1)); - RecipeHandler.addChemicalInfuserRecipe(new ChemicalInput(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1)), new GasStack(GasRegistry.getGas("hydrogenChloride"), 1)); + RecipeHandler.addChemicalInfuserRecipe(new ChemicalPair(new GasStack(GasRegistry.getGas("oxygen"), 1), new GasStack(GasRegistry.getGas("sulfurDioxideGas"), 2)), new GasStack(GasRegistry.getGas("sulfurTrioxideGas"), 2)); + RecipeHandler.addChemicalInfuserRecipe(new ChemicalPair(new GasStack(GasRegistry.getGas("sulfurTrioxideGas"), 1), new GasStack(GasRegistry.getGas("water"), 1)), new GasStack(GasRegistry.getGas("sulfuricAcid"), 1)); + RecipeHandler.addChemicalInfuserRecipe(new ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1)), new GasStack(GasRegistry.getGas("hydrogenChloride"), 1)); //Electrolytic Separator Recipes - RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2), new ChemicalInput(new GasStack(GasRegistry.getGas("hydrogen"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1))); - RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("lava", 10), new ChemicalInput(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1))); + RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2), new ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1))); + RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("lava", 10), new ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1))); //Infuse objects InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 0), new InfuseObject(InfuseRegistry.get("CARBON"), 10)); diff --git a/common/mekanism/common/recipe/RecipeHandler.java b/common/mekanism/common/recipe/RecipeHandler.java index 7412095b2..aa20ce8c0 100644 --- a/common/mekanism/common/recipe/RecipeHandler.java +++ b/common/mekanism/common/recipe/RecipeHandler.java @@ -3,7 +3,7 @@ package mekanism.common.recipe; import java.util.HashMap; import java.util.Map; -import mekanism.api.ChemicalInput; +import mekanism.api.ChemicalPair; import mekanism.api.gas.GasStack; import mekanism.api.gas.GasTank; import mekanism.api.infuse.InfusionInput; @@ -91,7 +91,7 @@ public final class RecipeHandler * @param input - input ChemicalInput * @param output - output GasStack */ - public static void addChemicalInfuserRecipe(ChemicalInput input, GasStack output) + public static void addChemicalInfuserRecipe(ChemicalPair input, GasStack output) { Recipe.CHEMICAL_INFUSER.put(input, output); } @@ -121,7 +121,7 @@ public final class RecipeHandler * @param fluid - FluidStack to electrolyze * @param products - Pair of gases to produce when the fluid is electrolyzed */ - public static void addElectrolyticSeparatorRecipe(FluidStack fluid, ChemicalInput products) + public static void addElectrolyticSeparatorRecipe(FluidStack fluid, ChemicalPair products) { Recipe.ELECTROLYTIC_SEPARATOR.put(fluid, products); } @@ -169,15 +169,15 @@ public final class RecipeHandler */ public static GasStack getChemicalInfuserOutput(GasTank leftTank, GasTank rightTank, boolean doRemove) { - ChemicalInput input = new ChemicalInput(leftTank.getGas(), rightTank.getGas()); + ChemicalPair input = new ChemicalPair(leftTank.getGas(), rightTank.getGas()); if(input.isValid()) { - HashMap recipes = Recipe.CHEMICAL_INFUSER.get(); + HashMap recipes = Recipe.CHEMICAL_INFUSER.get(); - for(Map.Entry entry : recipes.entrySet()) + for(Map.Entry entry : recipes.entrySet()) { - ChemicalInput key = (ChemicalInput)entry.getKey(); + ChemicalPair key = (ChemicalPair)entry.getKey(); if(key.meetsInput(input)) { @@ -283,15 +283,15 @@ public final class RecipeHandler * Get the result of electrolysing a given fluid * @param fluidTank - the FluidTank to electrolyse fluid from */ - public static ChemicalInput getElectrolyticSeparatorOutput(FluidTank fluidTank, boolean doRemove) + public static ChemicalPair getElectrolyticSeparatorOutput(FluidTank fluidTank, boolean doRemove) { FluidStack fluid = fluidTank.getFluid(); if(fluid != null) { - HashMap recipes = Recipe.ELECTROLYTIC_SEPARATOR.get(); + HashMap recipes = Recipe.ELECTROLYTIC_SEPARATOR.get(); - for(Map.Entry entry : recipes.entrySet()) + for(Map.Entry entry : recipes.entrySet()) { FluidStack key = (FluidStack)entry.getKey(); @@ -315,10 +315,10 @@ public final class RecipeHandler CRUSHER(new HashMap()), PURIFICATION_CHAMBER(new HashMap()), METALLURGIC_INFUSER(new HashMap()), - CHEMICAL_INFUSER(new HashMap()), + CHEMICAL_INFUSER(new HashMap()), CHEMICAL_OXIDIZER(new HashMap()), CHEMICAL_INJECTION_CHAMBER(new HashMap()), - ELECTROLYTIC_SEPARATOR(new HashMap()); + ELECTROLYTIC_SEPARATOR(new HashMap()); private HashMap recipes; diff --git a/common/mekanism/common/tile/TileEntityElectrolyticSeparator.java b/common/mekanism/common/tile/TileEntityElectrolyticSeparator.java index 649aedefe..600f122df 100644 --- a/common/mekanism/common/tile/TileEntityElectrolyticSeparator.java +++ b/common/mekanism/common/tile/TileEntityElectrolyticSeparator.java @@ -2,7 +2,7 @@ package mekanism.common.tile; import java.util.ArrayList; -import mekanism.api.ChemicalInput; +import mekanism.api.ChemicalPair; import mekanism.api.Coord4D; import mekanism.api.gas.Gas; import mekanism.api.gas.GasRegistry; @@ -187,7 +187,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp return canFillWithSwap(RecipeHandler.getElectrolyticSeparatorOutput(fluidTank, false)) && getEnergy() >= Mekanism.electrolyticSeparatorUsage; } - public boolean canFillWithSwap(ChemicalInput gases) + public boolean canFillWithSwap(ChemicalPair gases) { if(gases == null) { @@ -197,13 +197,13 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp return canFill(gases) || canFill(gases.swap()); } - public boolean canFill(ChemicalInput gases) + public boolean canFill(ChemicalPair gases) { return (leftTank.canReceive(gases.leftGas.getGas()) && leftTank.getNeeded() >= gases.leftGas.amount && rightTank.canReceive(gases.rightGas.getGas()) && rightTank.getNeeded() >= gases.rightGas.amount); } - public void fillTanks(ChemicalInput gases) + public void fillTanks(ChemicalPair gases) { if(gases == null) return; diff --git a/resources/assets/mekanism/gui/GuiElectrolyticSeparator.png b/resources/assets/mekanism/gui/GuiElectrolyticSeparator.png index 1f58db416612a97694a50ba75fd8ed20cbb6c080..3e8fd23f73a6f723daf66da2142c02c3ecca4f3b 100644 GIT binary patch delta 2811 zcmb7`c~Dc=9>?#!CKia+q+t_5wpW4_1$`(28g6A#Ku9c$fCN&iQIJhR6eQe4TM!~k zOBG~|PYcMd0ZC#DNfK#vcb5xIM0VA>##O9CSF6nTD z1^ywG@Ilwq*fKJ!Zkc#|{?fYjIfv_?Z)kJ8x6Uy+W3yIP8U1gCmmdCLGkK%#b!RoL z$aZMS+LQ9oyoYwKWJq4`8Qy!4@-%9Oxp$cyj9i5)v4y;G#fMBuT;0c6QUBNz#7G{* zi&?2qUl6U5@|asn#Jhfg(=dhI^1S%QTSYpy8=IJtBk4bUKa&`K=G7w3>AE?hvDeDV z$&h?ExKEF95Rg0M<>z;{rr^hK2}Vap#~xn(EaTQKLkGPqZWP8`SGp3ZVu*3nkGKOM zSO3v!?ZguJ!C;oVroK5D#M0xedcT7r(TUr)-wPHns;ucZerd}8#K!YCW)<#>U%5bT zzHd1HZn!`ylZ6fV*+3Xyytgm#BDVW;?ag!Z^Q5q^95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