Massive recipe system overhaul.

They should be much more efficient now (this reduced the tick time of the CI Chamber by 3-4x in my testing), due to being able to just use the HashMap's get() instead of being limited to iterating through entries. NEI integration code now a lot more readable and type-safe as well.
This commit is contained in:
Ben Spiers 2014-09-04 04:26:55 +01:00
parent 4dd3d4ba01
commit ce6946c669
77 changed files with 1294 additions and 486 deletions

View file

@ -116,4 +116,10 @@ public class GasStack
{
return "[" + type + ", " + amount + "]";
}
@Override
public int hashCode()
{
return type == null ? 0 : type.getID();
}
}

View file

@ -1,29 +0,0 @@
package mekanism.api.recipe;
import mekanism.api.gas.Gas;
import mekanism.api.util.StackUtils;
import net.minecraft.item.ItemStack;
public class AdvancedInput
{
public ItemStack itemStack;
public Gas gasType;
public AdvancedInput(ItemStack item, Gas gas)
{
itemStack = item;
gasType = gas;
}
public boolean isValid()
{
return itemStack != null && gasType != null;
}
public boolean matches(AdvancedInput input)
{
return StackUtils.equalsWildcard(itemStack, input.itemStack) && input.itemStack.stackSize >= itemStack.stackSize;
}
}

View file

@ -1,25 +0,0 @@
package mekanism.api.recipe;
public class PressurizedRecipe
{
public PressurizedReactants reactants;
public double extraEnergy;
public PressurizedProducts products;
public int ticks;
public PressurizedRecipe(PressurizedReactants pressurizedReactants, double energy, PressurizedProducts pressurizedProducts, int duration)
{
reactants = pressurizedReactants;
extraEnergy = energy;
products = pressurizedProducts;
ticks = duration;
}
public PressurizedRecipe copy()
{
return new PressurizedRecipe(reactants.copy(), extraEnergy, products.copy(), ticks);
}
}

View file

@ -3,7 +3,7 @@ package mekanism.api.recipe;
import java.lang.reflect.Method;
import mekanism.api.gas.GasStack;
import mekanism.api.infuse.InfusionInput;
import mekanism.api.infuse.InfuseType;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@ -113,15 +113,16 @@ public final class RecipeHelper
/**
* Add a Chemical Infuser recipe.
* @param input - input ChemicalInput
* @param leftInput - left input GasStack
* @param rightInput - right input GasStack
* @param output - output GasStack
*/
public static void addChemicalInfuserRecipe(ChemicalPair input, GasStack output)
public static void addChemicalInfuserRecipe(GasStack leftInput, GasStack rightInput, GasStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addChemicalInfuserRecipe", ChemicalPair.class, GasStack.class);
m.invoke(null, input, output);
Method m = recipeClass.getMethod("addChemicalInfuserRecipe", GasStack.class, GasStack.class, GasStack.class);
m.invoke(null, leftInput, rightInput, output);
} catch(Exception e) {
System.err.println("Error while adding recipe: " + e.getMessage());
}
@ -130,14 +131,32 @@ public final class RecipeHelper
/**
* Add a Precision Sawmill recipe.
* @param input - input ItemStack
* @param output - output ChanceOutput
* @param primaryOutput - guaranteed output
* @param secondaryOutput - possible extra output
* @param chance - probability of obtaining extra output
*/
public static void addPrecisionSawmillRecipe(ItemStack input, ChanceOutput output)
public static void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, double chance)
{
try {
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addPrecisionSawmillRecipe", ItemStack.class, ChanceOutput.class);
m.invoke(null, input, output);
Method m = recipeClass.getMethod("addPrecisionSawmillRecipe", ItemStack.class, ItemStack.class, ItemStack.class, Double.TYPE);
m.invoke(null, input, primaryOutput, secondaryOutput, chance);
} catch(Exception e) {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
/**
* Add a Precision Sawmill recipe with no chance output
* @param input - input ItemStack
* @param primaryOutput - guaranteed output
*/
public static void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput)
{
try {
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addPrecisionSawmillRecipe", ItemStack.class, ItemStack.class);
m.invoke(null, input, primaryOutput);
} catch(Exception e) {
System.err.println("Error while adding recipe: " + e.getMessage());
}
@ -148,12 +167,12 @@ public final class RecipeHelper
* @param input - input AdvancedInput
* @param output - output ItemStack
*/
public static void addChemicalInjectionChamberRecipe(AdvancedInput input, ItemStack output)
public static void addChemicalInjectionChamberRecipe(ItemStack input, String gasName, ItemStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addChemicalInjectionChamberRecipe", AdvancedInput.class, ItemStack.class);
m.invoke(null, input, output);
Method m = recipeClass.getMethod("addChemicalInjectionChamberRecipe", ItemStack.class, String.class, ItemStack.class);
m.invoke(null, input, gasName, output);
} catch(Exception e) {
System.err.println("Error while adding recipe: " + e.getMessage());
}
@ -162,14 +181,15 @@ public final class RecipeHelper
/**
* Add an Electrolytic Separator recipe.
* @param input - input FluidStack
* @param output - output ChemicalPair
* @param leftOutput - left output GasStack
* @param rightOutput - right output GasStack
*/
public static void addElectrolyticSeparatorRecipe(FluidStack input, ChemicalPair output)
public static void addElectrolyticSeparatorRecipe(FluidStack input, GasStack leftOutput, GasStack rightOutput)
{
try {
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addElectrolyticSeparatorRecipe", FluidStack.class, ChemicalPair.class);
m.invoke(null, input, output);
Method m = recipeClass.getMethod("addElectrolyticSeparatorRecipe", FluidStack.class, GasStack.class, GasStack.class);
m.invoke(null, input, leftOutput, rightOutput);
} catch(Exception e) {
System.err.println("Error while adding recipe: " + e.getMessage());
}
@ -225,33 +245,38 @@ public final class RecipeHelper
/**
* Add a Metallurgic Infuser recipe.
* @param input - input Infusion
* @param infuse - which Infuse to use
* @param amount - how much Infuse to use
* @param input - input ItemStack
* @param output - output ItemStack
*/
public static void addMetallurgicInfuserRecipe(InfusionInput input, ItemStack output)
public static void addMetallurgicInfuserRecipe(InfuseType infuse, int amount, ItemStack input, ItemStack output)
{
try {
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addMetallurgicInfuserRecipe", InfusionInput.class, ItemStack.class);
m.invoke(null, input, output);
Method m = recipeClass.getMethod("addMetallurgicInfuserRecipe", InfuseType.class, Integer.TYPE, ItemStack.class, ItemStack.class);
m.invoke(null, infuse, amount, input, output);
} catch(Exception e) {
System.err.println("Error while adding recipe: " + e.getMessage());
}
}
/**
* Add a Pressurized Reaction Chamber recipe.
* @param input - input PressurizedReactants
* @param output - output PressurizedProducts
* @param inputSolid - input ItemStack
* @param inputFluid - input FluidStack
* @param inputGas - input GasStack
* @param outputSolid - output ItemStack
* @param outputGas - output GasStack
* @param extraEnergy - extra energy needed by the recipe
* @param ticks - amount of ticks it takes for this recipe to complete
*/
public static void addPRCRecipe(PressurizedReactants input, PressurizedProducts output, double extraEnergy, int ticks)
public static void addPRCRecipe(ItemStack inputSolid, FluidStack inputFluid, GasStack inputGas, ItemStack outputSolid, GasStack outputGas, double extraEnergy, int ticks)
{
try {
Class recipeClass = Class.forName("mekanism.common.recipe.RecipeHandler");
Method m = recipeClass.getMethod("addPRCRecipe", PressurizedReactants.class, PressurizedProducts.class, Double.TYPE, Integer.TYPE);
m.invoke(null, input, output);
Method m = recipeClass.getMethod("addPRCRecipe", ItemStack.class, FluidStack.class, GasStack.class, ItemStack.class, GasStack.class, Double.TYPE, Integer.TYPE);
m.invoke(null, inputSolid, inputFluid, inputGas, outputSolid, outputGas, extraEnergy, ticks);
} catch(Exception e) {
System.err.println("Error while adding recipe: " + e.getMessage());
}

View file

@ -58,6 +58,11 @@ public final class StackUtils
return wild.getItem() == check.getItem() && (wild.getItemDamage() == OreDictionary.WILDCARD_VALUE || wild.getItemDamage() == check.getItemDamage());
}
public static boolean equalsWildcardWithNBT(ItemStack wild, ItemStack check)
{
return equalsWildcard(wild, check) && (wild.stackTagCompound == null ? check.stackTagCompound == null : (wild.stackTagCompound == check.stackTagCompound || wild.stackTagCompound.equals(check.stackTagCompound)));
}
public static List<ItemStack> even(ItemStack stack1, ItemStack stack2)
{
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
@ -225,4 +230,9 @@ public final class StackUtils
return StackUtils.size(orig, newSize);
}
}
public static int hashItemStack(ItemStack stack)
{
return Item.getIdFromItem(stack.getItem()) << 8 | stack.getItemDamage();
}
}

View file

@ -1,6 +1,7 @@
package mekanism.client.nei;
import java.awt.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -8,7 +9,7 @@ import java.util.Set;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
import mekanism.api.recipe.AdvancedInput;
import mekanism.common.recipe.inputs.AdvancedMachineInput;
import mekanism.client.gui.GuiElement;
import mekanism.client.gui.GuiPowerBar;
import mekanism.client.gui.GuiPowerBar.IPowerInfoHandler;
@ -19,6 +20,7 @@ import mekanism.client.gui.GuiSlot;
import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.ObfuscatedNames;
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -43,7 +45,7 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
public abstract String getRecipeId();
public abstract Set<Entry<AdvancedInput, ItemStack>> getRecipes();
public abstract Collection<? extends AdvancedMachineRecipe> getRecipes();
public abstract List<ItemStack> getFuelStacks(Gas gasType);
@ -117,9 +119,9 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
{
if(outputId.equals(getRecipeId()))
{
for(Map.Entry<AdvancedInput, ItemStack> irecipe : getRecipes())
for(AdvancedMachineRecipe irecipe : getRecipes())
{
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getKey().gasType)));
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getInput().gasType)));
}
}
else {
@ -130,11 +132,11 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
@Override
public void loadCraftingRecipes(ItemStack result)
{
for(Map.Entry<AdvancedInput, ItemStack> irecipe : getRecipes())
for(AdvancedMachineRecipe irecipe : getRecipes())
{
if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getValue(), result))
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().output, result))
{
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getKey().gasType)));
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getInput().gasType)));
}
}
}
@ -150,11 +152,11 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
{
if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack)
{
for(Map.Entry<AdvancedInput, ItemStack> irecipe : getRecipes())
for(AdvancedMachineRecipe irecipe : getRecipes())
{
if(irecipe.getKey().gasType == ((GasStack)ingredients[0]).getGas())
if(irecipe.getInput().gasType == ((GasStack)ingredients[0]).getGas())
{
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getKey().gasType)));
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getInput().gasType)));
}
}
}
@ -166,11 +168,11 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
@Override
public void loadUsageRecipes(ItemStack ingredient)
{
for(Map.Entry<AdvancedInput, ItemStack> irecipe : getRecipes())
for(AdvancedMachineRecipe irecipe : getRecipes())
{
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getKey().itemStack, ingredient))
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getInput().itemStack, ingredient))
{
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getKey().gasType)));
arecipes.add(new CachedIORecipe(irecipe, getFuelStacks(irecipe.getInput().gasType)));
}
}
}
@ -270,7 +272,7 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
{
public List<ItemStack> fuelStacks;
public AdvancedInput input;
public AdvancedMachineInput input;
public PositionedStack outputStack;
@ -292,16 +294,16 @@ public abstract class AdvancedMachineRecipeHandler extends BaseRecipeHandler
return new PositionedStack(fuelStacks.get(cycleticks/40 % fuelStacks.size()), 40, 48);
}
public CachedIORecipe(AdvancedInput adv, ItemStack output, List<ItemStack> fuels)
public CachedIORecipe(AdvancedMachineInput adv, ItemStack output, List<ItemStack> fuels)
{
input = adv;
outputStack = new PositionedStack(output, 100, 30);
fuelStacks = fuels;
}
public CachedIORecipe(Map.Entry recipe, List<ItemStack> fuels)
public CachedIORecipe(AdvancedMachineRecipe recipe, List<ItemStack> fuels)
{
this((AdvancedInput)recipe.getKey(), (ItemStack)recipe.getValue(), fuels);
this(recipe.getInput(), recipe.getOutput().output, fuels);
}
}
}

View file

@ -1,11 +1,14 @@
package mekanism.client.nei;
import java.awt.*;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import mekanism.api.recipe.ChanceOutput;
import mekanism.common.recipe.inputs.ItemStackInput;
import mekanism.common.recipe.machines.ChanceMachineRecipe;
import mekanism.common.recipe.outputs.ChanceOutput;
import mekanism.client.gui.GuiElement;
import mekanism.client.gui.GuiPowerBar;
import mekanism.client.gui.GuiPowerBar.IPowerInfoHandler;
@ -36,7 +39,7 @@ public abstract class ChanceMachineRecipeHandler extends BaseRecipeHandler
public abstract String getRecipeId();
public abstract Set<Entry<ItemStack, ChanceOutput>> getRecipes();
public abstract Collection<? extends ChanceMachineRecipe> getRecipes();
public abstract ProgressBar getProgressType();
@ -106,7 +109,7 @@ public abstract class ChanceMachineRecipeHandler extends BaseRecipeHandler
{
if(outputId.equals(getRecipeId()))
{
for(Map.Entry irecipe : getRecipes())
for(ChanceMachineRecipe irecipe : getRecipes())
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -119,13 +122,13 @@ public abstract class ChanceMachineRecipeHandler extends BaseRecipeHandler
@Override
public void loadCraftingRecipes(ItemStack result)
{
for(Map.Entry<ItemStack, ChanceOutput> irecipe : getRecipes())
for(ChanceMachineRecipe irecipe : getRecipes())
{
if(irecipe.getValue().hasPrimary() && NEIServerUtils.areStacksSameTypeCrafting(irecipe.getValue().primaryOutput, result))
if(irecipe.getOutput().hasPrimary() && NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().primaryOutput, result))
{
arecipes.add(new CachedIORecipe(irecipe));
}
else if(irecipe.getValue().hasSecondary() && NEIServerUtils.areStacksSameTypeCrafting(irecipe.getValue().secondaryOutput, result))
else if(irecipe.getOutput().hasSecondary() && NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().secondaryOutput, result))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -141,9 +144,9 @@ public abstract class ChanceMachineRecipeHandler extends BaseRecipeHandler
@Override
public void loadUsageRecipes(ItemStack ingredient)
{
for(Map.Entry irecipe : getRecipes())
for(ChanceMachineRecipe irecipe : getRecipes())
{
if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getKey(), ingredient))
if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getInput().ingredient, ingredient))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -189,9 +192,9 @@ public abstract class ChanceMachineRecipeHandler extends BaseRecipeHandler
output = chance;
}
public CachedIORecipe(Map.Entry recipe)
public CachedIORecipe(ChanceMachineRecipe recipe)
{
this((ItemStack)recipe.getKey(), (ChanceOutput)recipe.getValue());
this(recipe.getInput().ingredient, recipe.getOutput());
}
}
}

View file

@ -1,6 +1,7 @@
package mekanism.client.nei;
import java.awt.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -10,6 +11,7 @@ import mekanism.api.gas.GasStack;
import mekanism.client.gui.GuiChemicalCrystallizer;
import mekanism.common.ObfuscatedNames;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.CrystallizerRecipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.client.gui.inventory.GuiContainer;
@ -63,9 +65,9 @@ public class ChemicalCrystallizerRecipeHandler extends BaseRecipeHandler
return "mekanism.chemicalcrystallizer";
}
public Set<Entry<GasStack, ItemStack>> getRecipes()
public Collection<CrystallizerRecipe> getRecipes()
{
return Recipe.CHEMICAL_CRYSTALLIZER.get().entrySet();
return Recipe.CHEMICAL_CRYSTALLIZER.get().values();
}
@Override
@ -109,7 +111,7 @@ public class ChemicalCrystallizerRecipeHandler extends BaseRecipeHandler
{
if(outputId.equals(getRecipeId()))
{
for(Map.Entry irecipe : getRecipes())
for(CrystallizerRecipe irecipe : getRecipes())
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -122,9 +124,9 @@ public class ChemicalCrystallizerRecipeHandler extends BaseRecipeHandler
@Override
public void loadCraftingRecipes(ItemStack result)
{
for(Map.Entry irecipe : getRecipes())
for(CrystallizerRecipe irecipe : getRecipes())
{
if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getValue(), result))
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().output, result))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -230,9 +232,9 @@ public class ChemicalCrystallizerRecipeHandler extends BaseRecipeHandler
{
if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack)
{
for(Map.Entry<GasStack, ItemStack> irecipe : getRecipes())
for(CrystallizerRecipe irecipe : getRecipes())
{
if(irecipe.getKey().isGasEqual((GasStack)ingredients[0]))
if(irecipe.getInput().ingredient.isGasEqual((GasStack)ingredients[0]))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -266,9 +268,9 @@ public class ChemicalCrystallizerRecipeHandler extends BaseRecipeHandler
outputStack = new PositionedStack(output, 131-xOffset, 57-yOffset);
}
public CachedIORecipe(Map.Entry recipe)
public CachedIORecipe(CrystallizerRecipe recipe)
{
this((GasStack)recipe.getKey(), (ItemStack)recipe.getValue());
this(recipe.getInput().ingredient, recipe.getOutput().output);
}
}
}

View file

@ -1,6 +1,7 @@
package mekanism.client.nei;
import java.awt.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -11,6 +12,7 @@ import mekanism.api.gas.GasStack;
import mekanism.client.gui.GuiChemicalDissolutionChamber;
import mekanism.common.ObfuscatedNames;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.DissolutionRecipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.client.gui.inventory.GuiContainer;
@ -64,9 +66,9 @@ public class ChemicalDissolutionChamberRecipeHandler extends BaseRecipeHandler
return "mekanism.chemicaldissolutionchamber";
}
public Set<Entry<ItemStack, GasStack>> getRecipes()
public Collection<DissolutionRecipe> getRecipes()
{
return Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().entrySet();
return Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().values();
}
@Override
@ -112,16 +114,16 @@ public class ChemicalDissolutionChamberRecipeHandler extends BaseRecipeHandler
{
if(outputId.equals(getRecipeId()))
{
for(Map.Entry irecipe : getRecipes())
for(DissolutionRecipe irecipe : getRecipes())
{
arecipes.add(new CachedIORecipe(irecipe));
}
}
else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack)
{
for(Map.Entry<ItemStack, GasStack> irecipe : getRecipes())
for(DissolutionRecipe irecipe : getRecipes())
{
if(((GasStack)results[0]).isGasEqual(irecipe.getValue()))
if(((GasStack)results[0]).isGasEqual(irecipe.getOutput().output))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -241,9 +243,9 @@ public class ChemicalDissolutionChamberRecipeHandler extends BaseRecipeHandler
@Override
public void loadUsageRecipes(ItemStack ingredient)
{
for(Map.Entry irecipe : getRecipes())
for(DissolutionRecipe irecipe : getRecipes())
{
if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getKey(), ingredient))
if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getInput().ingredient, ingredient))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -279,9 +281,9 @@ public class ChemicalDissolutionChamberRecipeHandler extends BaseRecipeHandler
outputStack = output;
}
public CachedIORecipe(Map.Entry recipe)
public CachedIORecipe(DissolutionRecipe recipe)
{
this((ItemStack)recipe.getKey(), (GasStack)recipe.getValue());
this(recipe.getInput().ingredient, recipe.getOutput().output);
}
}
}

View file

@ -1,16 +1,18 @@
package mekanism.client.nei;
import java.awt.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import mekanism.api.gas.GasStack;
import mekanism.api.recipe.ChemicalPair;
import mekanism.common.recipe.inputs.ChemicalPairInput;
import mekanism.client.gui.GuiChemicalInfuser;
import mekanism.common.ObfuscatedNames;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.ChemicalInfuserRecipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.client.gui.inventory.GuiContainer;
@ -62,9 +64,9 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler
return "mekanism.chemicalinfuser";
}
public Set<Entry<ChemicalPair, GasStack>> getRecipes()
public Collection<ChemicalInfuserRecipe> getRecipes()
{
return Recipe.CHEMICAL_INFUSER.get().entrySet();
return Recipe.CHEMICAL_INFUSER.get().values();
}
@Override
@ -119,16 +121,16 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler
{
if(outputId.equals(getRecipeId()))
{
for(Map.Entry irecipe : getRecipes())
for(ChemicalInfuserRecipe irecipe : getRecipes())
{
arecipes.add(new CachedIORecipe(irecipe));
}
}
else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack)
{
for(Map.Entry<ChemicalPair, GasStack> irecipe : getRecipes())
for(ChemicalInfuserRecipe irecipe : getRecipes())
{
if(((GasStack)results[0]).isGasEqual(irecipe.getValue()))
if(((GasStack)results[0]).isGasEqual(irecipe.getOutput().output))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -144,9 +146,9 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler
{
if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack)
{
for(Map.Entry<ChemicalPair, GasStack> irecipe : getRecipes())
for(ChemicalInfuserRecipe irecipe : getRecipes())
{
if(irecipe.getKey().containsType((GasStack)ingredients[0]))
if(irecipe.getInput().containsType((GasStack)ingredients[0]))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -283,7 +285,7 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler
public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe
{
public ChemicalPair chemicalInput;
public ChemicalPairInput chemicalInput;
public GasStack outputStack;
@Override
@ -292,15 +294,15 @@ public class ChemicalInfuserRecipeHandler extends BaseRecipeHandler
return null;
}
public CachedIORecipe(ChemicalPair input, GasStack output)
public CachedIORecipe(ChemicalPairInput input, GasStack output)
{
chemicalInput = input;
outputStack = output;
}
public CachedIORecipe(Map.Entry recipe)
public CachedIORecipe(ChemicalInfuserRecipe recipe)
{
this((ChemicalPair)recipe.getKey(), (GasStack)recipe.getValue());
this(recipe.getInput(), recipe.getOutput().output);
}
}
}

View file

@ -1,6 +1,7 @@
package mekanism.client.nei;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
@ -10,6 +11,7 @@ import mekanism.api.util.ListUtils;
import mekanism.client.gui.GuiChemicalInjectionChamber;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.InjectionRecipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack;
@ -36,9 +38,9 @@ public class ChemicalInjectionChamberRecipeHandler extends AdvancedMachineRecipe
}
@Override
public Set getRecipes()
public Collection<InjectionRecipe> getRecipes()
{
return Recipe.CHEMICAL_INJECTION_CHAMBER.get().entrySet();
return Recipe.CHEMICAL_INJECTION_CHAMBER.get().values();
}
@Override

View file

@ -1,6 +1,7 @@
package mekanism.client.nei;
import java.awt.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -19,6 +20,7 @@ import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.ObfuscatedNames;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.OxidationRecipe;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -94,9 +96,9 @@ public class ChemicalOxidizerRecipeHandler extends BaseRecipeHandler
return "mekanism.chemicaloxidizer";
}
public Set<Entry<ItemStack, GasStack>> getRecipes()
public Collection<OxidationRecipe> getRecipes()
{
return Recipe.CHEMICAL_OXIDIZER.get().entrySet();
return Recipe.CHEMICAL_OXIDIZER.get().values();
}
@Override
@ -143,16 +145,16 @@ public class ChemicalOxidizerRecipeHandler extends BaseRecipeHandler
{
if(outputId.equals(getRecipeId()))
{
for(Map.Entry irecipe : getRecipes())
for(OxidationRecipe irecipe : getRecipes())
{
arecipes.add(new CachedIORecipe(irecipe));
}
}
else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack)
{
for(Map.Entry<ItemStack, GasStack> irecipe : getRecipes())
for(OxidationRecipe irecipe : getRecipes())
{
if(((GasStack)results[0]).isGasEqual(irecipe.getValue()))
if(((GasStack)results[0]).isGasEqual(irecipe.getOutput().output))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -253,9 +255,9 @@ public class ChemicalOxidizerRecipeHandler extends BaseRecipeHandler
@Override
public void loadUsageRecipes(ItemStack ingredient)
{
for(Map.Entry irecipe : getRecipes())
for(OxidationRecipe irecipe : getRecipes())
{
if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getKey(), ingredient))
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getInput().ingredient, ingredient))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -285,9 +287,9 @@ public class ChemicalOxidizerRecipeHandler extends BaseRecipeHandler
outputStack = output;
}
public CachedIORecipe(Map.Entry recipe)
public CachedIORecipe(OxidationRecipe recipe)
{
this((ItemStack)recipe.getKey(), (GasStack)recipe.getValue());
this(recipe.getInput().ingredient, recipe.getOutput().output);
}
}
}

View file

@ -1,6 +1,7 @@
package mekanism.client.nei;
import java.awt.*;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -10,6 +11,7 @@ import mekanism.api.gas.GasStack;
import mekanism.client.gui.GuiChemicalWasher;
import mekanism.common.ObfuscatedNames;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.WasherRecipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.client.gui.inventory.GuiContainer;
@ -63,9 +65,9 @@ public class ChemicalWasherRecipeHandler extends BaseRecipeHandler
return "mekanism.chemicalwasher";
}
public Set<Entry<GasStack, GasStack>> getRecipes()
public Collection<WasherRecipe> getRecipes()
{
return Recipe.CHEMICAL_WASHER.get().entrySet();
return Recipe.CHEMICAL_WASHER.get().values();
}
@Override
@ -115,16 +117,16 @@ public class ChemicalWasherRecipeHandler extends BaseRecipeHandler
{
if(outputId.equals(getRecipeId()))
{
for(Map.Entry irecipe : getRecipes())
for(WasherRecipe irecipe : getRecipes())
{
arecipes.add(new CachedIORecipe(irecipe));
}
}
else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack)
{
for(Map.Entry<GasStack, GasStack> irecipe : getRecipes())
for(WasherRecipe irecipe : getRecipes())
{
if(((GasStack)results[0]).isGasEqual(irecipe.getValue()))
if(((GasStack)results[0]).isGasEqual(irecipe.getOutput().output))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -142,7 +144,7 @@ public class ChemicalWasherRecipeHandler extends BaseRecipeHandler
{
if(((FluidStack)ingredients[0]).getFluid() == FluidRegistry.WATER)
{
for(Map.Entry<GasStack, GasStack> irecipe : getRecipes())
for(WasherRecipe irecipe : getRecipes())
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -150,9 +152,9 @@ public class ChemicalWasherRecipeHandler extends BaseRecipeHandler
}
else if(inputId.equals("gas") && ingredients.length == 1 && ingredients[0] instanceof GasStack)
{
for(Map.Entry<GasStack, GasStack> irecipe : getRecipes())
for(WasherRecipe irecipe : getRecipes())
{
if(irecipe.getKey().isGasEqual((GasStack)ingredients[0]))
if(irecipe.getOutput().output.isGasEqual((GasStack)ingredients[0]))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -340,9 +342,9 @@ public class ChemicalWasherRecipeHandler extends BaseRecipeHandler
outputStack = output;
}
public CachedIORecipe(Map.Entry recipe)
public CachedIORecipe(WasherRecipe recipe)
{
this((GasStack)recipe.getKey(), (GasStack)recipe.getValue());
this(recipe.getInput().ingredient, recipe.getOutput().output);
}
}
}

View file

@ -1,5 +1,6 @@
package mekanism.client.nei;
import java.util.Collection;
import java.util.List;
import java.util.Set;
@ -8,6 +9,7 @@ import mekanism.api.util.ListUtils;
import mekanism.client.gui.GuiCombiner;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.CombinerRecipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.init.Blocks;
@ -34,9 +36,9 @@ public class CombinerRecipeHandler extends AdvancedMachineRecipeHandler
}
@Override
public Set getRecipes()
public Collection<CombinerRecipe> getRecipes()
{
return Recipe.COMBINER.get().entrySet();
return Recipe.COMBINER.get().values();
}
@Override

View file

@ -1,10 +1,12 @@
package mekanism.client.nei;
import java.util.Collection;
import java.util.Set;
import mekanism.client.gui.GuiCrusher;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.CrusherRecipe;
import mekanism.common.util.MekanismUtils;
public class CrusherRecipeHandler extends MachineRecipeHandler
@ -34,9 +36,9 @@ public class CrusherRecipeHandler extends MachineRecipeHandler
}
@Override
public Set getRecipes()
public Collection<CrusherRecipe> getRecipes()
{
return Recipe.CRUSHER.get().entrySet();
return Recipe.CRUSHER.get().values();
}
@Override

View file

@ -7,7 +7,7 @@ import java.util.Map.Entry;
import java.util.Set;
import mekanism.api.gas.GasStack;
import mekanism.api.recipe.ChemicalPair;
import mekanism.common.recipe.inputs.ChemicalPairInput;
import mekanism.client.gui.GuiElectrolyticSeparator;
import mekanism.client.gui.GuiElement;
import mekanism.client.gui.GuiFluidGauge;
@ -110,7 +110,7 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
return "mekanism.electrolyticseparator";
}
public Set<Entry<FluidStack, ChemicalPair>> getRecipes()
public Set<Entry<FluidStack, ChemicalPairInput>> getRecipes()
{
return Recipe.ELECTROLYTIC_SEPARATOR.get().entrySet();
}
@ -180,7 +180,7 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
}
else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack)
{
for(Map.Entry<FluidStack, ChemicalPair> irecipe : getRecipes())
for(Map.Entry<FluidStack, ChemicalPairInput> irecipe : getRecipes())
{
if(irecipe.getValue().containsType((GasStack)results[0]))
{
@ -198,7 +198,7 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
{
if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
{
for(Map.Entry<FluidStack, ChemicalPair> irecipe : getRecipes())
for(Map.Entry<FluidStack, ChemicalPairInput> irecipe : getRecipes())
{
if(irecipe.getKey().isFluidEqual((FluidStack)ingredients[0]))
{
@ -368,7 +368,7 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe
{
public FluidStack fluidInput;
public ChemicalPair outputPair;
public ChemicalPairInput outputPair;
@Override
public PositionedStack getResult()
@ -376,7 +376,7 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
return null;
}
public CachedIORecipe(FluidStack input, ChemicalPair pair)
public CachedIORecipe(FluidStack input, ChemicalPairInput pair)
{
fluidInput = input;
outputPair = pair;
@ -384,7 +384,7 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
public CachedIORecipe(Map.Entry recipe)
{
this((FluidStack)recipe.getKey(), (ChemicalPair)recipe.getValue());
this((FluidStack)recipe.getKey(), (ChemicalPairInput)recipe.getValue());
}
}
}

View file

@ -1,10 +1,12 @@
package mekanism.client.nei;
import java.util.Collection;
import java.util.Set;
import mekanism.client.gui.GuiEnrichmentChamber;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.EnrichmentRecipe;
import mekanism.common.util.MekanismUtils;
public class EnrichmentChamberRecipeHandler extends MachineRecipeHandler
@ -34,9 +36,9 @@ public class EnrichmentChamberRecipeHandler extends MachineRecipeHandler
}
@Override
public Set getRecipes()
public Collection<EnrichmentRecipe> getRecipes()
{
return Recipe.ENRICHMENT_CHAMBER.get().entrySet();
return Recipe.ENRICHMENT_CHAMBER.get().values();
}
@Override

View file

@ -1,6 +1,7 @@
package mekanism.client.nei;
import java.awt.*;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
@ -14,6 +15,7 @@ import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiSlot;
import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.recipe.machines.BasicMachineRecipe;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -34,7 +36,7 @@ public abstract class MachineRecipeHandler extends BaseRecipeHandler
public abstract String getRecipeId();
public abstract Set<Entry<ItemStack, ItemStack>> getRecipes();
public abstract Collection<? extends BasicMachineRecipe> getRecipes();
public abstract ProgressBar getProgressType();
@ -93,7 +95,7 @@ public abstract class MachineRecipeHandler extends BaseRecipeHandler
{
if(outputId.equals(getRecipeId()))
{
for(Map.Entry irecipe : getRecipes())
for(BasicMachineRecipe irecipe : getRecipes())
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -106,9 +108,9 @@ public abstract class MachineRecipeHandler extends BaseRecipeHandler
@Override
public void loadCraftingRecipes(ItemStack result)
{
for(Map.Entry irecipe : getRecipes())
for(BasicMachineRecipe irecipe : getRecipes())
{
if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getValue(), result))
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getOutput().output, result))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -124,9 +126,9 @@ public abstract class MachineRecipeHandler extends BaseRecipeHandler
@Override
public void loadUsageRecipes(ItemStack ingredient)
{
for(Map.Entry irecipe : getRecipes())
for(BasicMachineRecipe irecipe : getRecipes())
{
if(NEIServerUtils.areStacksSameTypeCrafting((ItemStack)irecipe.getKey(), ingredient))
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getInput().ingredient, ingredient))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -158,9 +160,9 @@ public abstract class MachineRecipeHandler extends BaseRecipeHandler
output = new PositionedStack(itemstack1, 100, 30);
}
public CachedIORecipe(Map.Entry recipe)
public CachedIORecipe(BasicMachineRecipe recipe)
{
this((ItemStack)recipe.getKey(), (ItemStack)recipe.getValue());
this(recipe.getInput().ingredient, recipe.getOutput().output);
}
}
}

View file

@ -10,8 +10,8 @@ import java.util.Set;
import mekanism.api.infuse.InfuseObject;
import mekanism.api.infuse.InfuseRegistry;
import mekanism.api.infuse.InfuseType;
import mekanism.api.infuse.InfusionInput;
import mekanism.api.infuse.InfusionOutput;
import mekanism.common.recipe.inputs.InfusionInput;
import mekanism.common.recipe.outputs.InfusionOutput;
import mekanism.client.gui.GuiElement;
import mekanism.client.gui.GuiMetallurgicInfuser;
import mekanism.client.gui.GuiPowerBar;

View file

@ -1,5 +1,6 @@
package mekanism.client.nei;
import java.util.Collection;
import java.util.List;
import java.util.Set;
@ -9,6 +10,7 @@ import mekanism.client.gui.GuiOsmiumCompressor;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.MekanismItems;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.OsmiumCompressorRecipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.item.ItemStack;
@ -34,9 +36,9 @@ public class OsmiumCompressorRecipeHandler extends AdvancedMachineRecipeHandler
}
@Override
public Set getRecipes()
public Collection<OsmiumCompressorRecipe> getRecipes()
{
return Recipe.OSMIUM_COMPRESSOR.get().entrySet();
return Recipe.OSMIUM_COMPRESSOR.get().values();
}
@Override

View file

@ -7,8 +7,8 @@ import java.util.Map.Entry;
import java.util.Set;
import mekanism.api.gas.GasStack;
import mekanism.api.recipe.PressurizedReactants;
import mekanism.api.recipe.PressurizedRecipe;
import mekanism.common.recipe.inputs.PressurizedReactants;
import mekanism.common.recipe.machines.PressurizedRecipe;
import mekanism.client.gui.GuiElement;
import mekanism.client.gui.GuiFluidGauge;
import mekanism.client.gui.GuiGasGauge;
@ -159,21 +159,21 @@ public class PRCRecipeHandler extends BaseRecipeHandler
{
CachedIORecipe recipe = (CachedIORecipe)arecipes.get(i);
if(recipe.pressurizedRecipe.reactants.getFluid() != null)
if(recipe.pressurizedRecipe.getInput().getFluid() != null)
{
fluidInput.setDummyType(recipe.pressurizedRecipe.reactants.getFluid().getFluid());
fluidInput.setDummyType(recipe.pressurizedRecipe.getInput().getFluid().getFluid());
fluidInput.renderScale(0, 0, -xOffset, -yOffset);
}
if(recipe.pressurizedRecipe.reactants.getGas() != null)
if(recipe.pressurizedRecipe.getInput().getGas() != null)
{
gasInput.setDummyType(recipe.pressurizedRecipe.reactants.getGas().getGas());
gasInput.setDummyType(recipe.pressurizedRecipe.getInput().getGas().getGas());
gasInput.renderScale(0, 0, -xOffset, -yOffset);
}
if(recipe.pressurizedRecipe.products.getGasOutput() != null)
if(recipe.pressurizedRecipe.getOutput().getGasOutput() != null)
{
gasOutput.setDummyType(recipe.pressurizedRecipe.products.getGasOutput().getGas());
gasOutput.setDummyType(recipe.pressurizedRecipe.getOutput().getGasOutput().getGas());
gasOutput.renderScale(0, 0, -xOffset, -yOffset);
}
}
@ -192,7 +192,7 @@ public class PRCRecipeHandler extends BaseRecipeHandler
{
for(Map.Entry<PressurizedReactants, PressurizedRecipe> irecipe : getRecipes())
{
if(irecipe.getValue().reactants.containsType((GasStack)results[0]))
if(irecipe.getValue().getInput().containsType((GasStack)results[0]))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -208,7 +208,7 @@ public class PRCRecipeHandler extends BaseRecipeHandler
{
for(Map.Entry<PressurizedReactants, PressurizedRecipe> irecipe : getRecipes())
{
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getValue().products.getItemOutput(), result))
if(NEIServerUtils.areStacksSameTypeCrafting(irecipe.getValue().getOutput().getItemOutput(), result))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -266,15 +266,15 @@ public class PRCRecipeHandler extends BaseRecipeHandler
if(xAxis >= 6-5 && xAxis <= 22-5 && yAxis >= 11-10 && yAxis <= 69-10)
{
currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getFluid()));
currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getFluid()));
}
else if(xAxis >= 29-5 && xAxis <= 45-5 && yAxis >= 11-10 && yAxis <= 69-10)
{
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getGas().getGas().getLocalizedName());
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getGas().getGas().getLocalizedName());
}
else if(xAxis >= 141-5 && xAxis <= 157-5 && yAxis >= 41-10 && yAxis <= 69-10)
{
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.products.getGasOutput().getGas().getLocalizedName());
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getOutput().getGasOutput().getGas().getLocalizedName());
}
return super.handleTooltip(gui, currenttip, recipe);
@ -294,15 +294,15 @@ public class PRCRecipeHandler extends BaseRecipeHandler
if(xAxis >= 6-5 && xAxis <= 22-5 && yAxis >= 11-10 && yAxis <= 69-10)
{
fluid = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getFluid();
fluid = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getFluid();
}
else if(xAxis >= 29-5 && xAxis <= 45-5 && yAxis >= 11-10 && yAxis <= 69-10)
{
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getGas();
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getGas();
}
else if(xAxis >= 141-5 && xAxis <= 157-5 && yAxis >= 41-10 && yAxis <= 69-10)
{
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.products.getGasOutput();
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getOutput().getGasOutput();
}
if(gas != null)
@ -357,15 +357,15 @@ public class PRCRecipeHandler extends BaseRecipeHandler
if(xAxis >= 6-5 && xAxis <= 22-5 && yAxis >= 11-10 && yAxis <= 69-10)
{
fluid = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getFluid();
fluid = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getFluid();
}
else if(xAxis >= 29-5 && xAxis <= 45-5 && yAxis >= 11-10 && yAxis <= 69-10)
{
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.reactants.getGas();
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getInput().getGas();
}
else if(xAxis >= 141-5 && xAxis <= 157-5 && yAxis >= 41-10 && yAxis <= 69-10)
{
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.products.getGasOutput();
gas = ((CachedIORecipe)arecipes.get(recipe)).pressurizedRecipe.getOutput().getGasOutput();
}
if(gas != null)
@ -431,8 +431,8 @@ public class PRCRecipeHandler extends BaseRecipeHandler
pressurizedRecipe = recipe;
input = new PositionedStack(recipe.reactants.getSolid(), 54-xOffset, 35-yOffset);
output = new PositionedStack(recipe.products.getItemOutput(), 116-xOffset, 35-yOffset);
input = new PositionedStack(recipe.getInput().getSolid(), 54-xOffset, 35-yOffset);
output = new PositionedStack(recipe.getOutput().getItemOutput(), 116-xOffset, 35-yOffset);
}
public CachedIORecipe(Map.Entry recipe)

View file

@ -1,10 +1,13 @@
package mekanism.client.nei;
import java.util.Collection;
import java.util.Set;
import mekanism.client.gui.GuiPrecisionSawmill;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.ChanceMachineRecipe;
import mekanism.common.recipe.machines.SawmillRecipe;
import mekanism.common.util.MekanismUtils;
public class PrecisionSawmillRecipeHandler extends ChanceMachineRecipeHandler
@ -28,9 +31,9 @@ public class PrecisionSawmillRecipeHandler extends ChanceMachineRecipeHandler
}
@Override
public Set getRecipes()
public Collection<SawmillRecipe> getRecipes()
{
return Recipe.PRECISION_SAWMILL.get().entrySet();
return Recipe.PRECISION_SAWMILL.get().values();
}
@Override

View file

@ -1,6 +1,7 @@
package mekanism.client.nei;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;
@ -10,6 +11,7 @@ import mekanism.api.util.ListUtils;
import mekanism.client.gui.GuiProgress.ProgressBar;
import mekanism.client.gui.GuiPurificationChamber;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.machines.PurificationRecipe;
import mekanism.common.util.MekanismUtils;
import net.minecraft.init.Items;
@ -36,9 +38,9 @@ public class PurificationChamberRecipeHandler extends AdvancedMachineRecipeHandl
}
@Override
public Set getRecipes()
public Collection<PurificationRecipe> getRecipes()
{
return Recipe.PURIFICATION_CHAMBER.get().entrySet();
return Recipe.PURIFICATION_CHAMBER.get().values();
}
@Override

View file

@ -22,12 +22,12 @@ import mekanism.api.gas.OreGas;
import mekanism.api.infuse.InfuseObject;
import mekanism.api.infuse.InfuseRegistry;
import mekanism.api.infuse.InfuseType;
import mekanism.api.infuse.InfusionInput;
import mekanism.api.recipe.AdvancedInput;
import mekanism.api.recipe.ChanceOutput;
import mekanism.api.recipe.ChemicalPair;
import mekanism.api.recipe.PressurizedProducts;
import mekanism.api.recipe.PressurizedReactants;
import mekanism.common.recipe.inputs.InfusionInput;
import mekanism.common.recipe.inputs.ChemicalPairInput;
import mekanism.common.recipe.outputs.ChanceOutput;
import mekanism.common.recipe.outputs.ChemicalPairOutput;
import mekanism.common.recipe.outputs.PressurizedProducts;
import mekanism.common.recipe.inputs.PressurizedReactants;
import mekanism.api.transmitters.DynamicNetwork.ClientTickUpdate;
import mekanism.api.transmitters.DynamicNetwork.NetworkClientRequest;
import mekanism.api.transmitters.TransmitterNetworkRegistry;
@ -680,44 +680,44 @@ public class Mekanism
RecipeHandler.addPurificationChamberRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint));
//Chemical Injection Chamber Recipes
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(new ItemStack(Blocks.obsidian), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 4, 6));
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(new ItemStack(Blocks.dirt), GasRegistry.getGas("water")), new ItemStack(Blocks.clay));
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(new ItemStack(Items.gunpowder), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Dust, 1, 10));
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.obsidian), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 4, 6));
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.dirt), "water", new ItemStack(Blocks.clay));
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Items.gunpowder), "hydrogenChloride", new ItemStack(MekanismItems.Dust, 1, 10));
//Precision Sawmill Recipes
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.ladder, 3), new ChanceOutput(new ItemStack(Items.stick, 7)));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.chest), new ChanceOutput(new ItemStack(Blocks.planks, 8)));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.trapdoor), new ChanceOutput(new ItemStack(Blocks.planks, 3)));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.boat), new ChanceOutput(new ItemStack(Blocks.planks, 5)));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.bed), new ChanceOutput(new ItemStack(Blocks.planks, 3), new ItemStack(Blocks.wool, 3), 1));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.jukebox), new ChanceOutput(new ItemStack(Blocks.planks, 8), new ItemStack(Items.diamond), 1));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.bookshelf), new ChanceOutput(new ItemStack(Blocks.planks, 6), new ItemStack(Items.book, 3), 1));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.wooden_pressure_plate), new ChanceOutput(new ItemStack(Blocks.planks, 2)));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.fence), new ChanceOutput(new ItemStack(Items.stick, 3)));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.fence_gate), new ChanceOutput(new ItemStack(Blocks.planks, 2), new ItemStack(Items.stick, 4), 1));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.noteblock), new ChanceOutput(new ItemStack(Blocks.planks, 8), new ItemStack(Items.redstone, 1), 1));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.redstone_torch), new ChanceOutput(new ItemStack(Items.stick, 1), new ItemStack(Items.redstone), 1));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.crafting_table), new ChanceOutput(new ItemStack(Blocks.planks, 4)));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.ladder, 3), new ItemStack(Items.stick, 7));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.chest), new ItemStack(Blocks.planks, 8));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.trapdoor), new ItemStack(Blocks.planks, 3));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.boat), new ItemStack(Blocks.planks, 5));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Items.bed), new ItemStack(Blocks.planks, 3), new ItemStack(Blocks.wool, 3), 1);
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.jukebox), new ItemStack(Blocks.planks, 8), new ItemStack(Items.diamond), 1);
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.bookshelf), new ItemStack(Blocks.planks, 6), new ItemStack(Items.book, 3), 1);
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.wooden_pressure_plate), new ItemStack(Blocks.planks, 2));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.fence), new ItemStack(Items.stick, 3));
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.fence_gate), new ItemStack(Blocks.planks, 2), new ItemStack(Items.stick, 4), 1);
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.noteblock), new ItemStack(Blocks.planks, 8), new ItemStack(Items.redstone), 1);
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.redstone_torch), new ItemStack(Items.stick), new ItemStack(Items.redstone), 1);
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.crafting_table), new ItemStack(Blocks.planks, 4));
//Metallurgic Infuser Recipes
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("CARBON"), 10, new ItemStack(Items.iron_ingot)), new ItemStack(MekanismItems.EnrichedIron));
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("CARBON"), 10, new ItemStack(MekanismItems.EnrichedIron)), new ItemStack(MekanismItems.Dust, 1, 5));
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("REDSTONE"), 10, new ItemStack(Items.iron_ingot)), new ItemStack(MekanismItems.EnrichedAlloy));
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("FUNGI"), 10, new ItemStack(Blocks.dirt)), new ItemStack(Blocks.mycelium));
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("BIO"), 10, new ItemStack(Blocks.cobblestone)), new ItemStack(Blocks.mossy_cobblestone));
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("BIO"), 10, new ItemStack(Blocks.stonebrick, 1, 0)), new ItemStack(Blocks.stonebrick, 1, 1));
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("BIO"), 10, new ItemStack(Blocks.sand)), new ItemStack(Blocks.dirt));
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("DIAMOND"), 10, new ItemStack(MekanismItems.EnrichedAlloy)), new ItemStack(MekanismItems.ReinforcedAlloy));
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("OBSIDIAN"), 10, new ItemStack(MekanismItems.ReinforcedAlloy)), new ItemStack(MekanismItems.AtomicAlloy));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("CARBON"), 10, new ItemStack(Items.iron_ingot), new ItemStack(MekanismItems.EnrichedIron));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("CARBON"), 10, new ItemStack(MekanismItems.EnrichedIron), new ItemStack(MekanismItems.Dust, 1, 5));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("REDSTONE"), 10, new ItemStack(Items.iron_ingot), new ItemStack(MekanismItems.EnrichedAlloy));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("FUNGI"), 10, new ItemStack(Blocks.dirt), new ItemStack(Blocks.mycelium));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("BIO"), 10, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.mossy_cobblestone));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("BIO"), 10, new ItemStack(Blocks.stonebrick, 1, 0), new ItemStack(Blocks.stonebrick, 1, 1));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("BIO"), 10, new ItemStack(Blocks.sand), new ItemStack(Blocks.dirt));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("DIAMOND"), 10, new ItemStack(MekanismItems.EnrichedAlloy), new ItemStack(MekanismItems.ReinforcedAlloy));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("OBSIDIAN"), 10, new ItemStack(MekanismItems.ReinforcedAlloy), new ItemStack(MekanismItems.AtomicAlloy));
//Chemical Infuser Recipes
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));
RecipeHandler.addChemicalInfuserRecipe(new GasStack(GasRegistry.getGas("oxygen"), 1), new GasStack(GasRegistry.getGas("sulfurDioxideGas"), 2), new GasStack(GasRegistry.getGas("sulfurTrioxideGas"), 2));
RecipeHandler.addChemicalInfuserRecipe(new GasStack(GasRegistry.getGas("sulfurTrioxideGas"), 1), new GasStack(GasRegistry.getGas("water"), 1), new GasStack(GasRegistry.getGas("sulfuricAcid"), 1));
RecipeHandler.addChemicalInfuserRecipe(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 ChemicalPair(new GasStack(GasRegistry.getGas("hydrogen"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1)));
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("brine", 10), new ChemicalPair(new GasStack(GasRegistry.getGas("sodium"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1)));
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("water", 2), new GasStack(GasRegistry.getGas("hydrogen"), 2), new GasStack(GasRegistry.getGas("oxygen"), 1));
RecipeHandler.addElectrolyticSeparatorRecipe(FluidRegistry.getFluidStack("brine", 10), new GasStack(GasRegistry.getGas("sodium"), 1), new GasStack(GasRegistry.getGas("chlorine"), 1));
//T4 Processing Recipes
for(Gas gas : GasRegistry.getRegisteredGasses())
@ -736,15 +736,15 @@ public class Mekanism
//Pressurized Reaction Chamber Recipes
RecipeHandler.addPRCRecipe(
new PressurizedReactants(new ItemStack(MekanismItems.BioFuel, 2), new FluidStack(FluidRegistry.WATER, 10), new GasStack(GasRegistry.getGas("hydrogen"), 100)),
new PressurizedProducts(new ItemStack(MekanismItems.Substrate), new GasStack(GasRegistry.getGas("ethene"), 100)),
new ItemStack(MekanismItems.BioFuel, 2), new FluidStack(FluidRegistry.WATER, 10), new GasStack(GasRegistry.getGas("hydrogen"), 100),
new ItemStack(MekanismItems.Substrate), new GasStack(GasRegistry.getGas("ethene"), 100),
0,
100
);
RecipeHandler.addPRCRecipe(
new PressurizedReactants(new ItemStack(MekanismItems.Substrate), new FluidStack(FluidRegistry.getFluid("ethene"), 50), new GasStack(GasRegistry.getGas("oxygen"), 10)),
new PressurizedProducts(new ItemStack(MekanismItems.Polyethene), new GasStack(GasRegistry.getGas("oxygen"), 5)),
new ItemStack(MekanismItems.Substrate), new FluidStack(FluidRegistry.getFluid("ethene"), 50), new GasStack(GasRegistry.getGas("oxygen"), 10),
new ItemStack(MekanismItems.Polyethene), new GasStack(GasRegistry.getGas("oxygen"), 5),
1000,
60
);

View file

@ -4,7 +4,7 @@ import java.util.Map;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
import mekanism.api.recipe.AdvancedInput;
import mekanism.common.recipe.inputs.AdvancedMachineInput;
import mekanism.api.util.StackUtils;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.recipe.RecipeHandler;
@ -82,7 +82,7 @@ public interface IFactory
if(usesFuel())
{
return RecipeHandler.getOutput(new AdvancedInput(input, gas), stackDecrease, recipe.get());
return RecipeHandler.getOutput(new AdvancedMachineInput(input, gas), stackDecrease, recipe.get());
}
else {
return RecipeHandler.getOutput(input, stackDecrease, recipe.get());
@ -148,11 +148,11 @@ public interface IFactory
for(Object obj : recipe.get().entrySet())
{
if(((Map.Entry)obj).getKey() instanceof AdvancedInput)
if(((Map.Entry)obj).getKey() instanceof AdvancedMachineInput)
{
Map.Entry entry = (Map.Entry)obj;
ItemStack stack = ((AdvancedInput)entry.getKey()).itemStack;
ItemStack stack = ((AdvancedMachineInput)entry.getKey()).itemStack;
if(StackUtils.equalsWildcard(stack, itemStack))
{

View file

@ -261,26 +261,14 @@ public class BlockBasic extends Block implements IBlockCTM
case BASIC_BLOCK_1:
for(int i = 0; i < 16; i++)
{
list.add(new ItemStack(item, 1, 0));
list.add(new ItemStack(item, 1, 1));
list.add(new ItemStack(item, 1, 2));
list.add(new ItemStack(item, 1, 3));
list.add(new ItemStack(item, 1, 4));
list.add(new ItemStack(item, 1, 5));
list.add(new ItemStack(item, 1, 6));
list.add(new ItemStack(item, 1, 7));
list.add(new ItemStack(item, 1, 8));
list.add(new ItemStack(item, 1, 9));
list.add(new ItemStack(item, 1, 10));
list.add(new ItemStack(item, 1, 11));
list.add(new ItemStack(item, 1, 12));
list.add(new ItemStack(item, 1, 13));
list.add(new ItemStack(item, 1, 14));
list.add(new ItemStack(item, 1, 15));
list.add(new ItemStack(item, 1, i));
}
break;
case BASIC_BLOCK_2:
list.add(new ItemStack(item, 1, 0));
for(int i = 0; i < 1; i++)
{
list.add(new ItemStack(item, 1, i));
}
break;
}
}

View file

@ -6,9 +6,8 @@ import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.GasStack;
import mekanism.api.infuse.InfuseObject;
import mekanism.api.infuse.InfuseRegistry;
import mekanism.api.infuse.InfusionInput;
import mekanism.api.recipe.AdvancedInput;
import mekanism.api.recipe.ChanceOutput;
import mekanism.common.recipe.inputs.InfusionInput;
import mekanism.common.recipe.outputs.ChanceOutput;
import mekanism.api.util.StackUtils;
import mekanism.common.Mekanism;
import mekanism.common.MekanismBlocks;
@ -45,11 +44,11 @@ public final class OreDictManager
if(!Recipe.PRECISION_SAWMILL.containsRecipe(wildStack))
{
RecipeHandler.addPrecisionSawmillRecipe(wildStack, new ChanceOutput(new ItemStack(Items.stick, 6), new ItemStack(MekanismItems.Sawdust), 0.25));
RecipeHandler.addPrecisionSawmillRecipe(wildStack, new ItemStack(Items.stick, 6), new ItemStack(MekanismItems.Sawdust), 0.25);
}
}
else {
RecipeHandler.addPrecisionSawmillRecipe(StackUtils.size(ore, 1), new ChanceOutput(new ItemStack(Items.stick, 6), new ItemStack(MekanismItems.Sawdust), 0.25));
RecipeHandler.addPrecisionSawmillRecipe(StackUtils.size(ore, 1), new ItemStack(Items.stick, 6), new ItemStack(MekanismItems.Sawdust), 0.25);
}
}
@ -62,7 +61,7 @@ public final class OreDictManager
{
for(ItemStack ore : OreDictionary.getOres("woodRubber"))
{
RecipeHandler.addPrecisionSawmillRecipe(MekanismUtils.size(ore, 1), new ChanceOutput(new ItemStack(Blocks.planks, 4), MekanismUtils.size(OreDictionary.getOres("itemRubber").get(0), 1), 1F));
RecipeHandler.addPrecisionSawmillRecipe(MekanismUtils.size(ore, 1), new ItemStack(Blocks.planks, 4), MekanismUtils.size(OreDictionary.getOres("itemRubber").get(0), 1), 1F);
}
}
@ -167,42 +166,42 @@ public final class OreDictManager
for(ItemStack ore : OreDictionary.getOres("crystalIron"))
{
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 1, 0));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 1, 0));
}
for(ItemStack ore : OreDictionary.getOres("crystalGold"))
{
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 1, 1));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 1, 1));
}
for(ItemStack ore : OreDictionary.getOres("crystalOsmium"))
{
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 1, 2));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 1, 2));
}
for(ItemStack ore : OreDictionary.getOres("crystalCopper"))
{
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 1, 3));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 1, 3));
}
for(ItemStack ore : OreDictionary.getOres("crystalTin"))
{
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 1, 4));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 1, 4));
}
for(ItemStack ore : OreDictionary.getOres("crystalSilver"))
{
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 1, 5));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 1, 5));
}
for(ItemStack ore : OreDictionary.getOres("crystalObsidian"))
{
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 1, 6));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 1, 6));
}
for(ItemStack ore : OreDictionary.getOres("crystalLead"))
{
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 1, 7));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 1, 7));
}
for(ItemStack ore : OreDictionary.getOres("dustDirtyIron"))
@ -244,7 +243,7 @@ public final class OreDictManager
{
RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Dust, 2, 6));
RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Clump, 3, 3));
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 4, 3));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 4, 3));
RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("copper"), 1000));
}
@ -252,7 +251,7 @@ public final class OreDictManager
{
RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Dust, 2, 7));
RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Clump, 3, 4));
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 4, 4));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 4, 4));
RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("tin"), 1000));
}
@ -260,7 +259,7 @@ public final class OreDictManager
{
RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Dust, 2, 2));
RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Clump, 3, 2));
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 4, 2));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 4, 2));
RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("osmium"), 1000));
}
@ -268,7 +267,7 @@ public final class OreDictManager
{
RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Dust, 2, 0));
RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Clump, 3, 0));
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 4, 0));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 4, 0));
RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("iron"), 1000));
}
@ -276,7 +275,7 @@ public final class OreDictManager
{
RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Dust, 2, 1));
RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Clump, 3, 1));
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 4, 1));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 4, 1));
RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("gold"), 1000));
}
@ -284,7 +283,7 @@ public final class OreDictManager
{
RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Dust, 2, 8));
RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Clump, 3, 5));
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 4, 5));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 4, 5));
RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("silver"), 1000));
}
@ -292,7 +291,7 @@ public final class OreDictManager
{
RecipeHandler.addEnrichmentChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Dust, 2, 9));
RecipeHandler.addPurificationChamberRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Clump, 3, 7));
RecipeHandler.addChemicalInjectionChamberRecipe(new AdvancedInput(MekanismUtils.size(ore, 1), GasRegistry.getGas("hydrogenChloride")), new ItemStack(MekanismItems.Shard, 4, 7));
RecipeHandler.addChemicalInjectionChamberRecipe(MekanismUtils.size(ore, 1), "hydrogenChloride", new ItemStack(MekanismItems.Shard, 4, 7));
RecipeHandler.addChemicalDissolutionChamberRecipe(MekanismUtils.size(ore, 1), new GasStack(GasRegistry.getGas("lead"), 1000));
}
@ -392,7 +391,7 @@ public final class OreDictManager
for(ItemStack ore : OreDictionary.getOres("ingotOsmium"))
{
RecipeHandler.addCrusherRecipe(MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Dust, 1, 2));
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("REDSTONE"), 10, MekanismUtils.size(ore, 1)), new ItemStack(MekanismItems.ControlCircuit, 1, 0));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("REDSTONE"), 10, MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.ControlCircuit, 1, 0));
}
for(ItemStack ore : OreDictionary.getOres("ingotRedstone"))
@ -467,7 +466,7 @@ public final class OreDictManager
for(ItemStack ore : OreDictionary.getOres("dustObsidian"))
{
RecipeHandler.addCombinerRecipe(MekanismUtils.size(ore, 4), new ItemStack(Blocks.obsidian));
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("DIAMOND"), 10, MekanismUtils.size(ore, 1)), new ItemStack(MekanismItems.Dust, 1, 3));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("DIAMOND"), 10, MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Dust, 1, 3));
}
for(ItemStack ore : OreDictionary.getOres("dustOsmium"))
@ -488,7 +487,7 @@ public final class OreDictManager
for(ItemStack ore : OreDictionary.getOres("ingotCopper"))
{
RecipeHandler.addMetallurgicInfuserRecipe(InfusionInput.getInfusion(InfuseRegistry.get("TIN"), 10, MekanismUtils.size(ore, 1)), new ItemStack(MekanismItems.Ingot, 1, 2));
RecipeHandler.addMetallurgicInfuserRecipe(InfuseRegistry.get("TIN"), 10, MekanismUtils.size(ore, 1), new ItemStack(MekanismItems.Ingot, 1, 2));
}
for(ItemStack ore : OreDictionary.getOres("dustTin"))
@ -568,7 +567,7 @@ public final class OreDictManager
if(resultEntry != null)
{
RecipeHandler.addPrecisionSawmillRecipe(log, new ChanceOutput(StackUtils.size(resultEntry, 6), new ItemStack(MekanismItems.Sawdust), 1));
RecipeHandler.addPrecisionSawmillRecipe(log, StackUtils.size(resultEntry, 6), new ItemStack(MekanismItems.Sawdust), 1);
}
}
}
@ -579,7 +578,7 @@ public final class OreDictManager
if(resultEntry != null)
{
RecipeHandler.addPrecisionSawmillRecipe(log, new ChanceOutput(StackUtils.size(resultEntry, 6), new ItemStack(MekanismItems.Sawdust), 1));
RecipeHandler.addPrecisionSawmillRecipe(log, StackUtils.size(resultEntry, 6), new ItemStack(MekanismItems.Sawdust), 1);
}
}
}

View file

@ -2,7 +2,7 @@ package mekanism.common.inventory.container;
import java.util.Map;
import mekanism.api.recipe.AdvancedInput;
import mekanism.common.recipe.inputs.AdvancedMachineInput;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.tile.TileEntityAdvancedElectricMachine;
@ -170,7 +170,7 @@ public class ContainerAdvancedElectricMachine extends Container
private boolean isInputItem(ItemStack itemstack)
{
for(Map.Entry<AdvancedInput, ItemStack> entry : ((Map<AdvancedInput, ItemStack>)tileEntity.getRecipes()).entrySet())
for(Map.Entry<AdvancedMachineInput, ItemStack> entry : ((Map<AdvancedMachineInput, ItemStack>)tileEntity.getRecipes()).entrySet())
{
if(entry.getKey().itemStack.isItemEqual(itemstack))
{

View file

@ -71,7 +71,7 @@ public class ContainerChemicalDissolutionChamber extends Container
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if(RecipeHandler.getItemToGasOutput(slotStack, false, Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get()) != null)
if(RecipeHandler.getDissolutionOutput(slotStack, false) != null)
{
if(slotID != 1)
{

View file

@ -70,7 +70,7 @@ public class ContainerChemicalOxidizer extends Container
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if(RecipeHandler.getItemToGasOutput(slotStack, false, Recipe.CHEMICAL_OXIDIZER.get()) != null)
if(RecipeHandler.getOxidizerOutput(slotStack, false) != null)
{
if(slotID != 0)
{

View file

@ -1,7 +1,7 @@
package mekanism.common.inventory.container;
import mekanism.api.infuse.InfuseRegistry;
import mekanism.api.infuse.InfusionInput;
import mekanism.common.recipe.inputs.InfusionInput;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotOutput;
import mekanism.common.recipe.RecipeHandler;

View file

@ -4,18 +4,43 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import mekanism.api.infuse.InfusionInput;
import mekanism.api.infuse.InfusionOutput;
import mekanism.api.recipe.AdvancedInput;
import mekanism.api.recipe.ChanceOutput;
import mekanism.api.recipe.ChemicalPair;
import mekanism.api.recipe.PressurizedProducts;
import mekanism.api.recipe.PressurizedReactants;
import mekanism.api.recipe.PressurizedRecipe;
import mekanism.api.infuse.InfuseType;
import mekanism.common.recipe.inputs.AdvancedMachineInput;
import mekanism.common.recipe.inputs.ChemicalPairInput;
import mekanism.common.recipe.inputs.FluidInput;
import mekanism.common.recipe.inputs.GasInput;
import mekanism.common.recipe.inputs.InfusionInput;
import mekanism.common.recipe.inputs.IntegerInput;
import mekanism.common.recipe.inputs.ItemStackInput;
import mekanism.common.recipe.inputs.MachineInput;
import mekanism.common.recipe.inputs.PressurizedReactants;
import mekanism.common.recipe.outputs.ChanceOutput;
import mekanism.common.recipe.outputs.ChemicalPairOutput;
import mekanism.common.recipe.outputs.InfusionOutput;
import mekanism.common.recipe.outputs.MachineOutput;
import mekanism.api.util.StackUtils;
import mekanism.common.recipe.machines.AdvancedMachineRecipe;
import mekanism.common.recipe.machines.AmbientGasRecipe;
import mekanism.common.recipe.machines.BasicMachineRecipe;
import mekanism.common.recipe.machines.ChanceMachineRecipe;
import mekanism.common.recipe.machines.ChemicalInfuserRecipe;
import mekanism.common.recipe.machines.CombinerRecipe;
import mekanism.common.recipe.machines.CrusherRecipe;
import mekanism.common.recipe.machines.CrystallizerRecipe;
import mekanism.common.recipe.machines.DissolutionRecipe;
import mekanism.common.recipe.machines.EnrichmentRecipe;
import mekanism.common.recipe.machines.InjectionRecipe;
import mekanism.common.recipe.machines.MachineRecipe;
import mekanism.common.recipe.machines.MetallurgicInfuserRecipe;
import mekanism.common.recipe.machines.OsmiumCompressorRecipe;
import mekanism.common.recipe.machines.OxidationRecipe;
import mekanism.common.recipe.machines.PressurizedRecipe;
import mekanism.common.recipe.machines.PurificationRecipe;
import mekanism.common.recipe.machines.SawmillRecipe;
import mekanism.common.recipe.machines.SeparatorRecipe;
import mekanism.common.recipe.machines.WasherRecipe;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
@ -29,9 +54,9 @@ import net.minecraftforge.fluids.FluidTank;
*/
public final class RecipeHandler
{
public static void addRecipe(Recipe recipe, Object input, Object output)
public static void addRecipe(Recipe recipeMap, MachineRecipe recipe)
{
recipe.put(input, output);
recipeMap.put(recipe);
}
/**
@ -41,7 +66,7 @@ public final class RecipeHandler
*/
public static void addEnrichmentChamberRecipe(ItemStack input, ItemStack output)
{
Recipe.ENRICHMENT_CHAMBER.put(input, output);
addRecipe(Recipe.ENRICHMENT_CHAMBER, new EnrichmentRecipe(input, output));
}
/**
@ -51,7 +76,7 @@ public final class RecipeHandler
*/
public static void addOsmiumCompressorRecipe(ItemStack input, ItemStack output)
{
Recipe.OSMIUM_COMPRESSOR.put(new AdvancedInput(input, GasRegistry.getGas("liquidOsmium")), output);
addRecipe(Recipe.OSMIUM_COMPRESSOR, new OsmiumCompressorRecipe(input, output));
}
/**
@ -61,7 +86,7 @@ public final class RecipeHandler
*/
public static void addCombinerRecipe(ItemStack input, ItemStack output)
{
Recipe.COMBINER.put(new AdvancedInput(input, GasRegistry.getGas("liquidStone")), output);
addRecipe(Recipe.COMBINER, new CombinerRecipe(input, output));
}
/**
@ -71,7 +96,7 @@ public final class RecipeHandler
*/
public static void addCrusherRecipe(ItemStack input, ItemStack output)
{
Recipe.CRUSHER.put(input, output);
addRecipe(Recipe.CRUSHER, new CrusherRecipe(input, output));
}
/**
@ -81,27 +106,30 @@ public final class RecipeHandler
*/
public static void addPurificationChamberRecipe(ItemStack input, ItemStack output)
{
Recipe.PURIFICATION_CHAMBER.put(new AdvancedInput(input, GasRegistry.getGas("oxygen")), output);
addRecipe(Recipe.PURIFICATION_CHAMBER, new PurificationRecipe(input, output));
}
/**
* Add a Metallurgic Infuser recipe.
* @param input - input Infusion
* @param infuse - which Infuse to use
* @param amount - how much of the Infuse to use
* @param input - input ItemStack
* @param output - output ItemStack
*/
public static void addMetallurgicInfuserRecipe(InfusionInput input, ItemStack output)
public static void addMetallurgicInfuserRecipe(InfuseType infuse, int amount, ItemStack input, ItemStack output)
{
Recipe.METALLURGIC_INFUSER.put(input, InfusionOutput.getInfusion(input, output));
addRecipe(Recipe.METALLURGIC_INFUSER, new MetallurgicInfuserRecipe(new InfusionInput(infuse, amount, input), output));
}
/**
* Add a Chemical Infuser recipe.
* @param input - input ChemicalPair
* @param leftInput - left GasStack to input
* @param rightInput - right GasStack to input
* @param output - output GasStack
*/
public static void addChemicalInfuserRecipe(ChemicalPair input, GasStack output)
public static void addChemicalInfuserRecipe(GasStack leftInput, GasStack rightInput, GasStack output)
{
Recipe.CHEMICAL_INFUSER.put(input, output);
addRecipe(Recipe.CHEMICAL_INFUSER, new ChemicalInfuserRecipe(leftInput, rightInput, output));
}
/**
@ -111,7 +139,7 @@ public final class RecipeHandler
*/
public static void addChemicalOxidizerRecipe(ItemStack input, GasStack output)
{
Recipe.CHEMICAL_OXIDIZER.put(input, output);
addRecipe(Recipe.CHEMICAL_OXIDIZER, new OxidationRecipe(input, output));
}
/**
@ -119,29 +147,42 @@ public final class RecipeHandler
* @param input - input ItemStack
* @param output - output ItemStack
*/
public static void addChemicalInjectionChamberRecipe(AdvancedInput input, ItemStack output)
public static void addChemicalInjectionChamberRecipe(ItemStack input, String gasName, ItemStack output)
{
Recipe.CHEMICAL_INJECTION_CHAMBER.put(input, output);
addRecipe(Recipe.CHEMICAL_INJECTION_CHAMBER, new InjectionRecipe(input, gasName, output));
}
/**
* Add an Electrolytic Separator recipe.
* @param fluid - FluidStack to electrolyze
* @param products - Pair of gases to produce when the fluid is electrolyzed
* @param leftOutput - left gas to produce when the fluid is electrolyzed
* @param rightOutput - right gas to produce when the fluid is electrolyzed
*/
public static void addElectrolyticSeparatorRecipe(FluidStack fluid, ChemicalPair products)
public static void addElectrolyticSeparatorRecipe(FluidStack fluid, GasStack leftOutput, GasStack rightOutput)
{
Recipe.ELECTROLYTIC_SEPARATOR.put(fluid, products);
addRecipe(Recipe.ELECTROLYTIC_SEPARATOR, new SeparatorRecipe(fluid, leftOutput, rightOutput));
}
/**
* Add an Precision Sawmill recipe.
* Add a Precision Sawmill recipe.
* @param input - input ItemStack
* @param output - output ChanceOutput
* @param primaryOutput - guaranteed output
* @param secondaryOutput - possible extra output
* @param chance - probability of obtaining extra output
*/
public static void addPrecisionSawmillRecipe(ItemStack input, ChanceOutput output)
public static void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, double chance)
{
Recipe.PRECISION_SAWMILL.put(input, output);
addRecipe(Recipe.PRECISION_SAWMILL, new SawmillRecipe(input, primaryOutput, secondaryOutput, chance));
}
/**
* Add a Precision Sawmill recipe with no chance output
* @param input - input ItemStack
* @param primaryOutput - guaranteed output
*/
public static void addPrecisionSawmillRecipe(ItemStack input, ItemStack primaryOutput)
{
addRecipe(Recipe.PRECISION_SAWMILL, new SawmillRecipe(input, primaryOutput));
}
/**
@ -151,7 +192,7 @@ public final class RecipeHandler
*/
public static void addChemicalDissolutionChamberRecipe(ItemStack input, GasStack output)
{
Recipe.CHEMICAL_DISSOLUTION_CHAMBER.put(input, output);
addRecipe(Recipe.CHEMICAL_DISSOLUTION_CHAMBER, new DissolutionRecipe(input, output));
}
/**
@ -161,7 +202,7 @@ public final class RecipeHandler
*/
public static void addChemicalWasherRecipe(GasStack input, GasStack output)
{
Recipe.CHEMICAL_WASHER.put(input, output);
addRecipe(Recipe.CHEMICAL_WASHER, new WasherRecipe(input, output));
}
/**
@ -171,20 +212,27 @@ public final class RecipeHandler
*/
public static void addChemicalCrystallizerRecipe(GasStack input, ItemStack output)
{
Recipe.CHEMICAL_CRYSTALLIZER.put(input, output);
addRecipe(Recipe.CHEMICAL_CRYSTALLIZER, new CrystallizerRecipe(input, output));
}
/**
* Add a Pressurized Reaction Chamber recipe.
* @param input - input PressurizedReactants
* @param output - output PressurizedProducts
* @param inputSolid - input ItemStack
* @param inputFluid - input FluidStack
* @param inputGas - input GasStack
* @param outputSolid - output ItemStack
* @param outputGas - output GasStack
* @param extraEnergy - extra energy needed by the recipe
* @param ticks - amount of ticks it takes for this recipe to complete
*/
public static void addPRCRecipe(PressurizedReactants input, PressurizedProducts output, double extraEnergy, int ticks)
public static void addPRCRecipe(ItemStack inputSolid, FluidStack inputFluid, GasStack inputGas, ItemStack outputSolid, GasStack outputGas, double extraEnergy, int ticks)
{
PressurizedRecipe recipe = new PressurizedRecipe(input, extraEnergy, output, ticks);
Recipe.PRESSURIZED_REACTION_CHAMBER.put(input, recipe);
addRecipe(Recipe.PRESSURIZED_REACTION_CHAMBER, new PressurizedRecipe(inputSolid, inputFluid, inputGas, outputSolid, outputGas, extraEnergy, ticks));
}
public static void addAmbientGas(int dimensionID, String ambientGasName)
{
addRecipe(Recipe.AMBIENT_ACCUMULATOR, new AmbientGasRecipe(dimensionID, ambientGasName));
}
/**
@ -197,22 +245,22 @@ public final class RecipeHandler
{
if(infusion != null && infusion.inputStack != null)
{
HashMap<InfusionInput, InfusionOutput> recipes = Recipe.METALLURGIC_INFUSER.get();
HashMap<InfusionInput, MetallurgicInfuserRecipe> recipes = Recipe.METALLURGIC_INFUSER.get();
for(Map.Entry<InfusionInput, InfusionOutput> entry : recipes.entrySet())
MetallurgicInfuserRecipe recipe = recipes.get(infusion);
if(recipe != null)
{
InfusionInput input = (InfusionInput)entry.getKey();
if(StackUtils.equalsWildcard(input.inputStack, infusion.inputStack) && infusion.inputStack.stackSize >= input.inputStack.stackSize)
if(StackUtils.equalsWildcard(recipe.getInput().inputStack, infusion.inputStack) && infusion.inputStack.stackSize >= recipe.getInput().inputStack.stackSize)
{
if(infusion.infusionType == input.infusionType)
if(infusion.infusionType == recipe.getInput().infusionType)
{
if(stackDecrease)
{
infusion.inputStack.stackSize -= ((InfusionInput)entry.getKey()).inputStack.stackSize;
infusion.inputStack.stackSize -= recipe.getInput().inputStack.stackSize;
}
return ((InfusionOutput)entry.getValue()).copy();
return recipe.getOutput().copy();
}
}
}
@ -230,24 +278,26 @@ public final class RecipeHandler
*/
public static GasStack getChemicalInfuserOutput(GasTank leftTank, GasTank rightTank, boolean doRemove)
{
ChemicalPair input = new ChemicalPair(leftTank.getGas(), rightTank.getGas());
ChemicalPairInput input = new ChemicalPairInput(leftTank.getGas(), rightTank.getGas());
if(input.isValid())
{
HashMap<ChemicalPair, GasStack> recipes = Recipe.CHEMICAL_INFUSER.get();
HashMap<ChemicalPairInput, ChemicalInfuserRecipe> recipes = Recipe.CHEMICAL_INFUSER.get();
for(Map.Entry<ChemicalPair, GasStack> entry : recipes.entrySet())
ChemicalInfuserRecipe recipe = recipes.get(input);
if(recipe != null)
{
ChemicalPair key = (ChemicalPair)entry.getKey();
ChemicalPairInput required = recipe.getInput();
if(key.meetsInput(input))
if(required.meetsInput(input))
{
if(doRemove)
{
key.draw(leftTank, rightTank);
required.draw(leftTank, rightTank);
}
return entry.getValue().copy();
return recipe.getOutput().output.copy();
}
}
}
@ -263,21 +313,23 @@ public final class RecipeHandler
*/
public static ItemStack getChemicalCrystallizerOutput(GasTank gasTank, boolean removeGas)
{
GasStack gas = gasTank.getGas();
GasInput input = new GasInput(gasTank.getGas());
if(gas != null)
if(input.ingredient != null)
{
HashMap<GasStack, ItemStack> recipes = Recipe.CHEMICAL_CRYSTALLIZER.get();
HashMap<GasInput, CrystallizerRecipe> recipes = Recipe.CHEMICAL_CRYSTALLIZER.get();
for(Map.Entry<GasStack, ItemStack> entry : recipes.entrySet())
CrystallizerRecipe recipe = recipes.get(input);
if(recipe != null)
{
GasStack key = (GasStack)entry.getKey();
GasStack key = recipe.getInput().ingredient;
if(key != null && key.getGas() == gas.getGas() && gas.amount >= key.amount)
if(key != null && key.getGas() == input.ingredient.getGas() && input.ingredient.amount >= key.amount)
{
gasTank.draw(key.amount, removeGas);
return entry.getValue().copy();
return recipe.getOutput().output.copy();
}
}
}
@ -293,21 +345,23 @@ public final class RecipeHandler
*/
public static GasStack getChemicalWasherOutput(GasTank gasTank, boolean removeGas)
{
GasStack gas = gasTank.getGas();
GasInput input = new GasInput(gasTank.getGas());
if(gas != null)
if(input.ingredient != null)
{
HashMap<GasStack, GasStack> recipes = Recipe.CHEMICAL_WASHER.get();
HashMap<GasInput, WasherRecipe> recipes = Recipe.CHEMICAL_WASHER.get();
for(Map.Entry<GasStack, GasStack> entry : recipes.entrySet())
WasherRecipe recipe = recipes.get(input);
if(recipe != null)
{
GasStack key = (GasStack)entry.getKey();
GasStack key = recipe.getInput().ingredient;
if(key != null && key.getGas() == gas.getGas() && gas.amount >= key.amount)
if(key != null && key.getGas() == input.ingredient.getGas() && input.ingredient.amount >= key.amount)
{
gasTank.draw(key.amount, removeGas);
return entry.getValue().copy();
return recipe.getOutput().output.copy();
}
}
}
@ -321,13 +375,19 @@ public final class RecipeHandler
* @param stackDecrease - whether or not to decrease the input slot's stack size
* @return output GasStack
*/
public static GasStack getItemToGasOutput(ItemStack itemstack, boolean stackDecrease, HashMap<ItemStack, GasStack> recipes)
public static GasStack getDissolutionOutput(ItemStack itemstack, boolean stackDecrease)
{
if(itemstack != null)
{
for(Map.Entry<ItemStack, GasStack> entry : recipes.entrySet())
ItemStackInput input = new ItemStackInput(itemstack);
HashMap<ItemStackInput, DissolutionRecipe> recipes = Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get();
DissolutionRecipe recipe = recipes.get(input);
if(recipe != null)
{
ItemStack stack = (ItemStack)entry.getKey();
ItemStack stack = recipe.getInput().ingredient;
if(StackUtils.equalsWildcard(stack, itemstack) && itemstack.stackSize >= stack.stackSize)
{
@ -336,7 +396,42 @@ public final class RecipeHandler
itemstack.stackSize -= stack.stackSize;
}
return entry.getValue().copy();
return recipe.getOutput().output.copy();
}
}
}
return null;
}
/**
* Gets the GasStack of the ItemStack in the parameters using a defined map.
* @param itemstack - input ItemStack
* @param stackDecrease - whether or not to decrease the input slot's stack size
* @return output GasStack
*/
public static GasStack getOxidizerOutput(ItemStack itemstack, boolean stackDecrease)
{
if(itemstack != null)
{
ItemStackInput input = new ItemStackInput(itemstack);
HashMap<ItemStackInput, OxidationRecipe> recipes = Recipe.CHEMICAL_OXIDIZER.get();
OxidationRecipe recipe = recipes.get(input);
if(recipe != null)
{
ItemStack stack = recipe.getInput().ingredient;
if(StackUtils.equalsWildcard(stack, itemstack) && itemstack.stackSize >= stack.stackSize)
{
if(stackDecrease)
{
itemstack.stackSize -= stack.stackSize;
}
return recipe.getOutput().output.copy();
}
}
}
@ -351,13 +446,17 @@ public final class RecipeHandler
* @param recipes - Map of recipes
* @return output ChanceOutput
*/
public static ChanceOutput getChanceOutput(ItemStack itemstack, boolean stackDecrease, Map<ItemStack, ChanceOutput> recipes)
public static ChanceOutput getChanceOutput(ItemStack itemstack, boolean stackDecrease, Map<ItemStackInput, ? extends ChanceMachineRecipe> recipes)
{
if(itemstack != null)
{
for(Map.Entry entry : recipes.entrySet())
ItemStackInput input = new ItemStackInput(itemstack);
ChanceMachineRecipe recipe = recipes.get(input);
if(recipe != null)
{
ItemStack stack = (ItemStack)entry.getKey();
ItemStack stack = recipe.getInput().ingredient;
if(StackUtils.equalsWildcard(stack, itemstack) && itemstack.stackSize >= stack.stackSize)
{
@ -366,7 +465,7 @@ public final class RecipeHandler
itemstack.stackSize -= stack.stackSize;
}
return ((ChanceOutput)entry.getValue()).copy();
return recipe.getOutput().copy();
}
}
}
@ -381,13 +480,17 @@ public final class RecipeHandler
* @param recipes - Map of recipes
* @return output ItemStack
*/
public static ItemStack getOutput(ItemStack itemstack, boolean stackDecrease, Map<ItemStack, ItemStack> recipes)
public static ItemStack getOutput(ItemStack itemstack, boolean stackDecrease, Map<ItemStackInput, ? extends BasicMachineRecipe> recipes)
{
if(itemstack != null)
{
for(Map.Entry entry : recipes.entrySet())
ItemStackInput input = new ItemStackInput(itemstack);
BasicMachineRecipe recipe = recipes.get(input);
if(recipe != null)
{
ItemStack stack = (ItemStack)entry.getKey();
ItemStack stack = recipe.getInput().ingredient;
if(StackUtils.equalsWildcard(stack, itemstack) && itemstack.stackSize >= stack.stackSize)
{
@ -396,7 +499,7 @@ public final class RecipeHandler
itemstack.stackSize -= stack.stackSize;
}
return ((ItemStack)entry.getValue()).copy();
return recipe.getOutput().output.copy();
}
}
}
@ -410,21 +513,20 @@ public final class RecipeHandler
* @param recipes - Map of recipes
* @return output ItemStack
*/
public static ItemStack getOutput(AdvancedInput input, boolean stackDecrease, Map<AdvancedInput, ItemStack> recipes)
public static ItemStack getOutput(AdvancedMachineInput input, boolean stackDecrease, Map<AdvancedMachineInput, ? extends AdvancedMachineRecipe> recipes)
{
if(input != null && input.isValid())
{
for(Map.Entry<AdvancedInput, ItemStack> entry : recipes.entrySet())
{
if(entry.getKey().matches(input))
{
if(stackDecrease)
{
input.itemStack.stackSize -= entry.getKey().itemStack.stackSize;
}
AdvancedMachineRecipe recipe = recipes.get(input);
return entry.getValue().copy();
if(recipe != null && recipe.getInput().matches(input))
{
if(stackDecrease)
{
input.itemStack.stackSize -= recipe.getInput().itemStack.stackSize;
}
return recipe.getOutput().output.copy();
}
}
@ -435,23 +537,27 @@ public final class RecipeHandler
* Get the result of electrolysing a given fluid
* @param fluidTank - the FluidTank to electrolyse fluid from
*/
public static ChemicalPair getElectrolyticSeparatorOutput(FluidTank fluidTank, boolean doRemove)
public static ChemicalPairOutput getElectrolyticSeparatorOutput(FluidTank fluidTank, boolean doRemove)
{
FluidStack fluid = fluidTank.getFluid();
if(fluid != null)
{
HashMap<FluidStack, ChemicalPair> recipes = Recipe.ELECTROLYTIC_SEPARATOR.get();
FluidInput input = new FluidInput(fluid);
for(Map.Entry<FluidStack, ChemicalPair> entry : recipes.entrySet())
HashMap<FluidInput, SeparatorRecipe> recipes = Recipe.ELECTROLYTIC_SEPARATOR.get();
SeparatorRecipe recipe = recipes.get(input);
if(recipe != null)
{
FluidStack key = (FluidStack)entry.getKey();
FluidStack key = recipe.getInput().ingredient;
if(fluid.containsFluid(key))
{
fluidTank.drain(key.amount, doRemove);
return entry.getValue().copy();
return recipe.getOutput().copy();
}
}
}
@ -464,24 +570,29 @@ public final class RecipeHandler
FluidStack inputFluid = inputFluidTank.getFluid();
GasStack inputGas = inputGasTank.getGas();
if(inputFluid != null && inputGas != null)
if(inputItem != null && inputFluid != null && inputGas != null)
{
PressurizedReactants input = new PressurizedReactants(inputItem, inputFluid, inputGas);
HashMap<PressurizedReactants, PressurizedRecipe> recipes = Recipe.PRESSURIZED_REACTION_CHAMBER.get();
for(PressurizedRecipe recipe : recipes.values())
{
PressurizedReactants reactants = recipe.reactants;
PressurizedRecipe recipe = recipes.get(input);
if(reactants.meetsInput(inputItem, inputFluid, inputGas))
{
return recipe.copy();
}
if(recipe.getInput().meets(input))
{
return recipe.copy();
}
}
return null;
}
public static GasStack getDimensionGas(Integer dimensionID)
{
HashMap<IntegerInput, AmbientGasRecipe> recipes = Recipe.AMBIENT_ACCUMULATOR.get();
return recipes.get(new IntegerInput(dimensionID)).getOutput().output;
}
/**
* Gets the output ItemStack of the ItemStack in the parameters.
* @param itemstack - input ItemStack
@ -524,32 +635,33 @@ public final class RecipeHandler
public static enum Recipe
{
ENRICHMENT_CHAMBER(new HashMap<ItemStack, ItemStack>()),
OSMIUM_COMPRESSOR(new HashMap<AdvancedInput, ItemStack>()),
COMBINER(new HashMap<AdvancedInput, ItemStack>()),
CRUSHER(new HashMap<ItemStack, ItemStack>()),
PURIFICATION_CHAMBER(new HashMap<AdvancedInput, ItemStack>()),
METALLURGIC_INFUSER(new HashMap<InfusionInput, InfusionOutput>()),
CHEMICAL_INFUSER(new HashMap<ChemicalPair, GasStack>()),
CHEMICAL_OXIDIZER(new HashMap<ItemStack, GasStack>()),
CHEMICAL_INJECTION_CHAMBER(new HashMap<AdvancedInput, ItemStack>()),
ELECTROLYTIC_SEPARATOR(new HashMap<FluidStack, ChemicalPair>()),
PRECISION_SAWMILL(new HashMap<ItemStack, ChanceOutput>()),
CHEMICAL_DISSOLUTION_CHAMBER(new HashMap<ItemStack, FluidStack>()),
CHEMICAL_WASHER(new HashMap<GasStack, GasStack>()),
CHEMICAL_CRYSTALLIZER(new HashMap<GasStack, ItemStack>()),
PRESSURIZED_REACTION_CHAMBER(new HashMap<PressurizedReactants, PressurizedRecipe>());
ENRICHMENT_CHAMBER(new HashMap<ItemStackInput, EnrichmentRecipe>()),
OSMIUM_COMPRESSOR(new HashMap<AdvancedMachineInput, OsmiumCompressorRecipe>()),
COMBINER(new HashMap<AdvancedMachineInput, CombinerRecipe>()),
CRUSHER(new HashMap<ItemStackInput, CrusherRecipe>()),
PURIFICATION_CHAMBER(new HashMap<AdvancedMachineInput, PurificationRecipe>()),
METALLURGIC_INFUSER(new HashMap<InfusionInput, MetallurgicInfuserRecipe>()),
CHEMICAL_INFUSER(new HashMap<ChemicalPairInput, ChemicalInfuserRecipe>()),
CHEMICAL_OXIDIZER(new HashMap<ItemStackInput, OxidationRecipe>()),
CHEMICAL_INJECTION_CHAMBER(new HashMap<AdvancedMachineInput, InjectionRecipe>()),
ELECTROLYTIC_SEPARATOR(new HashMap<FluidInput, SeparatorRecipe>()),
PRECISION_SAWMILL(new HashMap<ItemStackInput, SawmillRecipe>()),
CHEMICAL_DISSOLUTION_CHAMBER(new HashMap<ItemStackInput, DissolutionRecipe>()),
CHEMICAL_WASHER(new HashMap<GasInput, WasherRecipe>()),
CHEMICAL_CRYSTALLIZER(new HashMap<GasInput, CrystallizerRecipe>()),
PRESSURIZED_REACTION_CHAMBER(new HashMap<PressurizedReactants, PressurizedRecipe>()),
AMBIENT_ACCUMULATOR(new HashMap<IntegerInput, AmbientGasRecipe>());
private HashMap recipes;
private Recipe(HashMap map)
private Recipe(HashMap<? extends MachineInput, ? extends MachineRecipe> map)
{
recipes = map;
}
public void put(Object input, Object output)
public void put(MachineRecipe<? extends MachineInput, ? extends MachineOutput> recipe)
{
recipes.put(input, output);
recipes.put(recipe.getInput(), recipe);
}
public boolean containsRecipe(ItemStack input)
@ -560,25 +672,25 @@ public final class RecipeHandler
{
Map.Entry entry = (Map.Entry)obj;
if(entry.getKey() instanceof ItemStack)
if(entry.getKey() instanceof ItemStackInput)
{
ItemStack stack = (ItemStack)entry.getKey();
ItemStack stack = ((ItemStackInput)entry.getKey()).ingredient;
if(StackUtils.equalsWildcard(stack, input))
{
return true;
}
}
else if(entry.getKey() instanceof FluidStack)
else if(entry.getKey() instanceof FluidInput)
{
if(((FluidStack)entry.getKey()).isFluidEqual(input))
if(((FluidInput)entry.getKey()).ingredient.isFluidEqual(input))
{
return true;
}
}
else if(entry.getKey() instanceof AdvancedInput)
else if(entry.getKey() instanceof AdvancedMachineInput)
{
ItemStack stack = ((AdvancedInput)entry.getKey()).itemStack;
ItemStack stack = ((AdvancedMachineInput)entry.getKey()).itemStack;
if(StackUtils.equalsWildcard(stack, input))
{

View file

@ -0,0 +1,41 @@
package mekanism.common.recipe.inputs;
import mekanism.api.gas.Gas;
import mekanism.api.util.StackUtils;
import net.minecraft.item.ItemStack;
public class AdvancedMachineInput extends MachineInput
{
public ItemStack itemStack;
public Gas gasType;
public AdvancedMachineInput(ItemStack item, Gas gas)
{
itemStack = item;
gasType = gas;
}
public boolean isValid()
{
return itemStack != null && gasType != null;
}
public boolean matches(AdvancedMachineInput input)
{
return StackUtils.equalsWildcard(itemStack, input.itemStack) && input.itemStack.stackSize >= itemStack.stackSize;
}
@Override
public int hashIngredients()
{
return StackUtils.hashItemStack(itemStack) << 8 | gasType.getID();
}
@Override
public boolean testEquality(MachineInput other)
{
return other instanceof AdvancedMachineInput && StackUtils.equalsWildcardWithNBT(itemStack, ((AdvancedMachineInput)other).itemStack) && gasType.getID() == ((AdvancedMachineInput)other).gasType.getID();
}
}

View file

@ -0,0 +1,134 @@
package mekanism.common.recipe.inputs;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
/**
* An input of gasses for recipe use.
* @author aidancbrady
*
*/
public class ChemicalPairInput extends MachineInput
{
/** The left gas of this chemical input */
public GasStack leftGas;
/** The right gas of this chemical input */
public GasStack rightGas;
/**
* Creates a chemical input with two defined gasses.
* @param left - left gas
* @param right - right gas
*/
public ChemicalPairInput(GasStack left, GasStack right)
{
leftGas = left;
rightGas = right;
}
/**
* If this is a valid ChemicalPair
* @return
*/
public boolean isValid()
{
return leftGas != null && rightGas != null;
}
/**
* Whether or not the defined input contains the same gasses and at least the required amount of the defined gasses as this input.
* @param input - input to check
* @return if the input meets this input's requirements
*/
public boolean meetsInput(ChemicalPairInput input)
{
return meets(input) || meets(input.swap());
}
/**
* Swaps the right gas and left gas of this input.
* @return a swapped ChemicalInput
*/
public ChemicalPairInput swap()
{
return new ChemicalPairInput(rightGas, leftGas);
}
/**
* Draws the needed amount of gas from each tank.
* @param leftTank - left tank to draw from
* @param rightTank - right tank to draw from
*/
public void draw(GasTank leftTank, GasTank rightTank)
{
if(meets(new ChemicalPairInput(leftTank.getGas(), rightTank.getGas())))
{
leftTank.draw(leftGas.amount, true);
rightTank.draw(rightGas.amount, true);
}
else if(meets(new ChemicalPairInput(rightTank.getGas(), leftTank.getGas())))
{
leftTank.draw(rightGas.amount, true);
rightTank.draw(leftGas.amount, true);
}
}
/**
* Whether or not one of this ChemicalInput's GasStack entry's gas type is equal to the gas type of the given gas.
* @param stack - stack to check
* @return if the stack's gas type is contained in this ChemicalInput
*/
public boolean containsType(GasStack stack)
{
if(stack == null || stack.amount == 0)
{
return false;
}
return stack.isGasEqual(leftGas) || stack.isGasEqual(rightGas);
}
/**
* Actual implementation of meetsInput(), performs the checks.
* @param input - input to check
* @return if the input meets this input's requirements
*/
private boolean meets(ChemicalPairInput input)
{
if(input == null || !input.isValid())
{
return false;
}
if(input.leftGas.getGas() != leftGas.getGas() || input.rightGas.getGas() != rightGas.getGas())
{
return false;
}
return input.leftGas.amount >= leftGas.amount && input.rightGas.amount >= rightGas.amount;
}
public ChemicalPairInput copy()
{
return new ChemicalPairInput(leftGas.copy(), rightGas.copy());
}
@Override
public int hashIngredients()
{
return (leftGas.hashCode() << 8 | rightGas.hashCode()) + (rightGas.hashCode() << 8 | leftGas.hashCode());
}
@Override
public boolean testEquality(MachineInput other)
{
if(other instanceof ChemicalPairInput)
{
int leftID = ((ChemicalPairInput)other).leftGas.hashCode();
int rightID = ((ChemicalPairInput)other).rightGas.hashCode();
return (leftID == leftGas.hashCode() && rightID == rightGas.hashCode()) || (leftID == rightGas.hashCode() && rightID == leftGas.hashCode());
}
return false;
}
}

View file

@ -0,0 +1,25 @@
package mekanism.common.recipe.inputs;
import net.minecraftforge.fluids.FluidStack;
public class FluidInput extends MachineInput
{
public FluidStack ingredient;
public FluidInput(FluidStack stack)
{
ingredient = stack;
}
@Override
public int hashIngredients()
{
return ingredient.hashCode();
}
@Override
public boolean testEquality(MachineInput other)
{
return other instanceof FluidInput && ingredient.equals(((FluidInput)other).ingredient);
}
}

View file

@ -0,0 +1,25 @@
package mekanism.common.recipe.inputs;
import mekanism.api.gas.GasStack;
public class GasInput extends MachineInput
{
public GasStack ingredient;
public GasInput(GasStack stack)
{
ingredient = stack;
}
@Override
public int hashIngredients()
{
return ingredient.hashCode();
}
@Override
public boolean testEquality(MachineInput other)
{
return other instanceof GasInput && ((GasInput)other).ingredient.hashCode() == ingredient.hashCode();
}
}

View file

@ -1,4 +1,7 @@
package mekanism.api.infuse;
package mekanism.common.recipe.inputs;
import mekanism.api.infuse.InfuseType;
import mekanism.api.util.StackUtils;
import net.minecraft.item.ItemStack;
@ -7,7 +10,7 @@ import net.minecraft.item.ItemStack;
* @author AidanBrady
*
*/
public class InfusionInput
public class InfusionInput extends MachineInput
{
/** The type of this infusion */
public InfuseType infusionType;
@ -29,4 +32,21 @@ public class InfusionInput
{
return new InfusionInput(type, stored, itemstack);
}
@Override
public int hashIngredients()
{
return infusionType.unlocalizedName.hashCode() << 8 | StackUtils.hashItemStack(inputStack);
}
@Override
public boolean testEquality(MachineInput other)
{
if(other instanceof InfusionInput)
{
InfusionInput ii = (InfusionInput)other;
return infusionType == ii.infusionType && StackUtils.equalsWildcardWithNBT(inputStack, ii.inputStack);
}
return false;
}
}

View file

@ -0,0 +1,24 @@
package mekanism.common.recipe.inputs;
public class IntegerInput extends MachineInput
{
public int ingredient;
public IntegerInput(int integer)
{
ingredient = integer;
}
@Override
public int hashIngredients()
{
return ingredient;
}
@Override
public boolean testEquality(MachineInput other)
{
return other instanceof IntegerInput && ingredient == ((IntegerInput)other).ingredient;
}
}

View file

@ -0,0 +1,27 @@
package mekanism.common.recipe.inputs;
import mekanism.api.util.StackUtils;
import net.minecraft.item.ItemStack;
public class ItemStackInput extends MachineInput
{
public ItemStack ingredient;
public ItemStackInput(ItemStack stack)
{
ingredient = stack;
}
@Override
public int hashIngredients()
{
return StackUtils.hashItemStack(ingredient);
}
@Override
public boolean testEquality(MachineInput other)
{
return other instanceof ItemStackInput && StackUtils.equalsWildcardWithNBT(ingredient, ((ItemStackInput)other).ingredient);
}
}

View file

@ -0,0 +1,34 @@
package mekanism.common.recipe.inputs;
public abstract class MachineInput
{
public abstract int hashIngredients();
/**
* Test equality to another input.
* This should return true if the input matches this one,
* IGNORING AMOUNTS.
* Allows usage of HashMap optimisation to get recipes.
* @param other
* @return
*/
public abstract boolean testEquality(MachineInput other);
@Override
public int hashCode()
{
return hashIngredients();
}
@Override
public boolean equals(Object other)
{
if(other instanceof MachineInput)
{
return testEquality((MachineInput)other);
}
return false;
}
}

View file

@ -1,4 +1,4 @@
package mekanism.api.recipe;
package mekanism.common.recipe.inputs;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
@ -11,7 +11,7 @@ import net.minecraftforge.fluids.FluidTank;
/**
* An input of a gas, a fluid and an item for the pressurized reaction chamber
*/
public class PressurizedReactants
public class PressurizedReactants extends MachineInput
{
private ItemStack theSolid;
private FluidStack theFluid;
@ -103,7 +103,7 @@ public class PressurizedReactants
* @param input - input to check
* @return if the input meets this input's requirements
*/
private boolean meets(PressurizedReactants input)
public boolean meets(PressurizedReactants input)
{
if(input == null || !input.isValid())
{
@ -137,4 +137,21 @@ public class PressurizedReactants
{
return theGas;
}
@Override
public int hashIngredients()
{
return StackUtils.hashItemStack(theSolid) << 16 | theFluid.hashCode() << 8 | theGas.hashCode();
}
@Override
public boolean testEquality(MachineInput other)
{
if(other instanceof PressurizedReactants)
{
PressurizedReactants pr = (PressurizedReactants)other;
return pr.containsType(theSolid) && pr.containsType(theFluid) && pr.containsType(theGas);
}
return false;
}
}

View file

@ -0,0 +1,21 @@
package mekanism.common.recipe.machines;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry;
import mekanism.common.recipe.inputs.AdvancedMachineInput;
import mekanism.common.recipe.outputs.ItemStackOutput;
import net.minecraft.item.ItemStack;
public class AdvancedMachineRecipe extends MachineRecipe<AdvancedMachineInput, ItemStackOutput>
{
public AdvancedMachineRecipe(ItemStack input, String gasName, ItemStack output)
{
super(new AdvancedMachineInput(input, GasRegistry.getGas(gasName)), new ItemStackOutput(output));
}
public AdvancedMachineRecipe(ItemStack input, Gas gas, ItemStack output)
{
super(new AdvancedMachineInput(input, gas), new ItemStackOutput(output));
}
}

View file

@ -0,0 +1,14 @@
package mekanism.common.recipe.machines;
import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.GasStack;
import mekanism.common.recipe.inputs.IntegerInput;
import mekanism.common.recipe.outputs.GasOutput;
public class AmbientGasRecipe extends MachineRecipe<IntegerInput, GasOutput>
{
public AmbientGasRecipe(int input, String output)
{
super(new IntegerInput(input), new GasOutput(new GasStack(GasRegistry.getGas(output), 1)));
}
}

View file

@ -0,0 +1,14 @@
package mekanism.common.recipe.machines;
import mekanism.common.recipe.inputs.ItemStackInput;
import mekanism.common.recipe.outputs.ItemStackOutput;
import net.minecraft.item.ItemStack;
public class BasicMachineRecipe extends MachineRecipe<ItemStackInput, ItemStackOutput>
{
public BasicMachineRecipe(ItemStack input, ItemStack output)
{
super(new ItemStackInput(input), new ItemStackOutput(output));
}
}

View file

@ -0,0 +1,12 @@
package mekanism.common.recipe.machines;
import mekanism.common.recipe.inputs.ItemStackInput;
import mekanism.common.recipe.outputs.ChanceOutput;
public class ChanceMachineRecipe extends MachineRecipe<ItemStackInput, ChanceOutput>
{
public ChanceMachineRecipe(ItemStackInput input, ChanceOutput output)
{
super(input, output);
}
}

View file

@ -0,0 +1,13 @@
package mekanism.common.recipe.machines;
import mekanism.api.gas.GasStack;
import mekanism.common.recipe.inputs.ChemicalPairInput;
import mekanism.common.recipe.outputs.GasOutput;
public class ChemicalInfuserRecipe extends MachineRecipe<ChemicalPairInput, GasOutput>
{
public ChemicalInfuserRecipe(GasStack leftInput, GasStack rightInput, GasStack output)
{
super(new ChemicalPairInput(leftInput, rightInput), new GasOutput(output));
}
}

View file

@ -0,0 +1,11 @@
package mekanism.common.recipe.machines;
import net.minecraft.item.ItemStack;
public class CombinerRecipe extends AdvancedMachineRecipe
{
public CombinerRecipe(ItemStack input, ItemStack output)
{
super(input, "liquidStone", output);
}
}

View file

@ -0,0 +1,11 @@
package mekanism.common.recipe.machines;
import net.minecraft.item.ItemStack;
public class CrusherRecipe extends BasicMachineRecipe
{
public CrusherRecipe(ItemStack input, ItemStack output)
{
super(input, output);
}
}

View file

@ -0,0 +1,15 @@
package mekanism.common.recipe.machines;
import mekanism.api.gas.GasStack;
import mekanism.common.recipe.inputs.GasInput;
import mekanism.common.recipe.outputs.ItemStackOutput;
import net.minecraft.item.ItemStack;
public class CrystallizerRecipe extends MachineRecipe<GasInput, ItemStackOutput>
{
public CrystallizerRecipe(GasStack input, ItemStack output)
{
super(new GasInput(input), new ItemStackOutput(output));
}
}

View file

@ -0,0 +1,15 @@
package mekanism.common.recipe.machines;
import mekanism.api.gas.GasStack;
import mekanism.common.recipe.inputs.ItemStackInput;
import mekanism.common.recipe.outputs.GasOutput;
import net.minecraft.item.ItemStack;
public class DissolutionRecipe extends MachineRecipe<ItemStackInput, GasOutput>
{
public DissolutionRecipe(ItemStack input, GasStack output)
{
super(new ItemStackInput(input), new GasOutput(output));
}
}

View file

@ -0,0 +1,11 @@
package mekanism.common.recipe.machines;
import net.minecraft.item.ItemStack;
public class EnrichmentRecipe extends BasicMachineRecipe
{
public EnrichmentRecipe(ItemStack input, ItemStack output)
{
super(input, output);
}
}

View file

@ -0,0 +1,11 @@
package mekanism.common.recipe.machines;
import net.minecraft.item.ItemStack;
public class InjectionRecipe extends AdvancedMachineRecipe
{
public InjectionRecipe(ItemStack input, String gasName, ItemStack output)
{
super(input, gasName, output);
}
}

View file

@ -0,0 +1,26 @@
package mekanism.common.recipe.machines;
import mekanism.common.recipe.inputs.MachineInput;
import mekanism.common.recipe.outputs.MachineOutput;
public abstract class MachineRecipe<INPUT extends MachineInput, OUTPUT extends MachineOutput>
{
public INPUT recipeInput;
public OUTPUT recipeOutput;
public MachineRecipe(INPUT input, OUTPUT output)
{
recipeInput = input;
recipeOutput = output;
}
public INPUT getInput()
{
return recipeInput;
}
public OUTPUT getOutput()
{
return recipeOutput;
}
}

View file

@ -0,0 +1,14 @@
package mekanism.common.recipe.machines;
import mekanism.common.recipe.inputs.InfusionInput;
import mekanism.common.recipe.outputs.InfusionOutput;
import net.minecraft.item.ItemStack;
public class MetallurgicInfuserRecipe extends MachineRecipe<InfusionInput, InfusionOutput>
{
public MetallurgicInfuserRecipe(InfusionInput input, ItemStack output)
{
super(input, InfusionOutput.getInfusion(input, output));
}
}

View file

@ -0,0 +1,11 @@
package mekanism.common.recipe.machines;
import net.minecraft.item.ItemStack;
public class OsmiumCompressorRecipe extends AdvancedMachineRecipe
{
public OsmiumCompressorRecipe(ItemStack input, ItemStack output)
{
super(input, "liquidOsmium", output);
}
}

View file

@ -0,0 +1,15 @@
package mekanism.common.recipe.machines;
import mekanism.api.gas.GasStack;
import mekanism.common.recipe.inputs.ItemStackInput;
import mekanism.common.recipe.outputs.GasOutput;
import net.minecraft.item.ItemStack;
public class OxidationRecipe extends MachineRecipe<ItemStackInput, GasOutput>
{
public OxidationRecipe(ItemStack input, GasStack output)
{
super(new ItemStackInput(input), new GasOutput(output));
}
}

View file

@ -0,0 +1,33 @@
package mekanism.common.recipe.machines;
import mekanism.api.gas.GasStack;
import mekanism.common.recipe.outputs.PressurizedProducts;
import mekanism.common.recipe.inputs.PressurizedReactants;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public class PressurizedRecipe extends MachineRecipe<PressurizedReactants, PressurizedProducts>
{
public double extraEnergy;
public int ticks;
public PressurizedRecipe(ItemStack inputSolid, FluidStack inputFluid, GasStack inputGas, ItemStack outputSolid, GasStack outputGas, double energy, int duration)
{
this(new PressurizedReactants(inputSolid, inputFluid, inputGas), new PressurizedProducts(outputSolid, outputGas), energy, duration);
}
public PressurizedRecipe(PressurizedReactants pressurizedReactants, PressurizedProducts pressurizedProducts, double energy, int duration)
{
super(pressurizedReactants, pressurizedProducts);
extraEnergy = energy;
ticks = duration;
}
public PressurizedRecipe copy()
{
return new PressurizedRecipe(getInput().copy(), getOutput().copy(), extraEnergy, ticks);
}
}

View file

@ -0,0 +1,11 @@
package mekanism.common.recipe.machines;
import net.minecraft.item.ItemStack;
public class PurificationRecipe extends AdvancedMachineRecipe
{
public PurificationRecipe(ItemStack input, ItemStack output)
{
super(input, "oxygen", output);
}
}

View file

@ -0,0 +1,19 @@
package mekanism.common.recipe.machines;
import mekanism.common.recipe.inputs.ItemStackInput;
import mekanism.common.recipe.outputs.ChanceOutput;
import net.minecraft.item.ItemStack;
public class SawmillRecipe extends ChanceMachineRecipe
{
public SawmillRecipe(ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, double chance)
{
super(new ItemStackInput(input), new ChanceOutput(primaryOutput, secondaryOutput, chance));
}
public SawmillRecipe(ItemStack input, ItemStack primaryOutput)
{
super(new ItemStackInput(input), new ChanceOutput(primaryOutput));
}
}

View file

@ -0,0 +1,15 @@
package mekanism.common.recipe.machines;
import mekanism.api.gas.GasStack;
import mekanism.common.recipe.inputs.FluidInput;
import mekanism.common.recipe.outputs.ChemicalPairOutput;
import net.minecraftforge.fluids.FluidStack;
public class SeparatorRecipe extends MachineRecipe<FluidInput, ChemicalPairOutput>
{
public SeparatorRecipe(FluidStack input, GasStack left, GasStack right)
{
super(new FluidInput(input), new ChemicalPairOutput(left, right));
}
}

View file

@ -0,0 +1,13 @@
package mekanism.common.recipe.machines;
import mekanism.api.gas.GasStack;
import mekanism.common.recipe.inputs.GasInput;
import mekanism.common.recipe.outputs.GasOutput;
public class WasherRecipe extends MachineRecipe<GasInput, GasOutput>
{
public WasherRecipe(GasStack input, GasStack output)
{
super(new GasInput(input), new GasOutput(output));
}
}

View file

@ -1,4 +1,4 @@
package mekanism.api.recipe;
package mekanism.common.recipe.outputs;
import java.util.Random;
@ -6,7 +6,7 @@ import mekanism.api.util.StackUtils;
import net.minecraft.item.ItemStack;
public class ChanceOutput
public class ChanceOutput extends MachineOutput
{
private static Random rand = new Random();

View file

@ -1,4 +1,4 @@
package mekanism.api.recipe;
package mekanism.common.recipe.outputs;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
@ -8,7 +8,7 @@ import mekanism.api.gas.GasTank;
* @author aidancbrady
*
*/
public class ChemicalPair
public class ChemicalPairOutput extends MachineOutput
{
/** The left gas of this chemical input */
public GasStack leftGas;
@ -21,7 +21,7 @@ public class ChemicalPair
* @param left - left gas
* @param right - right gas
*/
public ChemicalPair(GasStack left, GasStack right)
public ChemicalPairOutput(GasStack left, GasStack right)
{
leftGas = left;
rightGas = right;
@ -41,7 +41,7 @@ public class ChemicalPair
* @param input - input to check
* @return if the input meets this input's requirements
*/
public boolean meetsInput(ChemicalPair input)
public boolean meetsInput(ChemicalPairOutput input)
{
return meets(input) || meets(input.swap());
}
@ -50,9 +50,9 @@ public class ChemicalPair
* Swaps the right gas and left gas of this input.
* @return a swapped ChemicalInput
*/
public ChemicalPair swap()
public ChemicalPairOutput swap()
{
return new ChemicalPair(rightGas, leftGas);
return new ChemicalPairOutput(rightGas, leftGas);
}
/**
@ -62,12 +62,12 @@ public class ChemicalPair
*/
public void draw(GasTank leftTank, GasTank rightTank)
{
if(meets(new ChemicalPair(leftTank.getGas(), rightTank.getGas())))
if(meets(new ChemicalPairOutput(leftTank.getGas(), rightTank.getGas())))
{
leftTank.draw(leftGas.amount, true);
rightTank.draw(rightGas.amount, true);
}
else if(meets(new ChemicalPair(rightTank.getGas(), leftTank.getGas())))
else if(meets(new ChemicalPairOutput(rightTank.getGas(), leftTank.getGas())))
{
leftTank.draw(rightGas.amount, true);
rightTank.draw(leftGas.amount, true);
@ -94,7 +94,7 @@ public class ChemicalPair
* @param input - input to check
* @return if the input meets this input's requirements
*/
private boolean meets(ChemicalPair input)
private boolean meets(ChemicalPairOutput input)
{
if(input == null || !input.isValid())
{
@ -109,8 +109,8 @@ public class ChemicalPair
return input.leftGas.amount >= leftGas.amount && input.rightGas.amount >= rightGas.amount;
}
public ChemicalPair copy()
public ChemicalPairOutput copy()
{
return new ChemicalPair(leftGas.copy(), rightGas.copy());
return new ChemicalPairOutput(leftGas.copy(), rightGas.copy());
}
}

View file

@ -0,0 +1,13 @@
package mekanism.common.recipe.outputs;
import mekanism.api.gas.GasStack;
public class GasOutput extends MachineOutput
{
public GasStack output;
public GasOutput(GasStack stack)
{
output = stack;
}
}

View file

@ -1,4 +1,6 @@
package mekanism.api.infuse;
package mekanism.common.recipe.outputs;
import mekanism.common.recipe.inputs.InfusionInput;
import net.minecraft.item.ItemStack;
@ -7,7 +9,7 @@ import net.minecraft.item.ItemStack;
* @author AidanBrady
*
*/
public class InfusionOutput
public class InfusionOutput extends MachineOutput
{
/** The input infusion */
public InfusionInput infusionInput;

View file

@ -0,0 +1,13 @@
package mekanism.common.recipe.outputs;
import net.minecraft.item.ItemStack;
public class ItemStackOutput extends MachineOutput
{
public ItemStack output;
public ItemStackOutput(ItemStack stack)
{
output = stack;
}
}

View file

@ -0,0 +1,5 @@
package mekanism.common.recipe.outputs;
public class MachineOutput
{
}

View file

@ -1,11 +1,11 @@
package mekanism.api.recipe;
package mekanism.common.recipe.outputs;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import net.minecraft.item.ItemStack;
public class PressurizedProducts
public class PressurizedProducts extends MachineOutput
{
private ItemStack itemOutput;
private GasStack gasOutput;

View file

@ -0,0 +1,5 @@
package mekanism.common.recipe.outputs;
public class StringOutput extends MachineOutput
{
}

View file

@ -9,7 +9,7 @@ import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.ITubeConnection;
import mekanism.api.recipe.AdvancedInput;
import mekanism.common.recipe.inputs.AdvancedMachineInput;
import mekanism.api.util.StackUtils;
import mekanism.common.Mekanism;
import mekanism.common.MekanismItems;
@ -140,11 +140,11 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
for(Object obj : getRecipes().entrySet())
{
if(((Map.Entry)obj).getKey() instanceof AdvancedInput)
if(((Map.Entry)obj).getKey() instanceof AdvancedMachineInput)
{
Map.Entry entry = (Map.Entry)obj;
ItemStack stack = ((AdvancedInput)entry.getKey()).itemStack;
ItemStack stack = ((AdvancedMachineInput)entry.getKey()).itemStack;
if(StackUtils.equalsWildcard(stack, itemStack))
{
@ -207,7 +207,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
@Override
public void operate()
{
ItemStack itemstack = RecipeHandler.getOutput(new AdvancedInput(inventory[0], gasTank.getGas().getGas()), true, getRecipes());
ItemStack itemstack = RecipeHandler.getOutput(new AdvancedMachineInput(inventory[0], gasTank.getGas().getGas()), true, getRecipes());
if(inventory[0].stackSize <= 0)
{
@ -234,7 +234,7 @@ public abstract class TileEntityAdvancedElectricMachine extends TileEntityBasicM
return false;
}
ItemStack itemstack = RecipeHandler.getOutput(new AdvancedInput(inventory[0], gasTank.getGas().getGas()), false, getRecipes());
ItemStack itemstack = RecipeHandler.getOutput(new AdvancedMachineInput(inventory[0], gasTank.getGas().getGas()), false, getRecipes());
if(itemstack == null)
{

View file

@ -11,6 +11,8 @@ import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.ITubeConnection;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.RecipeHandler.Recipe;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
@ -21,17 +23,11 @@ public class TileEntityAmbientAccumulator extends TileEntityContainerBlock imple
{
public GasTank collectedGas = new GasTank(1000);
public static Map<Integer, String> dimensionGases = new HashMap<Integer, String>();
public int cachedDimensionId = 0;
public GasStack cachedGas;
public static Random gasRand = new Random();
static
{
dimensionGases.put(-1, "sulfurDioxideGas");
dimensionGases.put(+0, "oxygen");
dimensionGases.put(+1, "tritium");
}
public TileEntityAmbientAccumulator()
{
super("AmbientAccumulator");
@ -43,11 +39,15 @@ public class TileEntityAmbientAccumulator extends TileEntityContainerBlock imple
{
if(!worldObj.isRemote)
{
Gas gasToCollect = GasRegistry.getGas(dimensionGases.get(worldObj.provider.dimensionId));
if(gasToCollect != null && gasRand.nextDouble() < 0.05)
if(cachedGas == null || worldObj.provider.dimensionId != cachedDimensionId)
{
collectedGas.receive(new GasStack(gasToCollect, 1), true);
cachedDimensionId = worldObj.provider.dimensionId;
cachedGas = RecipeHandler.getDimensionGas(cachedDimensionId);
}
if(cachedGas != null && gasRand.nextDouble() < 0.05)
{
collectedGas.receive(cachedGas, true);
}
}
}

View file

@ -3,7 +3,7 @@ package mekanism.common.tile;
import java.util.Map;
import mekanism.api.EnumColor;
import mekanism.api.recipe.ChanceOutput;
import mekanism.common.recipe.outputs.ChanceOutput;
import mekanism.common.MekanismItems;
import mekanism.common.SideData;
import mekanism.common.recipe.RecipeHandler;

View file

@ -119,7 +119,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri
injectTank.draw(INJECT_USAGE, true);
}
else {
GasStack stack = RecipeHandler.getItemToGasOutput(inventory[1], true, Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get());
GasStack stack = RecipeHandler.getDissolutionOutput(inventory[1], true);
outputTank.receive(stack, true);
injectTank.draw(INJECT_USAGE, true);
@ -171,7 +171,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri
{
if(slotID == 1)
{
return RecipeHandler.getItemToGasOutput(itemstack, false, Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get()) != null;
return RecipeHandler.getDissolutionOutput(itemstack, false) != null;
}
else if(slotID == 3)
{
@ -223,7 +223,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri
return false;
}
GasStack stack = RecipeHandler.getItemToGasOutput(inventory[1], false, Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get());
GasStack stack = RecipeHandler.getDissolutionOutput(inventory[1], false);
if(stack == null || (outputTank.getGas() != null && (outputTank.getGas().getGas() != stack.getGas() || outputTank.getNeeded() < stack.amount)))
{

View file

@ -107,7 +107,7 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp
operatingTicks++;
}
else {
GasStack stack = RecipeHandler.getItemToGasOutput(inventory[0], true, Recipe.CHEMICAL_OXIDIZER.get());
GasStack stack = RecipeHandler.getOxidizerOutput(inventory[0], true);
gasTank.receive(stack, true);
operatingTicks = 0;
@ -151,7 +151,7 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp
{
if(slotID == 0)
{
return RecipeHandler.getItemToGasOutput(itemstack, false, Recipe.CHEMICAL_OXIDIZER.get()) != null;
return RecipeHandler.getOxidizerOutput(itemstack, false) != null;
}
else if(slotID == 1)
{
@ -203,7 +203,7 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp
return false;
}
GasStack stack = RecipeHandler.getItemToGasOutput(inventory[0], false, Recipe.CHEMICAL_OXIDIZER.get());
GasStack stack = RecipeHandler.getOxidizerOutput(inventory[0], false);
if(stack == null || (gasTank.getGas() != null && (gasTank.getGas().getGas() != stack.getGas() || gasTank.getNeeded() < stack.amount)))
{

View file

@ -13,7 +13,7 @@ import mekanism.api.gas.GasTransmission;
import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.IGasItem;
import mekanism.api.gas.ITubeConnection;
import mekanism.api.recipe.ChemicalPair;
import mekanism.common.recipe.outputs.ChemicalPairOutput;
import mekanism.common.Mekanism;
import mekanism.common.base.ISustainedData;
import mekanism.common.block.BlockMachine.MachineType;
@ -204,7 +204,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
return canFillWithSwap(RecipeHandler.getElectrolyticSeparatorOutput(fluidTank, false)) && getEnergy() >= general.FROM_H2*2;
}
public boolean canFillWithSwap(ChemicalPair gases)
public boolean canFillWithSwap(ChemicalPairOutput gases)
{
if(gases == null)
{
@ -214,13 +214,13 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
return canFill(gases) || canFill(gases.swap());
}
public boolean canFill(ChemicalPair gases)
public boolean canFill(ChemicalPairOutput 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(ChemicalPair gases)
public void fillTanks(ChemicalPairOutput gases)
{
if(gases == null) return;

View file

@ -10,8 +10,8 @@ import mekanism.api.Range4D;
import mekanism.api.infuse.InfuseObject;
import mekanism.api.infuse.InfuseRegistry;
import mekanism.api.infuse.InfuseType;
import mekanism.api.infuse.InfusionInput;
import mekanism.api.infuse.InfusionOutput;
import mekanism.common.recipe.inputs.InfusionInput;
import mekanism.common.recipe.outputs.InfusionOutput;
import mekanism.common.Mekanism;
import mekanism.common.MekanismItems;
import mekanism.common.PacketHandler;

View file

@ -12,8 +12,8 @@ import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.ITubeConnection;
import mekanism.api.recipe.PressurizedProducts;
import mekanism.api.recipe.PressurizedRecipe;
import mekanism.common.recipe.outputs.PressurizedProducts;
import mekanism.common.recipe.machines.PressurizedRecipe;
import mekanism.common.SideData;
import mekanism.common.base.ISustainedData;
import mekanism.common.block.BlockMachine.MachineType;
@ -154,16 +154,16 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl
{
PressurizedRecipe recipe = getRecipe();
recipe.reactants.use(inventory[0], inputFluidTank, inputGasTank);
recipe.getInput().use(inventory[0], inputFluidTank, inputGasTank);
if(inventory[0].stackSize <= 0)
{
inventory[0] = null;
}
recipe.products.fillTank(outputGasTank);
recipe.getOutput().fillTank(outputGasTank);
recipe.products.addProducts(inventory, 2);
recipe.getOutput().addProducts(inventory, 2);
markDirty();
ejectorComponent.onOutput();
@ -179,7 +179,7 @@ public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandl
return false;
}
PressurizedProducts products = recipe.products;
PressurizedProducts products = recipe.getOutput();
if(products.getItemOutput() != null)
{