Electrolytic Separator NEI plugin

This commit is contained in:
Aidan C. Brady 2014-01-10 12:58:05 -05:00
parent 6eb43d11d7
commit 836dd3c22a
10 changed files with 387 additions and 52 deletions

View file

@ -8,7 +8,7 @@ import mekanism.api.gas.GasTank;
* @author aidancbrady * @author aidancbrady
* *
*/ */
public class ChemicalInput public class ChemicalPair
{ {
/** The left gas of this chemical input */ /** The left gas of this chemical input */
public GasStack leftGas; public GasStack leftGas;
@ -21,7 +21,7 @@ public class ChemicalInput
* @param left - left gas * @param left - left gas
* @param right - right gas * @param right - right gas
*/ */
public ChemicalInput(GasStack left, GasStack right) public ChemicalPair(GasStack left, GasStack right)
{ {
leftGas = left; leftGas = left;
rightGas = right; rightGas = right;
@ -41,7 +41,7 @@ public class ChemicalInput
* @param input - input to check * @param input - input to check
* @return if the input meets this input's requirements * @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()); return meets(input) || meets(input.swap());
} }
@ -50,9 +50,9 @@ public class ChemicalInput
* Swaps the right gas and left gas of this input. * Swaps the right gas and left gas of this input.
* @return a swapped ChemicalInput * @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) 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); leftTank.draw(leftGas.amount, true);
rightTank.draw(rightGas.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); leftTank.draw(rightGas.amount, true);
rightTank.draw(leftGas.amount, true); rightTank.draw(leftGas.amount, true);
@ -94,7 +94,7 @@ public class ChemicalInput
* @param input - input to check * @param input - input to check
* @return if the input meets this input's requirements * @return if the input meets this input's requirements
*/ */
private boolean meets(ChemicalInput input) private boolean meets(ChemicalPair input)
{ {
if(input == null || !input.isValid()) if(input == null || !input.isValid())
{ {
@ -109,8 +109,8 @@ public class ChemicalInput
return input.leftGas.amount >= leftGas.amount && input.rightGas.amount >= rightGas.amount; 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());
} }
} }

View file

@ -115,11 +115,11 @@ public final class RecipeHelper
* @param input - input ChemicalInput * @param input - input ChemicalInput
* @param output - output GasStack * @param output - output GasStack
*/ */
public static void addChemicalInfuserRecipe(ChemicalInput input, GasStack output) public static void addChemicalInfuserRecipe(ChemicalPair input, GasStack output)
{ {
try { try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler"); 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); m.invoke(null, input, output);
} catch(Exception e) { } catch(Exception e) {
System.err.println("[Mekanism] Error while adding recipe: " + e.getMessage()); System.err.println("[Mekanism] Error while adding recipe: " + e.getMessage());
@ -147,11 +147,11 @@ public final class RecipeHelper
* @param input - input ItemStack * @param input - input ItemStack
* @param output - output ItemStack * @param output - output ItemStack
*/ */
public static void addElectrolyticSeparatorRecipe(FluidStack input, ChemicalInput output) public static void addElectrolyticSeparatorRecipe(FluidStack input, ChemicalPair output)
{ {
try { try {
Class recipeClass = Class.forName("mekanism.common.RecipeHandler"); 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); m.invoke(null, input, output);
} catch(Exception e) { } catch(Exception e) {
System.err.println("[Mekanism] Error while adding recipe: " + e.getMessage()); System.err.println("[Mekanism] Error while adding recipe: " + e.getMessage());

View file

@ -10,7 +10,7 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import mekanism.api.ChemicalInput; import mekanism.api.ChemicalPair;
import mekanism.api.gas.GasStack; import mekanism.api.gas.GasStack;
import mekanism.client.gui.GuiChemicalInfuser; import mekanism.client.gui.GuiChemicalInfuser;
import mekanism.client.nei.ChemicalOxidizerRecipeHandler.CachedIORecipe; import mekanism.client.nei.ChemicalOxidizerRecipeHandler.CachedIORecipe;
@ -63,7 +63,7 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler
return "mekanism.chemicalinfuser"; return "mekanism.chemicalinfuser";
} }
public Set<Entry<ChemicalInput, GasStack>> getRecipes() public Set<Entry<ChemicalPair, GasStack>> getRecipes()
{ {
return Recipe.CHEMICAL_INFUSER.get().entrySet(); 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) else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack)
{ {
for(Map.Entry<ChemicalInput, GasStack> irecipe : getRecipes()) for(Map.Entry<ChemicalPair, GasStack> irecipe : getRecipes())
{ {
if(((GasStack)results[0]).isGasEqual(irecipe.getValue())) 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) if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack)
{ {
for(Map.Entry<ChemicalInput, GasStack> irecipe : getRecipes()) for(Map.Entry<ChemicalPair, GasStack> irecipe : getRecipes())
{ {
if(irecipe.getKey().containsType((GasStack)ingredients[0])) if(irecipe.getKey().containsType((GasStack)ingredients[0]))
{ {
@ -278,7 +278,7 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler
public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe
{ {
public ChemicalInput chemicalInput; public ChemicalPair chemicalInput;
public GasStack outputStack; public GasStack outputStack;
@Override @Override
@ -287,7 +287,7 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler
return null; return null;
} }
public CachedIORecipe(ChemicalInput input, GasStack output) public CachedIORecipe(ChemicalPair input, GasStack output)
{ {
chemicalInput = input; chemicalInput = input;
outputStack = output; outputStack = output;
@ -295,7 +295,7 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler
public CachedIORecipe(Map.Entry recipe) public CachedIORecipe(Map.Entry recipe)
{ {
this((ChemicalInput)recipe.getKey(), (GasStack)recipe.getValue()); this((ChemicalPair)recipe.getKey(), (GasStack)recipe.getValue());
} }
} }
} }

View file

@ -1,6 +1,336 @@
package mekanism.client.nei; 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<Entry<FluidStack, ChemicalPair>> 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<FluidStack, ChemicalPair> 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<FluidStack, ChemicalPair> irecipe : getRecipes())
{
if(irecipe.getKey().isFluidEqual((FluidStack)ingredients[0]))
{
arecipes.add(new CachedIORecipe(irecipe));
}
}
}
else {
super.loadUsageRecipes(inputId, ingredients);
}
}
@Override
public List<String> handleTooltip(GuiRecipe gui, List<String> 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());
}
}
} }

View file

@ -5,6 +5,7 @@ import mekanism.client.gui.GuiChemicalInjectionChamber;
import mekanism.client.gui.GuiChemicalOxidizer; import mekanism.client.gui.GuiChemicalOxidizer;
import mekanism.client.gui.GuiCombiner; import mekanism.client.gui.GuiCombiner;
import mekanism.client.gui.GuiCrusher; import mekanism.client.gui.GuiCrusher;
import mekanism.client.gui.GuiElectrolyticSeparator;
import mekanism.client.gui.GuiEnrichmentChamber; import mekanism.client.gui.GuiEnrichmentChamber;
import mekanism.client.gui.GuiMetallurgicInfuser; import mekanism.client.gui.GuiMetallurgicInfuser;
import mekanism.client.gui.GuiOsmiumCompressor; import mekanism.client.gui.GuiOsmiumCompressor;
@ -52,6 +53,9 @@ public class NEIMekanismConfig implements IConfigureNEI
API.registerRecipeHandler(new RotaryCondensentratorRecipeHandler()); API.registerRecipeHandler(new RotaryCondensentratorRecipeHandler());
API.registerUsageHandler(new RotaryCondensentratorRecipeHandler()); API.registerUsageHandler(new RotaryCondensentratorRecipeHandler());
API.registerRecipeHandler(new ElectrolyticSeparatorRecipeHandler());
API.registerUsageHandler(new ElectrolyticSeparatorRecipeHandler());
API.setGuiOffset(GuiEnrichmentChamber.class, 16, 6); API.setGuiOffset(GuiEnrichmentChamber.class, 16, 6);
API.setGuiOffset(GuiOsmiumCompressor.class, 16, 6); API.setGuiOffset(GuiOsmiumCompressor.class, 16, 6);
API.setGuiOffset(GuiCrusher.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(GuiChemicalOxidizer.class, ChemicalOxidizerRecipeHandler.xOffset, ChemicalOxidizerRecipeHandler.yOffset);
API.setGuiOffset(GuiChemicalInfuser.class, ChemicalInfuserRecipeHandler.xOffset, ChemicalInfuserRecipeHandler.yOffset); API.setGuiOffset(GuiChemicalInfuser.class, ChemicalInfuserRecipeHandler.xOffset, ChemicalInfuserRecipeHandler.yOffset);
API.setGuiOffset(GuiRotaryCondensentrator.class, RotaryCondensentratorRecipeHandler.xOffset, RotaryCondensentratorRecipeHandler.yOffset); API.setGuiOffset(GuiRotaryCondensentrator.class, RotaryCondensentratorRecipeHandler.xOffset, RotaryCondensentratorRecipeHandler.yOffset);
API.setGuiOffset(GuiElectrolyticSeparator.class, ElectrolyticSeparatorRecipeHandler.xOffset, ElectrolyticSeparatorRecipeHandler.yOffset);
API.hideItem(Mekanism.boundingBlockID); API.hideItem(Mekanism.boundingBlockID);
API.hideItem(Mekanism.ItemProxy.itemID); API.hideItem(Mekanism.ItemProxy.itemID);

View file

@ -35,7 +35,7 @@ public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler
@Override @Override
public String getRecipeName() public String getRecipeName()
{ {
return "Rotary Condensentrator"; return "R. Condensentrator";
} }
@Override @Override
@ -182,11 +182,11 @@ public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler
int xAxis = point.x-(Integer)MekanismUtils.getPrivateValue(gui, GuiContainer.class, ObfuscatedNames.GuiContainer_guiLeft); 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); 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()); 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()); currenttip.add(((CachedIORecipe)arecipes.get(recipe)).fluidStack.getFluid().getLocalizedName());
} }
@ -205,11 +205,11 @@ public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler
GasStack gas = null; GasStack gas = null;
FluidStack fluid = 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; 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; fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidStack;
} }
@ -263,11 +263,11 @@ public class RotaryCondensentratorRecipeHandler extends BaseRecipeHandler
GasStack gas = null; GasStack gas = null;
FluidStack fluid = 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; 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; fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidStack;
} }

View file

@ -10,7 +10,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.logging.Logger; import java.util.logging.Logger;
import mekanism.api.ChemicalInput; import mekanism.api.ChemicalPair;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.EnumColor; import mekanism.api.EnumColor;
import mekanism.api.gas.Gas; 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)); RecipeHandler.addChemicalOxidizerRecipe(new ItemStack(Mekanism.Dust, 1, 10), new GasStack(GasRegistry.getGas("sulfurDioxideGas"), 100));
//Chemical Infuser Recipes //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 ChemicalPair(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 ChemicalPair(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("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1)), new GasStack(GasRegistry.getGas("hydrogenChloride"), 1));
//Electrolytic Separator Recipes //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("water", 2), new ChemicalPair(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("lava", 10), new ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1)));
//Infuse objects //Infuse objects
InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 0), new InfuseObject(InfuseRegistry.get("CARBON"), 10)); InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 0), new InfuseObject(InfuseRegistry.get("CARBON"), 10));

View file

@ -3,7 +3,7 @@ package mekanism.common.recipe;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import mekanism.api.ChemicalInput; import mekanism.api.ChemicalPair;
import mekanism.api.gas.GasStack; import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank; import mekanism.api.gas.GasTank;
import mekanism.api.infuse.InfusionInput; import mekanism.api.infuse.InfusionInput;
@ -91,7 +91,7 @@ public final class RecipeHandler
* @param input - input ChemicalInput * @param input - input ChemicalInput
* @param output - output GasStack * @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); Recipe.CHEMICAL_INFUSER.put(input, output);
} }
@ -121,7 +121,7 @@ public final class RecipeHandler
* @param fluid - FluidStack to electrolyze * @param fluid - FluidStack to electrolyze
* @param products - Pair of gases to produce when the fluid is electrolyzed * @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); Recipe.ELECTROLYTIC_SEPARATOR.put(fluid, products);
} }
@ -169,15 +169,15 @@ public final class RecipeHandler
*/ */
public static GasStack getChemicalInfuserOutput(GasTank leftTank, GasTank rightTank, boolean doRemove) 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()) if(input.isValid())
{ {
HashMap<ChemicalInput, GasStack> recipes = Recipe.CHEMICAL_INFUSER.get(); HashMap<ChemicalPair, GasStack> recipes = Recipe.CHEMICAL_INFUSER.get();
for(Map.Entry<ChemicalInput, GasStack> entry : recipes.entrySet()) for(Map.Entry<ChemicalPair, GasStack> entry : recipes.entrySet())
{ {
ChemicalInput key = (ChemicalInput)entry.getKey(); ChemicalPair key = (ChemicalPair)entry.getKey();
if(key.meetsInput(input)) if(key.meetsInput(input))
{ {
@ -283,15 +283,15 @@ public final class RecipeHandler
* Get the result of electrolysing a given fluid * Get the result of electrolysing a given fluid
* @param fluidTank - the FluidTank to electrolyse fluid from * @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(); FluidStack fluid = fluidTank.getFluid();
if(fluid != null) if(fluid != null)
{ {
HashMap<FluidStack, ChemicalInput> recipes = Recipe.ELECTROLYTIC_SEPARATOR.get(); HashMap<FluidStack, ChemicalPair> recipes = Recipe.ELECTROLYTIC_SEPARATOR.get();
for(Map.Entry<FluidStack, ChemicalInput> entry : recipes.entrySet()) for(Map.Entry<FluidStack, ChemicalPair> entry : recipes.entrySet())
{ {
FluidStack key = (FluidStack)entry.getKey(); FluidStack key = (FluidStack)entry.getKey();
@ -315,10 +315,10 @@ public final class RecipeHandler
CRUSHER(new HashMap<ItemStack, ItemStack>()), CRUSHER(new HashMap<ItemStack, ItemStack>()),
PURIFICATION_CHAMBER(new HashMap<ItemStack, ItemStack>()), PURIFICATION_CHAMBER(new HashMap<ItemStack, ItemStack>()),
METALLURGIC_INFUSER(new HashMap<InfusionInput, InfusionOutput>()), METALLURGIC_INFUSER(new HashMap<InfusionInput, InfusionOutput>()),
CHEMICAL_INFUSER(new HashMap<ChemicalInput, GasStack>()), CHEMICAL_INFUSER(new HashMap<ChemicalPair, GasStack>()),
CHEMICAL_OXIDIZER(new HashMap<ItemStack, GasStack>()), CHEMICAL_OXIDIZER(new HashMap<ItemStack, GasStack>()),
CHEMICAL_INJECTION_CHAMBER(new HashMap<ItemStack, ItemStack>()), CHEMICAL_INJECTION_CHAMBER(new HashMap<ItemStack, ItemStack>()),
ELECTROLYTIC_SEPARATOR(new HashMap<FluidStack, ChemicalInput>()); ELECTROLYTIC_SEPARATOR(new HashMap<FluidStack, ChemicalPair>());
private HashMap recipes; private HashMap recipes;

View file

@ -2,7 +2,7 @@ package mekanism.common.tile;
import java.util.ArrayList; import java.util.ArrayList;
import mekanism.api.ChemicalInput; import mekanism.api.ChemicalPair;
import mekanism.api.Coord4D; import mekanism.api.Coord4D;
import mekanism.api.gas.Gas; import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry; import mekanism.api.gas.GasRegistry;
@ -187,7 +187,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
return canFillWithSwap(RecipeHandler.getElectrolyticSeparatorOutput(fluidTank, false)) && getEnergy() >= Mekanism.electrolyticSeparatorUsage; return canFillWithSwap(RecipeHandler.getElectrolyticSeparatorOutput(fluidTank, false)) && getEnergy() >= Mekanism.electrolyticSeparatorUsage;
} }
public boolean canFillWithSwap(ChemicalInput gases) public boolean canFillWithSwap(ChemicalPair gases)
{ {
if(gases == null) if(gases == null)
{ {
@ -197,13 +197,13 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
return canFill(gases) || canFill(gases.swap()); 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 return (leftTank.canReceive(gases.leftGas.getGas()) && leftTank.getNeeded() >= gases.leftGas.amount
&& rightTank.canReceive(gases.rightGas.getGas()) && rightTank.getNeeded() >= gases.rightGas.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; if(gases == null) return;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB