mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-22 13:19:48 +00:00
Smeltery fix and various others
This commit is contained in:
1 parent
570e4f8607
commit
25feee0162
101 files changed
+2292
-1019
No files matched your search
@@ -3,6 +3,7 @@ package modtweaker2.mods.mekanism.handlers;
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.areEqual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -19,41 +20,44 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.mekanism.Infuser")
|
||||
public class Infuser {
|
||||
@ZenMethod
|
||||
public static void addRecipe(String type, int infuse, IItemStack input, IItemStack output) {
|
||||
InfusionInput infuseIn = new InfusionInput(InfuseRegistry.get(type), infuse, toStack(input));
|
||||
InfusionOutput infuseOut = new InfusionOutput(infuseIn, toStack(output));
|
||||
MineTweakerAPI.apply(new AddMekanismRecipe("METALLURGIC_INFUSER", Recipe.METALLURGIC_INFUSER.get(), infuseIn, infuseOut));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void addRecipe(String type, int infuse, IItemStack input, IItemStack output) {
|
||||
InfusionInput infuseIn = new InfusionInput(InfuseRegistry.get(type), infuse, toStack(input));
|
||||
InfusionOutput infuseOut = new InfusionOutput(infuseIn, toStack(output));
|
||||
MineTweakerAPI.apply(new AddMekanismRecipe("METALLURGIC_INFUSER", Recipe.METALLURGIC_INFUSER.get(), infuseIn, infuseOut));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove("METALLURGIC_INFUSER", Recipe.METALLURGIC_INFUSER.get(), new InfusionOutput(null, toStack(output))));
|
||||
}
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove("METALLURGIC_INFUSER", Recipe.METALLURGIC_INFUSER.get(), new InfusionOutput(null, toStack(output))));
|
||||
}
|
||||
|
||||
private static class Remove extends RemoveMekanismRecipe {
|
||||
public Remove(String string, Map map, Object key) {
|
||||
super(string, map, key);
|
||||
}
|
||||
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();
|
||||
InfusionInput key = (InfusionInput) pairs.getKey();
|
||||
InfusionOutput value = (InfusionOutput) pairs.getValue();
|
||||
if (key != null) {
|
||||
if (this.key instanceof InfusionOutput && areEqual(value.resource, ((InfusionOutput) this.key).resource)) {
|
||||
this.key = key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void apply() {
|
||||
ArrayList<InfusionInput> recipesToRemove = new ArrayList<InfusionInput>();
|
||||
Iterator it = map.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) it.next();
|
||||
InfusionInput key = (InfusionInput) pairs.getKey();
|
||||
InfusionOutput value = (InfusionOutput) pairs.getValue();
|
||||
if (key != null) {
|
||||
if (this.key instanceof InfusionOutput && areEqual(value.resource, ((InfusionOutput) this.key).resource)) {
|
||||
this.key = key;
|
||||
recipesToRemove.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
recipe = map.get(key);
|
||||
map.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (InfusionInput r : recipesToRemove) {
|
||||
map.remove(r);
|
||||
}
|
||||
recipe = map.get(key);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user