mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-20 12:29:45 +00:00
Also changes like all packages inb4 "jared changes a package name in ModTweaker2 breaking compatability with everything" drama tweet.
This commit is contained in:
1 parent
4fd2551072
commit
ec562b62ea
187 files changed
+977
-991
No files matched your search
@@ -0,0 +1,74 @@
|
||||
package modtweaker2.mods.factorization.handlers;
|
||||
|
||||
import static modtweaker2.helpers.InputHelper.toStack;
|
||||
import static modtweaker2.helpers.StackHelper.areEqual;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
import modtweaker2.helpers.ReflectionHelper;
|
||||
import modtweaker2.mods.factorization.FactorizationHelper;
|
||||
import modtweaker2.util.BaseListAddition;
|
||||
import modtweaker2.util.BaseMultipleListRemoval;
|
||||
import modtweaker2.util.BaseMultipleListRemoval.Position;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import stanhebben.zenscript.annotations.ZenClass;
|
||||
import stanhebben.zenscript.annotations.ZenMethod;
|
||||
|
||||
@ZenClass("mods.factorization.SlagFurnace")
|
||||
public class SlagFurnace {
|
||||
@ZenMethod
|
||||
public static void addRecipe(IItemStack input, IItemStack output2, double chance2, IItemStack output1, double chance1) {
|
||||
Object recipe = FactorizationHelper.getSlagFurnaceRecipe(toStack(input), (float) chance1, toStack(output1), (float) chance2, toStack(output2));
|
||||
MineTweakerAPI.apply(new Add(toStack(input), recipe));
|
||||
}
|
||||
|
||||
private static class Add extends BaseListAddition {
|
||||
private final ItemStack input;
|
||||
|
||||
public Add(ItemStack input, Object recipe) {
|
||||
super("Slag Furnace", FactorizationHelper.slag, recipe);
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return input.getDisplayName();
|
||||
}
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ZenMethod
|
||||
public static void removeRecipe(IItemStack input) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(input), Position.ALL));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeFirst(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(output), Position.FIRST));
|
||||
}
|
||||
|
||||
@ZenMethod
|
||||
public static void removeLast(IItemStack output) {
|
||||
MineTweakerAPI.apply(new Remove(toStack(output), Position.LAST));
|
||||
}
|
||||
|
||||
private static class Remove extends BaseMultipleListRemoval {
|
||||
public Remove(ItemStack stack, Position pos) {
|
||||
super("Slag Furnace", FactorizationHelper.slag, stack, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEqual(Object recipe, Object search) {
|
||||
ItemStack input = (ItemStack) ReflectionHelper.getObject(recipe, "input");
|
||||
if (input != null && areEqual(input, (ItemStack) search)) {
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo() {
|
||||
return ((ItemStack) search).getDisplayName();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user