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 1f58db416..3e8fd23f7 100644 Binary files a/resources/assets/mekanism/gui/GuiElectrolyticSeparator.png and b/resources/assets/mekanism/gui/GuiElectrolyticSeparator.png differ