diff --git a/src/main/java/techreborn/compat/crafttweaker/CTFusionReactor.java b/src/main/java/techreborn/compat/crafttweaker/CTFusionReactor.java index 3ba57af25..a56846d69 100644 --- a/src/main/java/techreborn/compat/crafttweaker/CTFusionReactor.java +++ b/src/main/java/techreborn/compat/crafttweaker/CTFusionReactor.java @@ -35,7 +35,6 @@ import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.reactor.FusionReactorRecipe; import techreborn.api.reactor.FusionReactorRecipeHelper; - import java.util.ArrayList; import java.util.List; @@ -55,9 +54,19 @@ public class CTFusionReactor { @ZenMethod public static void removeBottomInputRecipe(IIngredient iIngredient) { - CraftTweakerAPI.apply(new RemoveTopInput(iIngredient)); + CraftTweakerAPI.apply(new RemoveBottomInput(iIngredient)); } + @ZenMethod + public static void removeRecipe(IItemStack output) { + CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output))); + } + + @ZenMethod + public static void removeAll() { + CraftTweakerAPI.apply(new RemoveAll()); + } + private static class Add implements IAction { private final FusionReactorRecipe recipe; @@ -76,11 +85,6 @@ public class CTFusionReactor { } } - @ZenMethod - public static void removeRecipe(IItemStack output) { - CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output))); - } - private static class Remove implements IAction { private final ItemStack output; List removedRecipes = new ArrayList(); @@ -97,7 +101,6 @@ public class CTFusionReactor { FusionReactorRecipeHelper.reactorRecipes.remove(recipeType); break; } - } } @@ -133,7 +136,6 @@ public class CTFusionReactor { } } - @SuppressWarnings("unused") private static class RemoveBottomInput implements IAction { private final IIngredient output; List removedRecipes = new ArrayList(); @@ -158,4 +160,17 @@ public class CTFusionReactor { return "Removing Fusion Reactor recipe"; } } + + private static class RemoveAll implements IAction { + + @Override + public void apply() { + FusionReactorRecipeHelper.reactorRecipes.clear(); + } + + @Override + public String describe() { + return "Removing all Fusion Reactor recipes"; + } + } } diff --git a/src/main/java/techreborn/compat/crafttweaker/CTRollingMachine.java b/src/main/java/techreborn/compat/crafttweaker/CTRollingMachine.java index 3e3687956..da7b81928 100644 --- a/src/main/java/techreborn/compat/crafttweaker/CTRollingMachine.java +++ b/src/main/java/techreborn/compat/crafttweaker/CTRollingMachine.java @@ -24,6 +24,8 @@ package techreborn.compat.crafttweaker; +import crafttweaker.CraftTweakerAPI; +import crafttweaker.IAction; import crafttweaker.api.item.IIngredient; import crafttweaker.api.item.IItemStack; import gnu.trove.set.TCharSet; @@ -65,6 +67,24 @@ public class CTRollingMachine { RollingMachineRecipe.instance.getRecipeList().remove(resourceLocation); } } + + @ZenMethod + public static void removeAll() { + CraftTweakerAPI.apply(new RemoveAll()); + } + + private static class RemoveAll implements IAction{ + + @Override + public void apply() { + RollingMachineRecipe.instance.getRecipeList().clear(); + } + + @Override + public String describe() { + return "Removing all Rolling Machine recipes"; + } + } //Stolen from https://github.com/jaredlll08/MTLib/blob/1.12/src/main/java/com/blamejared/mtlib/helpers/InputHelper.java#L170-L213 //License as seen here: https://github.com/jaredlll08/MTLib/blob/1.12/LICENSE.md (MIT at time of writing) diff --git a/src/main/java/techreborn/compat/crafttweaker/CTScrapbox.java b/src/main/java/techreborn/compat/crafttweaker/CTScrapbox.java index b6b1fa8b5..16e659978 100644 --- a/src/main/java/techreborn/compat/crafttweaker/CTScrapbox.java +++ b/src/main/java/techreborn/compat/crafttweaker/CTScrapbox.java @@ -24,20 +24,15 @@ package techreborn.compat.crafttweaker; -import java.util.ArrayList; -import java.util.List; - import crafttweaker.CraftTweakerAPI; import crafttweaker.IAction; import crafttweaker.api.item.IIngredient; import crafttweaker.api.item.IItemStack; import crafttweaker.api.minecraft.CraftTweakerMC; -import reborncore.api.recipe.IBaseRecipeType; import reborncore.api.recipe.RecipeHandler; import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenMethod; import techreborn.api.Reference; -import techreborn.api.recipe.BaseRecipe; import techreborn.api.recipe.machines.ScrapboxRecipe; import techreborn.compat.crafttweaker.CTGeneric.Remove; @@ -58,8 +53,8 @@ public class CTScrapbox { } @ZenMethod - public static void removeAllRecipes() { - CraftTweakerAPI.apply(new RemoveAll(getMachineName())); + public static void removeAll() { + CraftTweakerAPI.apply(new RemoveAll()); } public static String getMachineName() { @@ -67,25 +62,15 @@ public class CTScrapbox { } public static class RemoveAll implements IAction { - List removedRecipes = new ArrayList(); - private final String name; - - public RemoveAll(String machineName) { - this.name = machineName; - } @Override public void apply() { - for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(name)) { - removedRecipes.add((BaseRecipe) recipeType); - RecipeHandler.recipeList.remove(recipeType); - } + RecipeHandler.recipeList.removeAll(RecipeHandler.getRecipeClassFromName(Reference.scrapboxRecipe)); } @Override public String describe() { - return "Removing all recipies for " + name; + return "Removing all Scrapbox recipies"; } - } }