diff --git a/src/main/java/modtweaker2/mods/mekanism/Mekanism.java b/src/main/java/modtweaker2/mods/mekanism/Mekanism.java index f71cbd9..eb88dcd 100644 --- a/src/main/java/modtweaker2/mods/mekanism/Mekanism.java +++ b/src/main/java/modtweaker2/mods/mekanism/Mekanism.java @@ -1,56 +1,56 @@ -//package modtweaker2.mods.mekanism; -// -//import java.util.regex.Pattern; -// -//import minetweaker.MineTweakerAPI; -//import modtweaker2.mods.mekanism.gas.GasBracketHandler; -//import modtweaker2.mods.mekanism.handlers.ChemicalOxidizer; -//import modtweaker2.mods.mekanism.handlers.ChemicalWasher; -//import modtweaker2.mods.mekanism.handlers.Combiner; -//import modtweaker2.mods.mekanism.handlers.Compressor; -//import modtweaker2.mods.mekanism.handlers.Crusher; -//import modtweaker2.mods.mekanism.handlers.Enrichment; -//import modtweaker2.mods.mekanism.handlers.Purification; -//import modtweaker2.mods.mekanism.handlers.Reaction; -//import modtweaker2.mods.mekanism.handlers.Sawmill; -//import modtweaker2.mods.mekanism.handlers.Separator; -//import modtweaker2.mods.mekanism.handlers.v8.ChemicalCrystallizer; -//import modtweaker2.mods.mekanism.handlers.v8.ChemicalDissolution; -//import modtweaker2.mods.mekanism.handlers.v8.ChemicalInfuser; -//import modtweaker2.mods.mekanism.handlers.v8.ChemicalInjection; -//import modtweaker2.mods.mekanism.handlers.v8.Infuser; -//import modtweaker2.utils.TweakerPlugin; -//import cpw.mods.fml.common.Loader; -//import cpw.mods.fml.common.ModContainer; -// -//public class Mekanism extends TweakerPlugin { -// public static final boolean v7 = isV7(); -// public Mekanism() { -// MineTweakerAPI.registerBracketHandler(new GasBracketHandler()); -// MineTweakerAPI.registerClass(Combiner.class); -// MineTweakerAPI.registerClass(Compressor.class); -// MineTweakerAPI.registerClass(Crusher.class); -// MineTweakerAPI.registerClass(Enrichment.class); -// MineTweakerAPI.registerClass(Infuser.class); -// MineTweakerAPI.registerClass(Purification.class); -// MineTweakerAPI.registerClass(Reaction.class); -// MineTweakerAPI.registerClass(Sawmill.class); -// MineTweakerAPI.registerClass(Separator.class); -//// MineTweakerAPI.registerClass(ChemicalCrystallizer.class); +package modtweaker2.mods.mekanism; + +import java.util.regex.Pattern; + +import minetweaker.MineTweakerAPI; +import modtweaker2.mods.mekanism.gas.GasBracketHandler; +import modtweaker2.mods.mekanism.handlers.v8.ChemicalInfuser; +import modtweaker2.mods.mekanism.handlers.v8.ChemicalInjection; +import modtweaker2.mods.mekanism.handlers.ChemicalOxidizer; +import modtweaker2.mods.mekanism.handlers.ChemicalWasher; +import modtweaker2.mods.mekanism.handlers.Combiner; +import modtweaker2.mods.mekanism.handlers.Compressor; +import modtweaker2.mods.mekanism.handlers.Crusher; +import modtweaker2.mods.mekanism.handlers.Enrichment; +import modtweaker2.mods.mekanism.handlers.Purification; +import modtweaker2.mods.mekanism.handlers.Reaction; +import modtweaker2.mods.mekanism.handlers.Sawmill; +import modtweaker2.mods.mekanism.handlers.Separator; +import modtweaker2.mods.mekanism.handlers.v8.ChemicalCrystallizer; +import modtweaker2.mods.mekanism.handlers.v8.ChemicalDissolution; +import modtweaker2.mods.mekanism.handlers.v8.Infuser; +import modtweaker2.utils.TweakerPlugin; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.ModContainer; + +public class Mekanism extends TweakerPlugin { + public static final boolean v7 = isV7(); + public Mekanism() { + MineTweakerAPI.registerBracketHandler(new GasBracketHandler()); + MineTweakerAPI.registerClass(Combiner.class); + MineTweakerAPI.registerClass(Compressor.class); + MineTweakerAPI.registerClass(Crusher.class); + MineTweakerAPI.registerClass(Enrichment.class); + MineTweakerAPI.registerClass(Infuser.class); + MineTweakerAPI.registerClass(Purification.class); + MineTweakerAPI.registerClass(Reaction.class); + MineTweakerAPI.registerClass(Sawmill.class); + MineTweakerAPI.registerClass(Separator.class); // MineTweakerAPI.registerClass(ChemicalCrystallizer.class); -// MineTweakerAPI.registerClass(ChemicalDissolution.class); -// MineTweakerAPI.registerClass(ChemicalInfuser.class); -// MineTweakerAPI.registerClass(ChemicalInjection.class); -// MineTweakerAPI.registerClass(ChemicalOxidizer.class); -// MineTweakerAPI.registerClass(ChemicalWasher.class); -// } -// -// public static boolean isV7(){ -// Pattern version = Pattern.compile("7.*"); -// for (ModContainer loadedMod : Loader.instance().getActiveModList()) -// { -// if (loadedMod.getModId().equals("Mekanism") && version.matcher(loadedMod.getVersion()).find()) return true; -// } -// return false; -// } -//} + MineTweakerAPI.registerClass(ChemicalCrystallizer.class); + MineTweakerAPI.registerClass(ChemicalDissolution.class); + MineTweakerAPI.registerClass(ChemicalInfuser.class); + MineTweakerAPI.registerClass(ChemicalInjection.class); + MineTweakerAPI.registerClass(ChemicalOxidizer.class); + MineTweakerAPI.registerClass(ChemicalWasher.class); + } + + public static boolean isV7(){ + Pattern version = Pattern.compile("7.*"); + for (ModContainer loadedMod : Loader.instance().getActiveModList()) + { + if (loadedMod.getModId().equals("Mekanism") && version.matcher(loadedMod.getVersion()).find()) return true; + } + return false; + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/MekanismHelper.java b/src/main/java/modtweaker2/mods/mekanism/MekanismHelper.java index a71d754..07a64a7 100644 --- a/src/main/java/modtweaker2/mods/mekanism/MekanismHelper.java +++ b/src/main/java/modtweaker2/mods/mekanism/MekanismHelper.java @@ -1,27 +1,27 @@ -//package modtweaker2.mods.mekanism; -// -//import mekanism.api.gas.GasRegistry; -//import mekanism.api.gas.GasStack; -//import minetweaker.api.item.IIngredient; -//import modtweaker2.mods.mekanism.gas.IGasStack; -// -//public class MekanismHelper { -// private MekanismHelper() {} -// -// public static GasStack toGas(IGasStack iStack) { -// if (iStack == null) { -// return null; -// } else return new GasStack(GasRegistry.getGas(iStack.getName()), iStack.getAmount()); -// } -// -// public static GasStack[] toGases(IIngredient[] input) { -// return toGases((IGasStack[]) input); -// } -// -// public static GasStack[] toGases(IGasStack[] iStack) { -// GasStack[] stack = new GasStack[iStack.length]; -// for (int i = 0; i < stack.length; i++) -// stack[i] = toGas(iStack[i]); -// return stack; -// } -//} +package modtweaker2.mods.mekanism; + +import mekanism.api.gas.GasRegistry; +import mekanism.api.gas.GasStack; +import minetweaker.api.item.IIngredient; +import modtweaker2.mods.mekanism.gas.IGasStack; + +public class MekanismHelper { + private MekanismHelper() {} + + public static GasStack toGas(IGasStack iStack) { + if (iStack == null) { + return null; + } else return new GasStack(GasRegistry.getGas(iStack.getName()), iStack.getAmount()); + } + + public static GasStack[] toGases(IIngredient[] input) { + return toGases((IGasStack[]) input); + } + + public static GasStack[] toGases(IGasStack[] iStack) { + GasStack[] stack = new GasStack[iStack.length]; + for (int i = 0; i < stack.length; i++) + stack[i] = toGas(iStack[i]); + return stack; + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalCrystallizer.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalCrystallizer.java index 1c2d7cd..edf0f0e 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalCrystallizer.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalCrystallizer.java @@ -1,34 +1,34 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toStack; -//import static modtweaker2.mods.mekanism.MekanismHelper.toGas; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.machines.CrystallizerRecipe; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.chemical.Crystallizer") -//public class ChemicalCrystallizer { -// @ZenMethod -// public static void addRecipe(IGasStack input, IItemStack output) { -// if (Mekanism.v7) -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_CRYSTALLIZER", Recipe.CHEMICAL_CRYSTALLIZER.get(), toGas(input), toStack(output))); -// else -// { -// CrystallizerRecipe recipe = new CrystallizerRecipe(toGas(input), toStack(output)); -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_CRYSTALLIZER", Recipe.CHEMICAL_CRYSTALLIZER.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack output) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_CRYSTALLIZER", Recipe.CHEMICAL_CRYSTALLIZER.get(), toStack(output))); -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toStack; +import static modtweaker2.mods.mekanism.MekanismHelper.toGas; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.machines.CrystallizerRecipe; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.chemical.Crystallizer") +public class ChemicalCrystallizer { + @ZenMethod + public static void addRecipe(IGasStack input, IItemStack output) { + if (Mekanism.v7) + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_CRYSTALLIZER", Recipe.CHEMICAL_CRYSTALLIZER.get(), toGas(input), toStack(output))); + else + { + CrystallizerRecipe recipe = new CrystallizerRecipe(toGas(input), toStack(output)); + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_CRYSTALLIZER", Recipe.CHEMICAL_CRYSTALLIZER.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_CRYSTALLIZER", Recipe.CHEMICAL_CRYSTALLIZER.get(), toStack(output))); + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalDissolution.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalDissolution.java index 04889f0..82aaace 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalDissolution.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalDissolution.java @@ -1,90 +1,90 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toStack; -//import static modtweaker2.helpers.StackHelper.areEqual; -//import static modtweaker2.mods.mekanism.MekanismHelper.toGas; -// -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -// -//import mekanism.api.gas.GasStack; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.machines.DissolutionRecipe; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import minetweaker.api.oredict.IOreDictEntry; -//import modtweaker2.helpers.InputHelper; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -//import net.minecraft.item.ItemStack; -//import net.minecraftforge.oredict.OreDictionary; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.chemical.Dissolution") -//public class ChemicalDissolution { -// @ZenMethod -// public static void addRecipe(IItemStack input, IGasStack output) { -// if (Mekanism.v7) -// { -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), toStack(input), toGas(output))); -// } -// else { -// DissolutionRecipe recipe = new DissolutionRecipe(toStack(input), toGas(output)); -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack input) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new Remove("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), toStack(input))); -// } -// -// @ZenMethod -// public static void removeRecipe(IOreDictEntry input) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// List stacks = OreDictionary.getOres(InputHelper.toString(input)); -// for (ItemStack stack : stacks) { -// MineTweakerAPI.apply(new Remove("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), stack)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IGasStack input) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new Remove("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), toGas(input))); -// } -// -// private static class Remove extends RemoveMekanismRecipe { -// public Remove(String string, Map map, Object key) { -// super(string, map, key); -// } -// -// @Override -// public void apply() { -// Iterator it = map.entrySet().iterator(); -// while (it.hasNext()) { -// Map.Entry pairs = (Map.Entry) it.next(); -// ItemStack key = (ItemStack) pairs.getKey(); -// GasStack value = (GasStack) pairs.getValue(); -// if (key != null) { -// if (this.key instanceof ItemStack && areEqual(key, (ItemStack) this.key)) { -// this.key = key; -// break; -// } else if (this.key instanceof GasStack && value.isGasEqual((GasStack) this.key)) { -// this.key = key; -// break; -// } -// } -// -// } -// -// recipe = map.get(key); -// map.remove(key); -// } -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toStack; +import static modtweaker2.helpers.StackHelper.areEqual; +import static modtweaker2.mods.mekanism.MekanismHelper.toGas; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import mekanism.api.gas.GasStack; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.machines.DissolutionRecipe; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import minetweaker.api.oredict.IOreDictEntry; +import modtweaker2.helpers.InputHelper; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.chemical.Dissolution") +public class ChemicalDissolution { + @ZenMethod + public static void addRecipe(IItemStack input, IGasStack output) { + if (Mekanism.v7) + { + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), toStack(input), toGas(output))); + } + else { + DissolutionRecipe recipe = new DissolutionRecipe(toStack(input), toGas(output)); + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IItemStack input) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new Remove("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), toStack(input))); + } + + @ZenMethod + public static void removeRecipe(IOreDictEntry input) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + List stacks = OreDictionary.getOres(InputHelper.toString(input)); + for (ItemStack stack : stacks) { + MineTweakerAPI.apply(new Remove("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), stack)); + } + } + + @ZenMethod + public static void removeRecipe(IGasStack input) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new Remove("CHEMICAL_DISSOLUTION_CHAMBER", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), toGas(input))); + } + + private static class Remove extends RemoveMekanismRecipe { + public Remove(String string, Map map, Object key) { + super(string, map, key); + } + + @Override + public void apply() { + Iterator it = map.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry pairs = (Map.Entry) it.next(); + ItemStack key = (ItemStack) pairs.getKey(); + GasStack value = (GasStack) pairs.getValue(); + if (key != null) { + if (this.key instanceof ItemStack && areEqual(key, (ItemStack) this.key)) { + this.key = key; + break; + } else if (this.key instanceof GasStack && value.isGasEqual((GasStack) this.key)) { + this.key = key; + break; + } + } + + } + + recipe = map.get(key); + map.remove(key); + } + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInfuser.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInfuser.java index 1147232..53277ae 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInfuser.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInfuser.java @@ -1,36 +1,36 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.mods.mekanism.MekanismHelper.toGas; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.ChemicalPairInput; -//import mekanism.common.recipe.machines.ChemicalInfuserRecipe; -//import minetweaker.MineTweakerAPI; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.chemical.Infuser") -//public class ChemicalInfuser { -// @ZenMethod -// public static void addRecipe(IGasStack left, IGasStack right, IGasStack out) { -// if (Mekanism.v7) { -// ChemicalPairInput pair = new ChemicalPairInput(toGas(left), toGas(right)); -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_INFUSER", Recipe.CHEMICAL_INFUSER.get(), pair, toGas(out))); -// } else { -// ChemicalInfuserRecipe recipe = new ChemicalInfuserRecipe(toGas(left), toGas(right), toGas(out)); -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_INFUSER", Recipe.CHEMICAL_INFUSER.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IGasStack output) { -// if (!Mekanism.v7) -// throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_INFUSER", Recipe.CHEMICAL_INFUSER.get(), toGas(output))); -// -// -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.mods.mekanism.MekanismHelper.toGas; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.ChemicalPairInput; +import mekanism.common.recipe.machines.ChemicalInfuserRecipe; +import minetweaker.MineTweakerAPI; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.chemical.Infuser") +public class ChemicalInfuser { + @ZenMethod + public static void addRecipe(IGasStack left, IGasStack right, IGasStack out) { + if (Mekanism.v7) { + ChemicalPairInput pair = new ChemicalPairInput(toGas(left), toGas(right)); + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_INFUSER", Recipe.CHEMICAL_INFUSER.get(), pair, toGas(out))); + } else { + ChemicalInfuserRecipe recipe = new ChemicalInfuserRecipe(toGas(left), toGas(right), toGas(out)); + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_INFUSER", Recipe.CHEMICAL_INFUSER.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IGasStack output) { + if (!Mekanism.v7) + throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_INFUSER", Recipe.CHEMICAL_INFUSER.get(), toGas(output))); + + + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInjection.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInjection.java index 03331b3..a21395f 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInjection.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalInjection.java @@ -1,38 +1,38 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toStack; -//import static modtweaker2.mods.mekanism.MekanismHelper.toGas; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.AdvancedMachineInput; -//import mekanism.common.recipe.machines.InjectionRecipe; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.chemical.Injection") -//public class ChemicalInjection { -// @ZenMethod -// public static void addRecipe(IItemStack input, IGasStack gas, IItemStack output) { -// if (Mekanism.v7) -// { -// AdvancedMachineInput aInput = new AdvancedMachineInput(toStack(input), toGas(gas).getGas()); -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_INJECTION_CHAMBER", Recipe.CHEMICAL_INJECTION_CHAMBER.get(), aInput, toStack(output))); -// } -// else -// { -// InjectionRecipe recipe = new InjectionRecipe(toStack(input), gas.getName(), toStack(output)); -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_INJECTION_CHAMBER", Recipe.CHEMICAL_INJECTION_CHAMBER.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack output) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_INJECTION_CHAMBER", Recipe.CHEMICAL_INJECTION_CHAMBER.get(), toStack(output))); -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toStack; +import static modtweaker2.mods.mekanism.MekanismHelper.toGas; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.AdvancedMachineInput; +import mekanism.common.recipe.machines.InjectionRecipe; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.chemical.Injection") +public class ChemicalInjection { + @ZenMethod + public static void addRecipe(IItemStack input, IGasStack gas, IItemStack output) { + if (Mekanism.v7) + { + AdvancedMachineInput aInput = new AdvancedMachineInput(toStack(input), toGas(gas).getGas()); + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_INJECTION_CHAMBER", Recipe.CHEMICAL_INJECTION_CHAMBER.get(), aInput, toStack(output))); + } + else + { + InjectionRecipe recipe = new InjectionRecipe(toStack(input), gas.getName(), toStack(output)); + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_INJECTION_CHAMBER", Recipe.CHEMICAL_INJECTION_CHAMBER.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_INJECTION_CHAMBER", Recipe.CHEMICAL_INJECTION_CHAMBER.get(), toStack(output))); + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalOxidizer.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalOxidizer.java index c72a07e..5db57c6 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalOxidizer.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalOxidizer.java @@ -1,36 +1,36 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toStack; -//import static modtweaker2.mods.mekanism.MekanismHelper.toGas; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.machines.OxidationRecipe; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.chemical.Oxidizer") -//public class ChemicalOxidizer { -// @ZenMethod -// public static void addRecipe(IItemStack input, IGasStack output) { -// if (Mekanism.v7) -// { -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_OXIDIZER", Recipe.CHEMICAL_OXIDIZER.get(), toStack(input), toGas(output))); -// } -// else -// { -// OxidationRecipe recipe = new OxidationRecipe(toStack(input), toGas(output)); -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_OXIDIZER", Recipe.CHEMICAL_OXIDIZER.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IGasStack output) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_OXIDIZER", Recipe.CHEMICAL_OXIDIZER.get(), toGas(output))); -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toStack; +import static modtweaker2.mods.mekanism.MekanismHelper.toGas; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.machines.OxidationRecipe; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.chemical.Oxidizer") +public class ChemicalOxidizer { + @ZenMethod + public static void addRecipe(IItemStack input, IGasStack output) { + if (Mekanism.v7) + { + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_OXIDIZER", Recipe.CHEMICAL_OXIDIZER.get(), toStack(input), toGas(output))); + } + else + { + OxidationRecipe recipe = new OxidationRecipe(toStack(input), toGas(output)); + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_OXIDIZER", Recipe.CHEMICAL_OXIDIZER.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IGasStack output) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new RemoveMekanismRecipe("CHEMICAL_OXIDIZER", Recipe.CHEMICAL_OXIDIZER.get(), toGas(output))); + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalWasher.java b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalWasher.java index 58862e9..523fb1f 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalWasher.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/ChemicalWasher.java @@ -1,65 +1,65 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.mods.mekanism.MekanismHelper.toGas; -// -//import java.util.Iterator; -//import java.util.Map; -// -//import mekanism.api.gas.GasStack; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.machines.WasherRecipe; -//import minetweaker.MineTweakerAPI; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.chemical.Washer") -//public class ChemicalWasher { -// @ZenMethod -// public static void addRecipe(IGasStack input, IGasStack output) { -// if (Mekanism.v7) -// { -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_WASHER", Recipe.CHEMICAL_WASHER.get(), toGas(input), toGas(output))); -// } -// else -// { -// WasherRecipe recipe = new WasherRecipe(toGas(input), toGas(output)); -// MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_WASHER", Recipe.CHEMICAL_WASHER.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IGasStack output) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new Remove("CHEMICAL_WASHER", Recipe.CHEMICAL_WASHER.get(), toGas(output))); -// } -// -// private static class Remove extends RemoveMekanismRecipe { -// public Remove(String string, Map map, Object key) { -// super(string, map, key); -// } -// -// @Override -// public void apply() { -// Iterator it = map.entrySet().iterator(); -// while (it.hasNext()) { -// Map.Entry pairs = (Map.Entry) it.next(); -// GasStack key = (GasStack) pairs.getKey(); -// GasStack value = (GasStack) pairs.getValue(); -// if (key != null) { -// if (this.key instanceof GasStack && value.isGasEqual((GasStack) this.key)) { -// this.key = key; -// break; -// } -// } -// -// } -// -// recipe = map.get(key); -// map.remove(key); -// } -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.mods.mekanism.MekanismHelper.toGas; + +import java.util.Iterator; +import java.util.Map; + +import mekanism.api.gas.GasStack; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.machines.WasherRecipe; +import minetweaker.MineTweakerAPI; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.chemical.Washer") +public class ChemicalWasher { + @ZenMethod + public static void addRecipe(IGasStack input, IGasStack output) { + if (Mekanism.v7) + { + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_WASHER", Recipe.CHEMICAL_WASHER.get(), toGas(input), toGas(output))); + } + else + { + WasherRecipe recipe = new WasherRecipe(toGas(input), toGas(output)); + MineTweakerAPI.apply(new AddMekanismRecipe("CHEMICAL_WASHER", Recipe.CHEMICAL_WASHER.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IGasStack output) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new Remove("CHEMICAL_WASHER", Recipe.CHEMICAL_WASHER.get(), toGas(output))); + } + + private static class Remove extends RemoveMekanismRecipe { + public Remove(String string, Map map, Object key) { + super(string, map, key); + } + + @Override + public void apply() { + Iterator it = map.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry pairs = (Map.Entry) it.next(); + GasStack key = (GasStack) pairs.getKey(); + GasStack value = (GasStack) pairs.getValue(); + if (key != null) { + if (this.key instanceof GasStack && value.isGasEqual((GasStack) this.key)) { + this.key = key; + break; + } + } + + } + + recipe = map.get(key); + map.remove(key); + } + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Combiner.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Combiner.java index ad95894..983d79f 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Combiner.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/Combiner.java @@ -1,35 +1,35 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toStack; -//import mekanism.api.gas.GasRegistry; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.AdvancedMachineInput; -//import mekanism.common.recipe.machines.CombinerRecipe; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.Combiner") -//public class Combiner { -// @ZenMethod -// public static void addRecipe(IItemStack input, IItemStack output) { -// AdvancedMachineInput aInput = new AdvancedMachineInput(toStack(input), GasRegistry.getGas("liquidStone")); -// if (Mekanism.v7) -// MineTweakerAPI.apply(new AddMekanismRecipe("COMBINER", Recipe.COMBINER.get(), aInput, toStack(output))); -// else -// { -// CombinerRecipe recipe = new CombinerRecipe(toStack(input), toStack(output)); -// MineTweakerAPI.apply(new AddMekanismRecipe("COMBINER", Recipe.COMBINER.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack output) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new RemoveMekanismRecipe("COMBINER", Recipe.COMBINER.get(), toStack(output))); -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toStack; +import mekanism.api.gas.GasRegistry; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.AdvancedMachineInput; +import mekanism.common.recipe.machines.CombinerRecipe; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.Combiner") +public class Combiner { + @ZenMethod + public static void addRecipe(IItemStack input, IItemStack output) { + AdvancedMachineInput aInput = new AdvancedMachineInput(toStack(input), GasRegistry.getGas("liquidStone")); + if (Mekanism.v7) + MineTweakerAPI.apply(new AddMekanismRecipe("COMBINER", Recipe.COMBINER.get(), aInput, toStack(output))); + else + { + CombinerRecipe recipe = new CombinerRecipe(toStack(input), toStack(output)); + MineTweakerAPI.apply(new AddMekanismRecipe("COMBINER", Recipe.COMBINER.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new RemoveMekanismRecipe("COMBINER", Recipe.COMBINER.get(), toStack(output))); + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Compressor.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Compressor.java index b432a3a..25898a8 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Compressor.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/Compressor.java @@ -1,35 +1,35 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toStack; -//import mekanism.api.gas.GasRegistry; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.AdvancedMachineInput; -//import mekanism.common.recipe.machines.OsmiumCompressorRecipe; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.Compressor") -//public class Compressor { -// @ZenMethod -// public static void addRecipe(IItemStack input, IItemStack output) { -// AdvancedMachineInput aInput = new AdvancedMachineInput(toStack(input), GasRegistry.getGas("liquidOsmium")); -// if (Mekanism.v7) -// MineTweakerAPI.apply(new AddMekanismRecipe("OSMIUM_COMPRESSOR", Recipe.OSMIUM_COMPRESSOR.get(), aInput, toStack(output))); -// else -// { -// OsmiumCompressorRecipe recipe = new OsmiumCompressorRecipe(toStack(input), toStack(output)); -// MineTweakerAPI.apply(new AddMekanismRecipe("OSMIUM_COMPRESSOR", Recipe.OSMIUM_COMPRESSOR.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack output) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new RemoveMekanismRecipe("OSMIUM_COMPRESSOR", Recipe.OSMIUM_COMPRESSOR.get(), toStack(output))); -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toStack; +import mekanism.api.gas.GasRegistry; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.AdvancedMachineInput; +import mekanism.common.recipe.machines.OsmiumCompressorRecipe; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.Compressor") +public class Compressor { + @ZenMethod + public static void addRecipe(IItemStack input, IItemStack output) { + AdvancedMachineInput aInput = new AdvancedMachineInput(toStack(input), GasRegistry.getGas("liquidOsmium")); + if (Mekanism.v7) + MineTweakerAPI.apply(new AddMekanismRecipe("OSMIUM_COMPRESSOR", Recipe.OSMIUM_COMPRESSOR.get(), aInput, toStack(output))); + else + { + OsmiumCompressorRecipe recipe = new OsmiumCompressorRecipe(toStack(input), toStack(output)); + MineTweakerAPI.apply(new AddMekanismRecipe("OSMIUM_COMPRESSOR", Recipe.OSMIUM_COMPRESSOR.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new RemoveMekanismRecipe("OSMIUM_COMPRESSOR", Recipe.OSMIUM_COMPRESSOR.get(), toStack(output))); + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Crusher.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Crusher.java index b26d843..637e8b8 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Crusher.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/Crusher.java @@ -1,32 +1,32 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toStack; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.machines.CrusherRecipe; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.Crusher") -//public class Crusher { -// @ZenMethod -// public static void addRecipe(IItemStack input, IItemStack output) { -// if (Mekanism.v7) -// MineTweakerAPI.apply(new AddMekanismRecipe("CRUSHER", Recipe.CRUSHER.get(), toStack(input), toStack(output))); -// else -// { -// CrusherRecipe recipe = new CrusherRecipe(toStack(input), toStack(output)); -// MineTweakerAPI.apply(new AddMekanismRecipe("CRUSHER", Recipe.CRUSHER.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack output) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new RemoveMekanismRecipe("CRUSHER", Recipe.CRUSHER.get(), toStack(output))); -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toStack; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.machines.CrusherRecipe; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.Crusher") +public class Crusher { + @ZenMethod + public static void addRecipe(IItemStack input, IItemStack output) { + if (Mekanism.v7) + MineTweakerAPI.apply(new AddMekanismRecipe("CRUSHER", Recipe.CRUSHER.get(), toStack(input), toStack(output))); + else + { + CrusherRecipe recipe = new CrusherRecipe(toStack(input), toStack(output)); + MineTweakerAPI.apply(new AddMekanismRecipe("CRUSHER", Recipe.CRUSHER.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new RemoveMekanismRecipe("CRUSHER", Recipe.CRUSHER.get(), toStack(output))); + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Enrichment.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Enrichment.java index 17b7ae2..863ccde 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Enrichment.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/Enrichment.java @@ -1,32 +1,32 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toStack; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.machines.EnrichmentRecipe; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.Enrichment") -//public class Enrichment { -// @ZenMethod -// public static void addRecipe(IItemStack input, IItemStack output) { -// if (Mekanism.v7) -// MineTweakerAPI.apply(new AddMekanismRecipe("ENRICHMENT_CHAMBER", Recipe.ENRICHMENT_CHAMBER.get(), toStack(input), toStack(output))); -// else -// { -// EnrichmentRecipe recipe = new EnrichmentRecipe(toStack(input), toStack(output)); -// MineTweakerAPI.apply(new AddMekanismRecipe("ENRICHMENT_CHAMBER", Recipe.ENRICHMENT_CHAMBER.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack input) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new RemoveMekanismRecipe("ENRICHMENT_CHAMBER", Recipe.ENRICHMENT_CHAMBER.get(), toStack(input))); -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toStack; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.machines.EnrichmentRecipe; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.Enrichment") +public class Enrichment { + @ZenMethod + public static void addRecipe(IItemStack input, IItemStack output) { + if (Mekanism.v7) + MineTweakerAPI.apply(new AddMekanismRecipe("ENRICHMENT_CHAMBER", Recipe.ENRICHMENT_CHAMBER.get(), toStack(input), toStack(output))); + else + { + EnrichmentRecipe recipe = new EnrichmentRecipe(toStack(input), toStack(output)); + MineTweakerAPI.apply(new AddMekanismRecipe("ENRICHMENT_CHAMBER", Recipe.ENRICHMENT_CHAMBER.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IItemStack input) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new RemoveMekanismRecipe("ENRICHMENT_CHAMBER", Recipe.ENRICHMENT_CHAMBER.get(), toStack(input))); + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Purification.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Purification.java index 76ed5f9..5f8a95d 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Purification.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/Purification.java @@ -1,62 +1,62 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toStack; -//import static modtweaker2.helpers.StackHelper.areEqual; -// -//import java.util.Map; -// -//import mekanism.api.gas.GasRegistry; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.AdvancedMachineInput; -//import mekanism.common.recipe.machines.PurificationRecipe; -//import mekanism.common.recipe.outputs.MachineOutput; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.utils.BaseMapRemoval; -//import net.minecraft.item.ItemStack; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.Purification") -//public class Purification { -// @ZenMethod -// public static void addRecipe(IItemStack input, IItemStack output) { -// if (Mekanism.v7) -// { -// AdvancedMachineInput aInput = new AdvancedMachineInput(toStack(input), GasRegistry.getGas("oxygen")); -// MineTweakerAPI.apply(new AddMekanismRecipe("PURIFICATION_CHAMBER", Recipe.PURIFICATION_CHAMBER.get(), aInput, toStack(output))); -// } -// else -// { -// PurificationRecipe recipe = new PurificationRecipe(toStack(input), toStack(output)); -// MineTweakerAPI.apply(new AddMekanismRecipe("PURIFICATION_CHAMBER", Recipe.PURIFICATION_CHAMBER.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack output) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new Remove(toStack(output))); -// } -// -// private static class Remove extends BaseMapRemoval { -// public Remove(ItemStack stack) { -// super("Purification Chamber", Recipe.PURIFICATION_CHAMBER.get(), stack); -// } -// -// //We must search through the recipe entries so that we can assign the correct key for removal -// @Override -// public void apply() { -// for (Map.Entry entry : ((Map) map).entrySet()) { -// if (entry.getValue() != null && areEqual(entry.getValue(), (ItemStack) stack)) { -// key = entry.getKey(); -// break; -// } -// } -// -// super.apply(); -// } -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toStack; +import static modtweaker2.helpers.StackHelper.areEqual; + +import java.util.Map; + +import mekanism.api.gas.GasRegistry; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.AdvancedMachineInput; +import mekanism.common.recipe.machines.PurificationRecipe; +import mekanism.common.recipe.outputs.MachineOutput; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.utils.BaseMapRemoval; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.Purification") +public class Purification { + @ZenMethod + public static void addRecipe(IItemStack input, IItemStack output) { + if (Mekanism.v7) + { + AdvancedMachineInput aInput = new AdvancedMachineInput(toStack(input), GasRegistry.getGas("oxygen")); + MineTweakerAPI.apply(new AddMekanismRecipe("PURIFICATION_CHAMBER", Recipe.PURIFICATION_CHAMBER.get(), aInput, toStack(output))); + } + else + { + PurificationRecipe recipe = new PurificationRecipe(toStack(input), toStack(output)); + MineTweakerAPI.apply(new AddMekanismRecipe("PURIFICATION_CHAMBER", Recipe.PURIFICATION_CHAMBER.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new Remove(toStack(output))); + } + + private static class Remove extends BaseMapRemoval { + public Remove(ItemStack stack) { + super("Purification Chamber", Recipe.PURIFICATION_CHAMBER.get(), stack); + } + + //We must search through the recipe entries so that we can assign the correct key for removal + @Override + public void apply() { + for (Map.Entry entry : ((Map) map).entrySet()) { + if (entry.getValue() != null && areEqual(entry.getValue(), (ItemStack) stack)) { + key = entry.getKey(); + break; + } + } + + super.apply(); + } + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Reaction.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Reaction.java index fdb058d..5bfb04a 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Reaction.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/Reaction.java @@ -1,42 +1,42 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toFluid; -//import static modtweaker2.helpers.InputHelper.toStack; -//import static modtweaker2.mods.mekanism.MekanismHelper.toGas; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.PressurizedInput; -//import mekanism.common.recipe.machines.PressurizedRecipe; -//import mekanism.common.recipe.outputs.PressurizedOutput; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import minetweaker.api.liquid.ILiquidStack; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.Reaction") -//public class Reaction { -// @ZenMethod -// public static void addRecipe(IItemStack solid, ILiquidStack liquid, IGasStack gas, IItemStack outItem, IGasStack outGas, double energy, int ticks) { -// if (Mekanism.v7) -// { -// PressurizedInput input = new PressurizedInput(toStack(solid), toFluid(liquid), toGas(gas)); -// PressurizedRecipe recipe = new PressurizedRecipe(input, new PressurizedOutput(toStack(outItem), toGas(outGas)), energy, ticks); -// MineTweakerAPI.apply(new AddMekanismRecipe("PRESSURIZED_REACTION_CHAMBER", Recipe.PRESSURIZED_REACTION_CHAMBER.get(), input, recipe)); -// } -// else { -// mekanism.common.recipe.machines.PressurizedRecipe recipe = new mekanism.common.recipe.machines.PressurizedRecipe(toStack(solid), toFluid(liquid), toGas(gas), toStack(outItem), toGas(outGas), energy, ticks); -// MineTweakerAPI.apply(new AddMekanismRecipe("PRESSURIZED_REACTION_CHAMBER", Recipe.PRESSURIZED_REACTION_CHAMBER.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack outItem, IGasStack outGas) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// PressurizedOutput output = new PressurizedOutput(toStack(outItem), toGas(outGas)); -// MineTweakerAPI.apply(new RemoveMekanismRecipe("PRESSURIZED_REACTION_CHAMBER", Recipe.PRESSURIZED_REACTION_CHAMBER.get(), output)); -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toFluid; +import static modtweaker2.helpers.InputHelper.toStack; +import static modtweaker2.mods.mekanism.MekanismHelper.toGas; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.PressurizedInput; +import mekanism.common.recipe.machines.PressurizedRecipe; +import mekanism.common.recipe.outputs.PressurizedOutput; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import minetweaker.api.liquid.ILiquidStack; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.mods.mekanism.util.RemoveMekanismRecipe; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.Reaction") +public class Reaction { + @ZenMethod + public static void addRecipe(IItemStack solid, ILiquidStack liquid, IGasStack gas, IItemStack outItem, IGasStack outGas, double energy, int ticks) { + if (Mekanism.v7) + { + PressurizedInput input = new PressurizedInput(toStack(solid), toFluid(liquid), toGas(gas)); + PressurizedRecipe recipe = new PressurizedRecipe(input, new PressurizedOutput(toStack(outItem), toGas(outGas)), energy, ticks); + MineTweakerAPI.apply(new AddMekanismRecipe("PRESSURIZED_REACTION_CHAMBER", Recipe.PRESSURIZED_REACTION_CHAMBER.get(), input, recipe)); + } + else { + mekanism.common.recipe.machines.PressurizedRecipe recipe = new mekanism.common.recipe.machines.PressurizedRecipe(toStack(solid), toFluid(liquid), toGas(gas), toStack(outItem), toGas(outGas), energy, ticks); + MineTweakerAPI.apply(new AddMekanismRecipe("PRESSURIZED_REACTION_CHAMBER", Recipe.PRESSURIZED_REACTION_CHAMBER.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IItemStack outItem, IGasStack outGas) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + PressurizedOutput output = new PressurizedOutput(toStack(outItem), toGas(outGas)); + MineTweakerAPI.apply(new RemoveMekanismRecipe("PRESSURIZED_REACTION_CHAMBER", Recipe.PRESSURIZED_REACTION_CHAMBER.get(), output)); + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Sawmill.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Sawmill.java index cf4645d..cb9eefa 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Sawmill.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/Sawmill.java @@ -1,61 +1,61 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toStack; -//import static modtweaker2.helpers.StackHelper.areEqual; -// -//import java.util.Map; -// -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.machines.SawmillRecipe; -//import mekanism.common.recipe.outputs.ChanceOutput; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.utils.BaseMapRemoval; -//import net.minecraft.item.ItemStack; -//import stanhebben.zenscript.annotations.Optional; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.Sawmill") -//public class Sawmill { -// @ZenMethod -// public static void addRecipe(IItemStack input, IItemStack output1, @Optional IItemStack output2, @Optional double chance) { -// if (Mekanism.v7) -// { -// ChanceOutput chanceOutput = new ChanceOutput(toStack(output1), toStack(output2), chance); -// MineTweakerAPI.apply(new AddMekanismRecipe("PRECISION_SAWMILL", Recipe.PRECISION_SAWMILL.get(), toStack(input), chanceOutput)); -// } -// else -// { -// SawmillRecipe recipe = chance>0?new SawmillRecipe(toStack(input), toStack(output1), toStack(output2), chance) : new SawmillRecipe(toStack(input), toStack(output1)); -// MineTweakerAPI.apply(new AddMekanismRecipe("PRECISION_SAWMILL", Recipe.PRECISION_SAWMILL.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack input) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new Remove(toStack(input))); -// } -// -// private static class Remove extends BaseMapRemoval { -// public Remove(ItemStack stack) { -// super("Precision Sawmill", Recipe.PRECISION_SAWMILL.get(), stack); -// } -// -// //We must search through the recipe entries so that we can assign the correct key for removal -// @Override -// public void apply() { -// for (Map.Entry entry : ((Map) map).entrySet()) { -// if (entry.getKey() != null && areEqual(entry.getKey(), (ItemStack) stack)) { -// key = entry.getKey(); -// break; -// } -// } -// -// super.apply(); -// } -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toStack; +import static modtweaker2.helpers.StackHelper.areEqual; + +import java.util.Map; + +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.machines.SawmillRecipe; +import mekanism.common.recipe.outputs.ChanceOutput; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.utils.BaseMapRemoval; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.Optional; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.Sawmill") +public class Sawmill { + @ZenMethod + public static void addRecipe(IItemStack input, IItemStack output1, @Optional IItemStack output2, @Optional double chance) { + if (Mekanism.v7) + { + ChanceOutput chanceOutput = new ChanceOutput(toStack(output1), toStack(output2), chance); + MineTweakerAPI.apply(new AddMekanismRecipe("PRECISION_SAWMILL", Recipe.PRECISION_SAWMILL.get(), toStack(input), chanceOutput)); + } + else + { + SawmillRecipe recipe = chance>0?new SawmillRecipe(toStack(input), toStack(output1), toStack(output2), chance) : new SawmillRecipe(toStack(input), toStack(output1)); + MineTweakerAPI.apply(new AddMekanismRecipe("PRECISION_SAWMILL", Recipe.PRECISION_SAWMILL.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(IItemStack input) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new Remove(toStack(input))); + } + + private static class Remove extends BaseMapRemoval { + public Remove(ItemStack stack) { + super("Precision Sawmill", Recipe.PRECISION_SAWMILL.get(), stack); + } + + //We must search through the recipe entries so that we can assign the correct key for removal + @Override + public void apply() { + for (Map.Entry entry : ((Map) map).entrySet()) { + if (entry.getKey() != null && areEqual(entry.getKey(), (ItemStack) stack)) { + key = entry.getKey(); + break; + } + } + + super.apply(); + } + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/Separator.java b/src/main/java/modtweaker2/mods/mekanism/handlers/Separator.java index a37555f..af08c3f 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/Separator.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/Separator.java @@ -1,72 +1,72 @@ -//package modtweaker2.mods.mekanism.handlers; -// -//import static modtweaker2.helpers.InputHelper.toFluid; -//import static modtweaker2.mods.mekanism.MekanismHelper.toGas; -// -//import java.util.Map; -// -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.ChemicalPairInput; -//import mekanism.common.recipe.machines.SeparatorRecipe; -//import mekanism.common.recipe.outputs.ChemicalPairOutput; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.liquid.ILiquidStack; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.mods.mekanism.util.AddMekanismRecipe; -//import modtweaker2.utils.BaseMapRemoval; -//import net.minecraftforge.fluids.FluidStack; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.Separator") -//public class Separator { -// @ZenMethod -// public static void addRecipe(ILiquidStack input, IGasStack gas1, IGasStack gas2) { -// if (Mekanism.v7) -// { -// ChemicalPairInput pair = new ChemicalPairInput(toGas(gas1), toGas(gas2)); -// MineTweakerAPI.apply(new AddMekanismRecipe("ELECTROLYTIC_SEPARATOR", Recipe.ELECTROLYTIC_SEPARATOR.get(), toFluid(input), pair)); -// } else -// { -// throw new UnsupportedOperationException("Syntax for v8 is: Fluid, Energy, Gas, Gas"); -// } -// } -// -// @ZenMethod -// public static void addRecipe(ILiquidStack input, double energy, IGasStack gas1, IGasStack gas2) { -// if (Mekanism.v7) -// { -// throw new UnsupportedOperationException("Syntax for v7 is: Fluid, Gas, Gas"); -// } else -// { -// SeparatorRecipe recipe = new SeparatorRecipe(toFluid(input), energy, toGas(gas1), toGas(gas2)); -// MineTweakerAPI.apply(new AddMekanismRecipe("ELECTROLYTIC_SEPARATOR", Recipe.ELECTROLYTIC_SEPARATOR.get(), recipe.getInput(), recipe)); -// } -// } -// -// @ZenMethod -// public static void removeRecipe(ILiquidStack input) { -// if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); -// MineTweakerAPI.apply(new Remove(toFluid(input))); -// } -// -// private static class Remove extends BaseMapRemoval { -// public Remove(FluidStack stack) { -// super("Electrolytic Separator", Recipe.ELECTROLYTIC_SEPARATOR.get(), stack); -// } -// -// //We must search through the recipe entries so that we can assign the correct key for removal -// @Override -// public void apply() { -// for (Map.Entry entry : ((Map) map).entrySet()) { -// if (entry.getKey() != null && entry.getKey().isFluidEqual((FluidStack) stack)) { -// key = entry.getKey(); -// break; -// } -// } -// -// super.apply(); -// } -// } -//} +package modtweaker2.mods.mekanism.handlers; + +import static modtweaker2.helpers.InputHelper.toFluid; +import static modtweaker2.mods.mekanism.MekanismHelper.toGas; + +import java.util.Map; + +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.ChemicalPairInput; +import mekanism.common.recipe.machines.SeparatorRecipe; +import mekanism.common.recipe.outputs.ChemicalPairOutput; +import minetweaker.MineTweakerAPI; +import minetweaker.api.liquid.ILiquidStack; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.mods.mekanism.util.AddMekanismRecipe; +import modtweaker2.utils.BaseMapRemoval; +import net.minecraftforge.fluids.FluidStack; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.Separator") +public class Separator { + @ZenMethod + public static void addRecipe(ILiquidStack input, IGasStack gas1, IGasStack gas2) { + if (Mekanism.v7) + { + ChemicalPairInput pair = new ChemicalPairInput(toGas(gas1), toGas(gas2)); + MineTweakerAPI.apply(new AddMekanismRecipe("ELECTROLYTIC_SEPARATOR", Recipe.ELECTROLYTIC_SEPARATOR.get(), toFluid(input), pair)); + } else + { + throw new UnsupportedOperationException("Syntax for v8 is: Fluid, Energy, Gas, Gas"); + } + } + + @ZenMethod + public static void addRecipe(ILiquidStack input, double energy, IGasStack gas1, IGasStack gas2) { + if (Mekanism.v7) + { + throw new UnsupportedOperationException("Syntax for v7 is: Fluid, Gas, Gas"); + } else + { + SeparatorRecipe recipe = new SeparatorRecipe(toFluid(input), energy, toGas(gas1), toGas(gas2)); + MineTweakerAPI.apply(new AddMekanismRecipe("ELECTROLYTIC_SEPARATOR", Recipe.ELECTROLYTIC_SEPARATOR.get(), recipe.getInput(), recipe)); + } + } + + @ZenMethod + public static void removeRecipe(ILiquidStack input) { + if (!Mekanism.v7) throw new UnsupportedOperationException("Function not added to v8 compatibility yet"); + MineTweakerAPI.apply(new Remove(toFluid(input))); + } + + private static class Remove extends BaseMapRemoval { + public Remove(FluidStack stack) { + super("Electrolytic Separator", Recipe.ELECTROLYTIC_SEPARATOR.get(), stack); + } + + //We must search through the recipe entries so that we can assign the correct key for removal + @Override + public void apply() { + for (Map.Entry entry : ((Map) map).entrySet()) { + if (entry.getKey() != null && entry.getKey().isFluidEqual((FluidStack) stack)) { + key = entry.getKey(); + break; + } + } + + super.apply(); + } + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalCrystallizer.java b/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalCrystallizer.java index 456205a..b8e37e4 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalCrystallizer.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalCrystallizer.java @@ -1,83 +1,85 @@ -//package modtweaker2.mods.mekanism.handlers.v8; -// -//import static modtweaker2.mods.mekanism.MekanismHelper.toGas; -// -//import java.util.ArrayList; -//import java.util.List; -//import java.util.Set; -// -//import mekanism.api.gas.GasStack; -//import mekanism.common.recipe.RecipeHandler; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.GasInput; -//import mekanism.common.recipe.machines.CrystallizerRecipe; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.helpers.InputHelper; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.utils.BaseMapAddition; -//import modtweaker2.utils.BaseMapRemoval; -//import net.minecraft.item.ItemStack; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.chemical.Crystallizer") -//public class ChemicalCrystallizer { -// -// @ZenMethod -// public static void addRecipe(IItemStack output, IGasStack input) { -// MineTweakerAPI.apply(new Add(new ChemicalCrystallizerRecipe(toGas(input), InputHelper.toStack(output)))); -// } -// -// private static class Add extends BaseMapAddition { -// -// public Add(ChemicalCrystallizerRecipe recipe) { -// super("Chemical Crystallizer", Recipe.CHEMICAL_CRYSTALLIZER.get(), recipe.inputGas, recipe.outputItem); -// } -// -// @Override -// public void apply() { -// RecipeHandler.addChemicalCrystallizerRecipe((GasStack) key, (ItemStack) recipe); -// } -// -// } -// -// private static class ChemicalCrystallizerRecipe { -// public GasStack inputGas; -// public ItemStack outputItem; -// -// public ChemicalCrystallizerRecipe(GasStack inputGas, ItemStack outputItem) { -// this.inputGas = inputGas; -// this.outputItem = outputItem; -// -// } -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack output) { -// MineTweakerAPI.apply(new Remove(InputHelper.toStack(output))); -// } -// -// private static class Remove extends BaseMapRemoval { -// -// public Remove(ItemStack stack) { -// super("Chemical Crystallizer", Recipe.CHEMICAL_CRYSTALLIZER.get(), stack); -// } -// -// @SuppressWarnings("unchecked") -// @Override -// public void apply() { -// List gasesToRemove = new ArrayList(); -// for(GasInput stack : (Set)Recipe.CHEMICAL_CRYSTALLIZER.get().keySet()){ -// CrystallizerRecipe crystalRecipe= (CrystallizerRecipe)Recipe.CHEMICAL_CRYSTALLIZER.get().get(stack); -// if(crystalRecipe.getOutput().output.isItemEqual((ItemStack) this.stack)){ -// gasesToRemove.add(stack); -// } -// } -// for(GasInput stack : gasesToRemove){ -// Recipe.CHEMICAL_CRYSTALLIZER.get().remove(stack); -// } -// } -// -// } -//} +package modtweaker2.mods.mekanism.handlers.v8; + +import static modtweaker2.mods.mekanism.MekanismHelper.toGas; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import mekanism.api.gas.GasStack; +import mekanism.common.KeySync.KeySet; +import mekanism.common.recipe.RecipeHandler; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.GasInput; +import mekanism.common.recipe.machines.CrystallizerRecipe; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.helpers.InputHelper; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.utils.BaseMapAddition; +import modtweaker2.utils.BaseMapRemoval; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.chemical.Crystallizer") +public class ChemicalCrystallizer { + + @ZenMethod + public static void addRecipe(IItemStack output, IGasStack input) { + MineTweakerAPI.apply(new Add(new ChemicalCrystallizerRecipe(toGas(input), InputHelper.toStack(output)))); + } + + private static class Add extends BaseMapAddition { + + public Add(ChemicalCrystallizerRecipe recipe) { + super("Chemical Crystallizer", Recipe.CHEMICAL_CRYSTALLIZER.get(), recipe.inputGas, recipe.outputItem); + } + + @Override + public void apply() { + RecipeHandler.addChemicalCrystallizerRecipe((GasStack) key, (ItemStack) recipe); + } + + } + + private static class ChemicalCrystallizerRecipe { + public GasStack inputGas; + public ItemStack outputItem; + + public ChemicalCrystallizerRecipe(GasStack inputGas, ItemStack outputItem) { + this.inputGas = inputGas; + this.outputItem = outputItem; + + } + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + MineTweakerAPI.apply(new Remove(InputHelper.toStack(output))); + } + + private static class Remove extends BaseMapRemoval { + + public Remove(ItemStack stack) { + super("Chemical Crystallizer", Recipe.CHEMICAL_CRYSTALLIZER.get(), stack); + } + + @SuppressWarnings("unchecked") + @Override + public void apply() { + List gasesToRemove = new ArrayList(); + for(GasInput stack : (Set)Recipe.CHEMICAL_CRYSTALLIZER.get().keySet()){ + CrystallizerRecipe crystalRecipe= (CrystallizerRecipe)Recipe.CHEMICAL_CRYSTALLIZER.get().get(stack); + if(crystalRecipe.getOutput().output.isItemEqual((ItemStack) this.stack)){ + gasesToRemove.add(stack); + } + } + for(GasInput stack : gasesToRemove){ + Recipe.CHEMICAL_CRYSTALLIZER.get().remove(stack); + } + } + + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalDissolution.java b/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalDissolution.java index 882f6bf..0cd5c61 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalDissolution.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalDissolution.java @@ -1,84 +1,84 @@ -//package modtweaker2.mods.mekanism.handlers.v8; -// -//import java.util.ArrayList; -//import java.util.List; -//import java.util.Set; -// -//import mekanism.api.gas.GasStack; -//import mekanism.common.recipe.RecipeHandler; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.ItemStackInput; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.helpers.InputHelper; -//import modtweaker2.mods.mekanism.MekanismHelper; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.utils.BaseMapAddition; -//import modtweaker2.utils.BaseMapRemoval; -//import net.minecraft.item.ItemStack; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.chemical.Dissolution") -//public class ChemicalDissolution { -// -// @ZenMethod -// public static void addRecipe(IGasStack output, IItemStack input) { -// MineTweakerAPI.apply(new Add(new DissolutionRecipe(MekanismHelper.toGas(output), InputHelper.toStack(input)))); -// } -// -// private static class Add extends BaseMapAddition { -// -// public DissolutionRecipe recipe; -// -// public Add(DissolutionRecipe recipe) { -// super("Dissolution Infuser", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), recipe.input, recipe.output); -// this.recipe = recipe; -// } -// -// @Override -// public void apply() { -// RecipeHandler.addChemicalDissolutionChamberRecipe(recipe.input, recipe.output); -// -// } -// } -// -// private static class DissolutionRecipe { -// public GasStack output; -// public ItemStack input; -// -// public DissolutionRecipe(GasStack output, ItemStack input) { -// this.output = output; -// this.input = input; -// } -// -// } -// -// @ZenMethod -// public static void removeRecipe(IGasStack output) { -// MineTweakerAPI.apply(new Remove(MekanismHelper.toGas(output))); -// } -// -// private static class Remove extends BaseMapRemoval { -// -// public Remove(GasStack stack) { -// super("Dissolution Infuser", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), stack); -// } -// -// @SuppressWarnings("unchecked") -// @Override -// public void apply() { -// List toRemove = new ArrayList(); -// for (ItemStackInput stack : (Set) Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().keySet()) { -// mekanism.common.recipe.machines.DissolutionRecipe recipe = (mekanism.common.recipe.machines.DissolutionRecipe) Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().get(stack); -// if (recipe.getOutput().output.isGasEqual((GasStack) this.stack)) { -// toRemove.add(stack); -// } -// } -// for (ItemStackInput stack : toRemove) { -// Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().remove(stack); -// } -// } -// -// } -//} +package modtweaker2.mods.mekanism.handlers.v8; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import mekanism.api.gas.GasStack; +import mekanism.common.recipe.RecipeHandler; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.ItemStackInput; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.helpers.InputHelper; +import modtweaker2.mods.mekanism.MekanismHelper; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.utils.BaseMapAddition; +import modtweaker2.utils.BaseMapRemoval; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.chemical.Dissolution") +public class ChemicalDissolution { + + @ZenMethod + public static void addRecipe(IGasStack output, IItemStack input) { + MineTweakerAPI.apply(new Add(new DissolutionRecipe(MekanismHelper.toGas(output), InputHelper.toStack(input)))); + } + + private static class Add extends BaseMapAddition { + + public DissolutionRecipe recipe; + + public Add(DissolutionRecipe recipe) { + super("Dissolution Infuser", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), recipe.input, recipe.output); + this.recipe = recipe; + } + + @Override + public void apply() { + RecipeHandler.addChemicalDissolutionChamberRecipe(recipe.input, recipe.output); + + } + } + + private static class DissolutionRecipe { + public GasStack output; + public ItemStack input; + + public DissolutionRecipe(GasStack output, ItemStack input) { + this.output = output; + this.input = input; + } + + } + + @ZenMethod + public static void removeRecipe(IGasStack output) { + MineTweakerAPI.apply(new Remove(MekanismHelper.toGas(output))); + } + + private static class Remove extends BaseMapRemoval { + + public Remove(GasStack stack) { + super("Dissolution Infuser", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), stack); + } + + @SuppressWarnings("unchecked") + @Override + public void apply() { + List toRemove = new ArrayList(); + for (ItemStackInput stack : (Set) Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().keySet()) { + mekanism.common.recipe.machines.DissolutionRecipe recipe = (mekanism.common.recipe.machines.DissolutionRecipe) Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().get(stack); + if (recipe.getOutput().output.isGasEqual((GasStack) this.stack)) { + toRemove.add(stack); + } + } + for (ItemStackInput stack : toRemove) { + Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().remove(stack); + } + } + + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalInfuser.java b/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalInfuser.java index 423b60f..fae3b50 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalInfuser.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalInfuser.java @@ -1,85 +1,85 @@ -//package modtweaker2.mods.mekanism.handlers.v8; -// -//import java.util.ArrayList; -//import java.util.List; -//import java.util.Set; -// -//import mekanism.api.gas.GasStack; -//import mekanism.common.recipe.RecipeHandler; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.ChemicalPairInput; -//import mekanism.common.recipe.machines.ChemicalInfuserRecipe; -//import mekanism.common.recipe.outputs.GasOutput; -//import minetweaker.MineTweakerAPI; -//import modtweaker2.mods.mekanism.MekanismHelper; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.utils.BaseMapAddition; -//import modtweaker2.utils.BaseMapRemoval; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.chemical.Infuser") -//public class ChemicalInfuser { -// -// @ZenMethod -// public static void addRecipe(IGasStack output, IGasStack inputLeft, IGasStack inputRight) { -// MineTweakerAPI.apply(new Add(new InfuserRecipe(MekanismHelper.toGas(output), MekanismHelper.toGas(inputLeft), MekanismHelper.toGas(inputRight)))); -// } -// -// private static class Add extends BaseMapAddition { -// -// public InfuserRecipe recipe; -// -// public Add(InfuserRecipe recipe) { -// super("Chemical Infuser", Recipe.CHEMICAL_INFUSER.get(), new ChemicalPairInput(recipe.inputLeft, recipe.inputRight), new GasOutput(recipe.output)); -// this.recipe = recipe; -// } -// -// @Override -// public void apply() { -// RecipeHandler.addChemicalInfuserRecipe(recipe.inputLeft, recipe.inputRight, recipe.output); -// -// } -// } -// -// private static class InfuserRecipe { -// public GasStack output; -// public GasStack inputLeft; -// public GasStack inputRight; -// -// public InfuserRecipe(GasStack output, GasStack inputLeft, GasStack inputRight) { -// this.output = output; -// this.inputLeft = inputLeft; -// this.inputRight = inputRight; -// } -// -// } -// -// @ZenMethod -// public static void removeRecipe(IGasStack output) { -// MineTweakerAPI.apply(new Remove(MekanismHelper.toGas(output))); -// } -// -// private static class Remove extends BaseMapRemoval { -// -// public Remove(GasStack stack) { -// super("Chemical Infuser", Recipe.CHEMICAL_INFUSER.get(), stack); -// } -// -// @SuppressWarnings("unchecked") -// @Override -// public void apply() { -// List toRemove = new ArrayList(); -// for (ChemicalPairInput stack : (Set) Recipe.CHEMICAL_INFUSER.get().keySet()) { -// ChemicalInfuserRecipe recipe = (ChemicalInfuserRecipe) Recipe.CHEMICAL_INFUSER.get().get(stack); -// if (recipe.getOutput().output.isGasEqual((GasStack)this.stack)) { -// toRemove.add(stack); -// } -// } -// for (ChemicalPairInput stack : toRemove) { -// Recipe.CHEMICAL_INFUSER.get().remove(stack); -// } -// } -// -// } -//} +package modtweaker2.mods.mekanism.handlers.v8; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import mekanism.api.gas.GasStack; +import mekanism.common.recipe.RecipeHandler; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.ChemicalPairInput; +import mekanism.common.recipe.machines.ChemicalInfuserRecipe; +import mekanism.common.recipe.outputs.GasOutput; +import minetweaker.MineTweakerAPI; +import modtweaker2.mods.mekanism.MekanismHelper; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.utils.BaseMapAddition; +import modtweaker2.utils.BaseMapRemoval; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.chemical.Infuser") +public class ChemicalInfuser { + + @ZenMethod + public static void addRecipe(IGasStack output, IGasStack inputLeft, IGasStack inputRight) { + MineTweakerAPI.apply(new Add(new InfuserRecipe(MekanismHelper.toGas(output), MekanismHelper.toGas(inputLeft), MekanismHelper.toGas(inputRight)))); + } + + private static class Add extends BaseMapAddition { + + public InfuserRecipe recipe; + + public Add(InfuserRecipe recipe) { + super("Chemical Infuser", Recipe.CHEMICAL_INFUSER.get(), new ChemicalPairInput(recipe.inputLeft, recipe.inputRight), new GasOutput(recipe.output)); + this.recipe = recipe; + } + + @Override + public void apply() { + RecipeHandler.addChemicalInfuserRecipe(recipe.inputLeft, recipe.inputRight, recipe.output); + + } + } + + private static class InfuserRecipe { + public GasStack output; + public GasStack inputLeft; + public GasStack inputRight; + + public InfuserRecipe(GasStack output, GasStack inputLeft, GasStack inputRight) { + this.output = output; + this.inputLeft = inputLeft; + this.inputRight = inputRight; + } + + } + + @ZenMethod + public static void removeRecipe(IGasStack output) { + MineTweakerAPI.apply(new Remove(MekanismHelper.toGas(output))); + } + + private static class Remove extends BaseMapRemoval { + + public Remove(GasStack stack) { + super("Chemical Infuser", Recipe.CHEMICAL_INFUSER.get(), stack); + } + + @SuppressWarnings("unchecked") + @Override + public void apply() { + List toRemove = new ArrayList(); + for (ChemicalPairInput stack : (Set) Recipe.CHEMICAL_INFUSER.get().keySet()) { + ChemicalInfuserRecipe recipe = (ChemicalInfuserRecipe) Recipe.CHEMICAL_INFUSER.get().get(stack); + if (recipe.getOutput().output.isGasEqual((GasStack)this.stack)) { + toRemove.add(stack); + } + } + for (ChemicalPairInput stack : toRemove) { + Recipe.CHEMICAL_INFUSER.get().remove(stack); + } + } + + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalInjection.java b/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalInjection.java index 29270df..1a6eab0 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalInjection.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/v8/ChemicalInjection.java @@ -1,86 +1,86 @@ -//package modtweaker2.mods.mekanism.handlers.v8; -// -//import java.util.ArrayList; -//import java.util.List; -//import java.util.Set; -// -//import mekanism.api.gas.GasStack; -//import mekanism.common.recipe.RecipeHandler; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.AdvancedMachineInput; -//import mekanism.common.recipe.outputs.ItemStackOutput; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.helpers.InputHelper; -//import modtweaker2.mods.mekanism.MekanismHelper; -//import modtweaker2.mods.mekanism.gas.IGasStack; -//import modtweaker2.utils.BaseMapAddition; -//import modtweaker2.utils.BaseMapRemoval; -//import net.minecraft.item.ItemStack; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.chemical.Injection") -//public class ChemicalInjection { -// -// @ZenMethod -// public static void addRecipe(IItemStack output, IItemStack input, IGasStack gas) { -// MineTweakerAPI.apply(new Add(new InjectionRecipe(InputHelper.toStack(output), InputHelper.toStack(input), MekanismHelper.toGas(gas)))); -// } -// -// private static class Add extends BaseMapAddition { -// -// public InjectionRecipe recipe; -// -// public Add(InjectionRecipe recipe) { -// super("Chemical Injection", Recipe.CHEMICAL_INJECTION_CHAMBER.get(), recipe.input, recipe.output); -// this.recipe = recipe; -// } -// -// @Override -// public void apply() { -// RecipeHandler.addChemicalInjectionChamberRecipe(recipe.input, recipe.gas.getGas().getLocalizedName(), recipe.output); -// } -// } -// -// private static class InjectionRecipe { -// public ItemStack output; -// public ItemStack input; -// public GasStack gas; -// -// public InjectionRecipe(ItemStack output, ItemStack input, GasStack gas) { -// this.output = output; -// this.input = input; -// this.gas = gas; -// } -// -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack output) { -// MineTweakerAPI.apply(new Remove(InputHelper.toStack(output))); -// } -// -// private static class Remove extends BaseMapRemoval { -// -// public Remove(ItemStack output) { -// super("Chemical Injection", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), output); -// } -// -// @SuppressWarnings("unchecked") -// @Override -// public void apply() { -// List toRemove = new ArrayList(); -// for (AdvancedMachineInput stack : (Set) Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().keySet()) { -// ItemStackOutput recipe = (ItemStackOutput) Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().get(stack); -// if (recipe.output.isItemEqual((ItemStack)this.stack)) { -// toRemove.add(stack); -// } -// } -// for (AdvancedMachineInput stack : toRemove) { -// Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().remove(stack); -// } -// } -// -// } -//} +package modtweaker2.mods.mekanism.handlers.v8; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import mekanism.api.gas.GasStack; +import mekanism.common.recipe.RecipeHandler; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.AdvancedMachineInput; +import mekanism.common.recipe.outputs.ItemStackOutput; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.helpers.InputHelper; +import modtweaker2.mods.mekanism.MekanismHelper; +import modtweaker2.mods.mekanism.gas.IGasStack; +import modtweaker2.utils.BaseMapAddition; +import modtweaker2.utils.BaseMapRemoval; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.chemical.Injection") +public class ChemicalInjection { + + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, IGasStack gas) { + MineTweakerAPI.apply(new Add(new InjectionRecipe(InputHelper.toStack(output), InputHelper.toStack(input), MekanismHelper.toGas(gas)))); + } + + private static class Add extends BaseMapAddition { + + public InjectionRecipe recipe; + + public Add(InjectionRecipe recipe) { + super("Chemical Injection", Recipe.CHEMICAL_INJECTION_CHAMBER.get(), recipe.input, recipe.output); + this.recipe = recipe; + } + + @Override + public void apply() { + RecipeHandler.addChemicalInjectionChamberRecipe(recipe.input, recipe.gas.getGas().getLocalizedName(), recipe.output); + } + } + + private static class InjectionRecipe { + public ItemStack output; + public ItemStack input; + public GasStack gas; + + public InjectionRecipe(ItemStack output, ItemStack input, GasStack gas) { + this.output = output; + this.input = input; + this.gas = gas; + } + + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + MineTweakerAPI.apply(new Remove(InputHelper.toStack(output))); + } + + private static class Remove extends BaseMapRemoval { + + public Remove(ItemStack output) { + super("Chemical Injection", Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get(), output); + } + + @SuppressWarnings("unchecked") + @Override + public void apply() { + List toRemove = new ArrayList(); + for (AdvancedMachineInput stack : (Set) Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().keySet()) { + ItemStackOutput recipe = (ItemStackOutput) Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().get(stack); + if (recipe.output.isItemEqual((ItemStack)this.stack)) { + toRemove.add(stack); + } + } + for (AdvancedMachineInput stack : toRemove) { + Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get().remove(stack); + } + } + + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/handlers/v8/Infuser.java b/src/main/java/modtweaker2/mods/mekanism/handlers/v8/Infuser.java index 506b509..00dfaec 100644 --- a/src/main/java/modtweaker2/mods/mekanism/handlers/v8/Infuser.java +++ b/src/main/java/modtweaker2/mods/mekanism/handlers/v8/Infuser.java @@ -1,90 +1,90 @@ -//package modtweaker2.mods.mekanism.handlers.v8; -// -//import java.util.ArrayList; -//import java.util.List; -//import java.util.Set; -// -//import mekanism.api.infuse.InfuseRegistry; -//import mekanism.api.infuse.InfuseType; -//import mekanism.common.recipe.RecipeHandler; -//import mekanism.common.recipe.RecipeHandler.Recipe; -//import mekanism.common.recipe.inputs.InfusionInput; -//import mekanism.common.recipe.machines.MetallurgicInfuserRecipe; -//import mekanism.common.recipe.outputs.ItemStackOutput; -//import minetweaker.MineTweakerAPI; -//import minetweaker.api.item.IItemStack; -//import modtweaker2.helpers.InputHelper; -//import modtweaker2.utils.BaseMapAddition; -//import modtweaker2.utils.BaseMapRemoval; -//import net.minecraft.item.ItemStack; -//import stanhebben.zenscript.annotations.ZenClass; -//import stanhebben.zenscript.annotations.ZenMethod; -// -//@ZenClass("mods.mekanism.Infuser") -//public class Infuser { -// -// @ZenMethod -// public static void addRecipe(IItemStack output, IItemStack input, int amount, String infuseType) { -// InfuseType type = InfuseRegistry.get(infuseType); -// MineTweakerAPI.apply(new Add(new InfuserRecipe(InputHelper.toStack(output), InputHelper.toStack(input), amount, type))); -// } -// -// private static class Add extends BaseMapAddition { -// -// public InfuserRecipe recipe; -// -// public Add(InfuserRecipe recipe) { -// super("Metallurgic Infuser", Recipe.METALLURGIC_INFUSER.get(), new InfusionInput(recipe.type, recipe.amount, recipe.input), new ItemStackOutput(recipe.output)); -// this.recipe = recipe; -// } -// -// @Override -// public void apply() { -// RecipeHandler.addMetallurgicInfuserRecipe(recipe.type, recipe.amount, recipe.input, recipe.output); -// -// } -// } -// -// private static class InfuserRecipe { -// public ItemStack output; -// public ItemStack input; -// public int amount; -// public InfuseType type; -// -// public InfuserRecipe(ItemStack output, ItemStack input, int amount, InfuseType type) { -// this.output = output; -// this.input = input; -// this.amount = amount; -// this.type = type; -// } -// -// } -// -// @ZenMethod -// public static void removeRecipe(IItemStack output) { -// MineTweakerAPI.apply(new Remove(InputHelper.toStack(output))); -// } -// -// private static class Remove extends BaseMapRemoval { -// -// public Remove(ItemStack stack) { -// super("Metallurgic Infuser", Recipe.METALLURGIC_INFUSER.get(), stack); -// } -// -// @SuppressWarnings("unchecked") -// @Override -// public void apply() { -// List toRemove = new ArrayList(); -// for (InfusionInput stack : (Set) Recipe.METALLURGIC_INFUSER.get().keySet()) { -// MetallurgicInfuserRecipe recipe = (MetallurgicInfuserRecipe) Recipe.METALLURGIC_INFUSER.get().get(stack); -// if (recipe.getOutput().output.isItemEqual((ItemStack) this.stack)) { -// toRemove.add(stack); -// } -// } -// for (InfusionInput stack : toRemove) { -// Recipe.METALLURGIC_INFUSER.get().remove(stack); -// } -// } -// -// } -//} +package modtweaker2.mods.mekanism.handlers.v8; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import mekanism.api.infuse.InfuseRegistry; +import mekanism.api.infuse.InfuseType; +import mekanism.common.recipe.RecipeHandler; +import mekanism.common.recipe.RecipeHandler.Recipe; +import mekanism.common.recipe.inputs.InfusionInput; +import mekanism.common.recipe.machines.MetallurgicInfuserRecipe; +import mekanism.common.recipe.outputs.ItemStackOutput; +import minetweaker.MineTweakerAPI; +import minetweaker.api.item.IItemStack; +import modtweaker2.helpers.InputHelper; +import modtweaker2.utils.BaseMapAddition; +import modtweaker2.utils.BaseMapRemoval; +import net.minecraft.item.ItemStack; +import stanhebben.zenscript.annotations.ZenClass; +import stanhebben.zenscript.annotations.ZenMethod; + +@ZenClass("mods.mekanism.Infuser") +public class Infuser { + + @ZenMethod + public static void addRecipe(IItemStack output, IItemStack input, int amount, String infuseType) { + InfuseType type = InfuseRegistry.get(infuseType); + MineTweakerAPI.apply(new Add(new InfuserRecipe(InputHelper.toStack(output), InputHelper.toStack(input), amount, type))); + } + + private static class Add extends BaseMapAddition { + + public InfuserRecipe recipe; + + public Add(InfuserRecipe recipe) { + super("Metallurgic Infuser", Recipe.METALLURGIC_INFUSER.get(), new InfusionInput(recipe.type, recipe.amount, recipe.input), new ItemStackOutput(recipe.output)); + this.recipe = recipe; + } + + @Override + public void apply() { + RecipeHandler.addMetallurgicInfuserRecipe(recipe.type, recipe.amount, recipe.input, recipe.output); + + } + } + + private static class InfuserRecipe { + public ItemStack output; + public ItemStack input; + public int amount; + public InfuseType type; + + public InfuserRecipe(ItemStack output, ItemStack input, int amount, InfuseType type) { + this.output = output; + this.input = input; + this.amount = amount; + this.type = type; + } + + } + + @ZenMethod + public static void removeRecipe(IItemStack output) { + MineTweakerAPI.apply(new Remove(InputHelper.toStack(output))); + } + + private static class Remove extends BaseMapRemoval { + + public Remove(ItemStack stack) { + super("Metallurgic Infuser", Recipe.METALLURGIC_INFUSER.get(), stack); + } + + @SuppressWarnings("unchecked") + @Override + public void apply() { + List toRemove = new ArrayList(); + for (InfusionInput stack : (Set) Recipe.METALLURGIC_INFUSER.get().keySet()) { + MetallurgicInfuserRecipe recipe = (MetallurgicInfuserRecipe) Recipe.METALLURGIC_INFUSER.get().get(stack); + if (recipe.getOutput().output.isItemEqual((ItemStack) this.stack)) { + toRemove.add(stack); + } + } + for (InfusionInput stack : toRemove) { + Recipe.METALLURGIC_INFUSER.get().remove(stack); + } + } + + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/util/AddMekanismRecipe.java b/src/main/java/modtweaker2/mods/mekanism/util/AddMekanismRecipe.java index 5a6db24..92d3ad8 100644 --- a/src/main/java/modtweaker2/mods/mekanism/util/AddMekanismRecipe.java +++ b/src/main/java/modtweaker2/mods/mekanism/util/AddMekanismRecipe.java @@ -1,67 +1,67 @@ -//package modtweaker2.mods.mekanism.util; -// -//import java.util.Map; -// -//import mekanism.api.gas.GasStack; -//import mekanism.common.recipe.inputs.ChemicalPairInput; -//import mekanism.common.recipe.inputs.InfusionInput; -//import mekanism.common.recipe.machines.PressurizedRecipe; -//import mekanism.common.recipe.outputs.ChanceOutput; -//import mekanism.common.recipe.outputs.ChemicalPairOutput; -//import mekanism.common.recipe.outputs.PressurizedOutput; -//import modtweaker2.mods.mekanism.Mekanism; -//import modtweaker2.utils.BaseMapAddition; -//import net.minecraft.item.ItemStack; -//import net.minecraftforge.fluids.FluidStack; -// -//public class AddMekanismRecipe extends BaseMapAddition { -// public AddMekanismRecipe(String str, Map map, Object key, Object recipe) { -// super(str.toLowerCase(), map, key, recipe); -// } -// -// @Override -// public String describe() { -// if (Mekanism.v7) { -// if (recipe instanceof ItemStack) -// return "Adding " + description + " Recipe for : " + ((ItemStack) recipe).getDisplayName(); -// else if (recipe instanceof FluidStack) -// return "Adding " + description + " Recipe for : " + ((FluidStack) recipe).getFluid().getLocalizedName(); -// else if (recipe instanceof ChemicalPairInput) -// return "Adding " + description + " Recipe for : " + ((ChemicalPairInput) recipe).leftGas.getGas().getLocalizedName(); -// else if (recipe instanceof ChanceOutput) -// return "Adding " + description + " Recipe for : " + ((ChanceOutput) recipe).primaryOutput.getDisplayName(); -// else if (recipe instanceof GasStack) -// return "Adding " + description + " Recipe for : " + ((GasStack) recipe).getGas().getLocalizedName(); -// else if (recipe instanceof PressurizedRecipe) -// return "Adding " + description + " Recipe for : " + ((PressurizedRecipe) recipe).getOutput().getItemOutput().getDisplayName(); -// else if (recipe instanceof InfusionInput) -// return "Adding " + description + " Recipe for : " + ((InfusionInput) recipe).inputStack.getDisplayName(); -// else -// return super.getRecipeInfo(); -// } -// return ""; -// } -// -// @Override -// public String describeUndo() { -// if (Mekanism.isV7()) { -// if (recipe instanceof ItemStack) -// return "Removing " + description + " Recipe for : " + ((ItemStack) recipe).getDisplayName(); -// else if (recipe instanceof FluidStack) -// return "Removing " + description + " Recipe for : " + ((FluidStack) recipe).getFluid().getLocalizedName(); -// else if (recipe instanceof ChemicalPairOutput) -// return "Removing " + description + " Recipe for : " + ((ChemicalPairOutput) recipe).leftGas.getGas().getLocalizedName(); -// else if (recipe instanceof ChanceOutput) -// return "Removing " + description + " Recipe for : " + ((ChanceOutput) recipe).primaryOutput.getDisplayName(); -// else if (recipe instanceof GasStack) -// return "Removing " + description + " Recipe for : " + ((GasStack) recipe).getGas().getLocalizedName(); -// else if (recipe instanceof PressurizedOutput) -// return "Removing " + description + " Recipe for : " + ((PressurizedOutput) recipe).getItemOutput().getDisplayName(); -// else if (recipe instanceof InfusionInput) -// return "Removing " + description + " Recipe for : " + ((InfusionInput) recipe).inputStack.getDisplayName(); -// else -// return super.getRecipeInfo(); -// } -// return ""; -// } -//} +package modtweaker2.mods.mekanism.util; + +import java.util.Map; + +import mekanism.api.gas.GasStack; +import mekanism.common.recipe.inputs.ChemicalPairInput; +import mekanism.common.recipe.inputs.InfusionInput; +import mekanism.common.recipe.machines.PressurizedRecipe; +import mekanism.common.recipe.outputs.ChanceOutput; +import mekanism.common.recipe.outputs.ChemicalPairOutput; +import mekanism.common.recipe.outputs.PressurizedOutput; +import modtweaker2.mods.mekanism.Mekanism; +import modtweaker2.utils.BaseMapAddition; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public class AddMekanismRecipe extends BaseMapAddition { + public AddMekanismRecipe(String str, Map map, Object key, Object recipe) { + super(str.toLowerCase(), map, key, recipe); + } + + @Override + public String describe() { + if (Mekanism.v7) { + if (recipe instanceof ItemStack) + return "Adding " + description + " Recipe for : " + ((ItemStack) recipe).getDisplayName(); + else if (recipe instanceof FluidStack) + return "Adding " + description + " Recipe for : " + ((FluidStack) recipe).getFluid().getLocalizedName(); + else if (recipe instanceof ChemicalPairInput) + return "Adding " + description + " Recipe for : " + ((ChemicalPairInput) recipe).leftGas.getGas().getLocalizedName(); + else if (recipe instanceof ChanceOutput) + return "Adding " + description + " Recipe for : " + ((ChanceOutput) recipe).primaryOutput.getDisplayName(); + else if (recipe instanceof GasStack) + return "Adding " + description + " Recipe for : " + ((GasStack) recipe).getGas().getLocalizedName(); + else if (recipe instanceof PressurizedRecipe) + return "Adding " + description + " Recipe for : " + ((PressurizedRecipe) recipe).getOutput().getItemOutput().getDisplayName(); + else if (recipe instanceof InfusionInput) + return "Adding " + description + " Recipe for : " + ((InfusionInput) recipe).inputStack.getDisplayName(); + else + return super.getRecipeInfo(); + } + return ""; + } + + @Override + public String describeUndo() { + if (Mekanism.isV7()) { + if (recipe instanceof ItemStack) + return "Removing " + description + " Recipe for : " + ((ItemStack) recipe).getDisplayName(); + else if (recipe instanceof FluidStack) + return "Removing " + description + " Recipe for : " + ((FluidStack) recipe).getFluid().getLocalizedName(); + else if (recipe instanceof ChemicalPairOutput) + return "Removing " + description + " Recipe for : " + ((ChemicalPairOutput) recipe).leftGas.getGas().getLocalizedName(); + else if (recipe instanceof ChanceOutput) + return "Removing " + description + " Recipe for : " + ((ChanceOutput) recipe).primaryOutput.getDisplayName(); + else if (recipe instanceof GasStack) + return "Removing " + description + " Recipe for : " + ((GasStack) recipe).getGas().getLocalizedName(); + else if (recipe instanceof PressurizedOutput) + return "Removing " + description + " Recipe for : " + ((PressurizedOutput) recipe).getItemOutput().getDisplayName(); + else if (recipe instanceof InfusionInput) + return "Removing " + description + " Recipe for : " + ((InfusionInput) recipe).inputStack.getDisplayName(); + else + return super.getRecipeInfo(); + } + return ""; + } +} diff --git a/src/main/java/modtweaker2/mods/mekanism/util/RemoveMekanismRecipe.java b/src/main/java/modtweaker2/mods/mekanism/util/RemoveMekanismRecipe.java index 9e412c7..7b83eb3 100644 --- a/src/main/java/modtweaker2/mods/mekanism/util/RemoveMekanismRecipe.java +++ b/src/main/java/modtweaker2/mods/mekanism/util/RemoveMekanismRecipe.java @@ -1,150 +1,150 @@ -//package modtweaker2.mods.mekanism.util; -// -//import static modtweaker2.helpers.StackHelper.areEqual; -// -//import java.util.Iterator; -//import java.util.Map; -// -//import mekanism.api.gas.GasStack; -//import mekanism.common.recipe.inputs.InfusionInput; -//import mekanism.common.recipe.inputs.PressurizedInput; -//import mekanism.common.recipe.machines.PressurizedRecipe; -//import mekanism.common.recipe.outputs.ChanceOutput; -//import mekanism.common.recipe.outputs.ChemicalPairOutput; -//import mekanism.common.recipe.outputs.PressurizedOutput; -//import modtweaker2.utils.BaseMapRemoval; -//import net.minecraft.item.ItemStack; -//import net.minecraftforge.fluids.FluidStack; -// -//public class RemoveMekanismRecipe extends BaseMapRemoval { -// private Object tmp; -// -// public RemoveMekanismRecipe(String string, Map map, Object key) { -// super(string.toLowerCase().replace('_', ' '), map, key, null); -// this.tmp = key; -// } -// -// @Override -// public void apply() { -// try { -// Iterator it = map.entrySet().iterator(); -// -// while (it.hasNext()) { -// Map.Entry pairs = (Map.Entry) it.next(); -// if (pairs != null) { -// Object value = pairs.getValue(); -// if (value != null && tmp != null) { -// if (tmp instanceof ItemStack && value instanceof ItemStack) { -// if (areEqual(((ItemStack) tmp), (ItemStack) value)) { -// key = pairs.getKey(); -// break; -// } -// } -// -// if (tmp instanceof FluidStack && value instanceof FluidStack) { -// if (((FluidStack) tmp).isFluidEqual((FluidStack) value)) { -// key = pairs.getKey(); -// break; -// } -// } -// -// if (tmp instanceof GasStack && value instanceof GasStack) { -// if (((GasStack) tmp).isGasEqual((GasStack) value)) { -// key = pairs.getKey(); -// break; -// } -// } -// -// if (tmp instanceof ItemStack && value instanceof InfusionInput) { -// if (areEqual(((ItemStack) tmp), ((InfusionInput) value).inputStack)) { -// key = pairs.getKey(); -// break; -// } -// } -// -// if (tmp instanceof ChemicalPairOutput && value instanceof ChemicalPairOutput) { -// ChemicalPairOutput par1 = (ChemicalPairOutput) tmp; -// ChemicalPairOutput par2 = (ChemicalPairOutput) value; -// if (par1.leftGas.isGasEqual(par2.leftGas) && par1.rightGas.isGasEqual(par2.rightGas)) { -// key = pairs.getKey(); -// break; -// } -// } -// -// if (tmp instanceof ChanceOutput && value instanceof ChanceOutput) { -// ChanceOutput par1 = (ChanceOutput) tmp; -// ChanceOutput par2 = (ChanceOutput) value; -// if (areEqual(par1.primaryOutput, par2.primaryOutput)) { -// if (par1.secondaryOutput == null || (par1.secondaryOutput != null && par2.secondaryOutput != null && areEqual(par1.secondaryOutput, par2.secondaryOutput))) { -// key = pairs.getKey(); -// break; -// } -// } -// } -// -// if (tmp instanceof PressurizedOutput && value instanceof PressurizedRecipe) { -// PressurizedOutput par1 = (PressurizedOutput) tmp; -// PressurizedOutput par2 = ((PressurizedRecipe) value).recipeOutput; -// if (areEqual(par1.getItemOutput(), (par2.getItemOutput()))) { -// if (par1.getGasOutput().isGasEqual(par2.getGasOutput())) { -// key = pairs.getKey(); -// break; -// -// } -// } -// } -// } -// -// it.remove(); -// } -// } -// -// recipe = map.get(key); -// -// } catch (Exception e) { -// e.printStackTrace(); -// } -// -// map.remove(key); -// } -// -// @Override -// public String describe() { -// if (tmp instanceof ItemStack) -// return "Removing " + description + " Recipe for : " + ((ItemStack) tmp).getDisplayName(); -// else if (tmp instanceof FluidStack) -// return "Removing " + description + " Recipe for : " + ((FluidStack) tmp).getFluid().getLocalizedName(); -// else if (tmp instanceof ChemicalPairOutput) -// return "Removing " + description + " Recipe for : " + ((ChemicalPairOutput) tmp).leftGas.getGas().getLocalizedName(); -// else if (tmp instanceof ChanceOutput) -// return "Removing " + description + " Recipe for : " + ((ChanceOutput) tmp).primaryOutput.getDisplayName(); -// else if (tmp instanceof GasStack) -// return "Removing " + description + " Recipe for : " + ((GasStack) tmp).getGas().getLocalizedName(); -// else if (tmp instanceof PressurizedInput) -// return "Removing " + description + " Recipe for : " + ((PressurizedInput) tmp).getSolid().getDisplayName(); -// else if (tmp instanceof InfusionInput) -// return "Removing " + description + " Recipe for : " + ((InfusionInput) tmp).inputStack.getDisplayName(); -// else -// return super.getRecipeInfo(); -// } -// -// @Override -// public String describeUndo() { -// if (tmp instanceof ItemStack) -// return "Restoring " + description + " Recipe for : " + ((ItemStack) tmp).getDisplayName(); -// else if (tmp instanceof FluidStack) -// return "Restoring " + description + " Recipe for : " + ((FluidStack) tmp).getFluid().getLocalizedName(); -// else if (tmp instanceof ChemicalPairOutput) -// return "Restoring " + description + " Recipe for : " + ((ChemicalPairOutput) tmp).leftGas.getGas().getLocalizedName(); -// else if (tmp instanceof ChanceOutput) -// return "Restoring " + description + " Recipe for : " + ((ChanceOutput) tmp).primaryOutput.getDisplayName(); -// else if (tmp instanceof GasStack) -// return "Restoring " + description + " Recipe for : " + ((GasStack) tmp).getGas().getLocalizedName(); -// else if (tmp instanceof PressurizedInput) -// return "Restoring " + description + " Recipe for : " + ((PressurizedInput) tmp).getSolid().getDisplayName(); -// else if (tmp instanceof InfusionInput) -// return "Restoring " + description + " Recipe for : " + ((InfusionInput) tmp).inputStack.getDisplayName(); -// else -// return super.getRecipeInfo(); -// } -//} +package modtweaker2.mods.mekanism.util; + +import static modtweaker2.helpers.StackHelper.areEqual; + +import java.util.Iterator; +import java.util.Map; + +import mekanism.api.gas.GasStack; +import mekanism.common.recipe.inputs.InfusionInput; +import mekanism.common.recipe.inputs.PressurizedInput; +import mekanism.common.recipe.machines.PressurizedRecipe; +import mekanism.common.recipe.outputs.ChanceOutput; +import mekanism.common.recipe.outputs.ChemicalPairOutput; +import mekanism.common.recipe.outputs.PressurizedOutput; +import modtweaker2.utils.BaseMapRemoval; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public class RemoveMekanismRecipe extends BaseMapRemoval { + private Object tmp; + + public RemoveMekanismRecipe(String string, Map map, Object key) { + super(string.toLowerCase().replace('_', ' '), map, key, null); + this.tmp = key; + } + + @Override + public void apply() { + try { + Iterator it = map.entrySet().iterator(); + + while (it.hasNext()) { + Map.Entry pairs = (Map.Entry) it.next(); + if (pairs != null) { + Object value = pairs.getValue(); + if (value != null && tmp != null) { + if (tmp instanceof ItemStack && value instanceof ItemStack) { + if (areEqual(((ItemStack) tmp), (ItemStack) value)) { + key = pairs.getKey(); + break; + } + } + + if (tmp instanceof FluidStack && value instanceof FluidStack) { + if (((FluidStack) tmp).isFluidEqual((FluidStack) value)) { + key = pairs.getKey(); + break; + } + } + + if (tmp instanceof GasStack && value instanceof GasStack) { + if (((GasStack) tmp).isGasEqual((GasStack) value)) { + key = pairs.getKey(); + break; + } + } + + if (tmp instanceof ItemStack && value instanceof InfusionInput) { + if (areEqual(((ItemStack) tmp), ((InfusionInput) value).inputStack)) { + key = pairs.getKey(); + break; + } + } + + if (tmp instanceof ChemicalPairOutput && value instanceof ChemicalPairOutput) { + ChemicalPairOutput par1 = (ChemicalPairOutput) tmp; + ChemicalPairOutput par2 = (ChemicalPairOutput) value; + if (par1.leftGas.isGasEqual(par2.leftGas) && par1.rightGas.isGasEqual(par2.rightGas)) { + key = pairs.getKey(); + break; + } + } + + if (tmp instanceof ChanceOutput && value instanceof ChanceOutput) { + ChanceOutput par1 = (ChanceOutput) tmp; + ChanceOutput par2 = (ChanceOutput) value; + if (areEqual(par1.primaryOutput, par2.primaryOutput)) { + if (par1.secondaryOutput == null || (par1.secondaryOutput != null && par2.secondaryOutput != null && areEqual(par1.secondaryOutput, par2.secondaryOutput))) { + key = pairs.getKey(); + break; + } + } + } + + if (tmp instanceof PressurizedOutput && value instanceof PressurizedRecipe) { + PressurizedOutput par1 = (PressurizedOutput) tmp; + PressurizedOutput par2 = ((PressurizedRecipe) value).recipeOutput; + if (areEqual(par1.getItemOutput(), (par2.getItemOutput()))) { + if (par1.getGasOutput().isGasEqual(par2.getGasOutput())) { + key = pairs.getKey(); + break; + + } + } + } + } + + it.remove(); + } + } + + recipe = map.get(key); + + } catch (Exception e) { + e.printStackTrace(); + } + + map.remove(key); + } + + @Override + public String describe() { + if (tmp instanceof ItemStack) + return "Removing " + description + " Recipe for : " + ((ItemStack) tmp).getDisplayName(); + else if (tmp instanceof FluidStack) + return "Removing " + description + " Recipe for : " + ((FluidStack) tmp).getFluid().getLocalizedName(); + else if (tmp instanceof ChemicalPairOutput) + return "Removing " + description + " Recipe for : " + ((ChemicalPairOutput) tmp).leftGas.getGas().getLocalizedName(); + else if (tmp instanceof ChanceOutput) + return "Removing " + description + " Recipe for : " + ((ChanceOutput) tmp).primaryOutput.getDisplayName(); + else if (tmp instanceof GasStack) + return "Removing " + description + " Recipe for : " + ((GasStack) tmp).getGas().getLocalizedName(); + else if (tmp instanceof PressurizedInput) + return "Removing " + description + " Recipe for : " + ((PressurizedInput) tmp).getSolid().getDisplayName(); + else if (tmp instanceof InfusionInput) + return "Removing " + description + " Recipe for : " + ((InfusionInput) tmp).inputStack.getDisplayName(); + else + return super.getRecipeInfo(); + } + + @Override + public String describeUndo() { + if (tmp instanceof ItemStack) + return "Restoring " + description + " Recipe for : " + ((ItemStack) tmp).getDisplayName(); + else if (tmp instanceof FluidStack) + return "Restoring " + description + " Recipe for : " + ((FluidStack) tmp).getFluid().getLocalizedName(); + else if (tmp instanceof ChemicalPairOutput) + return "Restoring " + description + " Recipe for : " + ((ChemicalPairOutput) tmp).leftGas.getGas().getLocalizedName(); + else if (tmp instanceof ChanceOutput) + return "Restoring " + description + " Recipe for : " + ((ChanceOutput) tmp).primaryOutput.getDisplayName(); + else if (tmp instanceof GasStack) + return "Restoring " + description + " Recipe for : " + ((GasStack) tmp).getGas().getLocalizedName(); + else if (tmp instanceof PressurizedInput) + return "Restoring " + description + " Recipe for : " + ((PressurizedInput) tmp).getSolid().getDisplayName(); + else if (tmp instanceof InfusionInput) + return "Restoring " + description + " Recipe for : " + ((InfusionInput) tmp).inputStack.getDisplayName(); + else + return super.getRecipeInfo(); + } +}