diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JustEnoughItems.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JustEnoughItems.java index bcbdb05d3..e66939881 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JustEnoughItems.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/jei/JustEnoughItems.java @@ -5,6 +5,9 @@ import com.cleanroommc.groovyscript.compat.mods.ModPropertyContainer; import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.registry.ReloadableRegistryManager; +import net.minecraft.item.crafting.IRecipe; +import net.minecraftforge.fml.common.registry.ForgeRegistries; public class JustEnoughItems extends ModPropertyContainer { @@ -23,6 +26,18 @@ public void hide(IIngredient ingredient) { } } + public void hide(IIngredient... ingredients) { + for (IIngredient ingredient : ingredients) { + hide(ingredient); + } + } + + public void hide(Iterable ingredients) { + for (IIngredient ingredient : ingredients) { + hide(ingredient); + } + } + public void removeAndHide(IIngredient ingredient) { if (IngredientHelper.isEmpty(ingredient)) { GroovyLog.msg("Error remove and hide items {}", ingredient) @@ -35,10 +50,64 @@ public void removeAndHide(IIngredient ingredient) { JeiPlugin.hideItem(ingredient.getMatchingStacks()); } + public void removeAndHide(IIngredient... ingredients) { + for (IIngredient ingredient : ingredients) { + if (IngredientHelper.isEmpty(ingredient)) { + GroovyLog.msg("Error remove and hide items {}", ingredient) + .add("Items must not be empty") + .error() + .post(); + return; + } + JeiPlugin.hideItem(ingredient.getMatchingStacks()); + } + for (IRecipe recipe : ForgeRegistries.RECIPES) { + if (recipe.getRegistryName() != null) { + for (IIngredient ingredient : ingredients) { + if (ingredient.test(recipe.getRecipeOutput())) { + ReloadableRegistryManager.removeRegistryEntry(ForgeRegistries.RECIPES, recipe.getRegistryName()); + break; + } + } + } + } + } + + public void removeAndHide(Iterable ingredients) { + for (IIngredient ingredient : ingredients) { + if (IngredientHelper.isEmpty(ingredient)) { + GroovyLog.msg("Error remove and hide items {}", ingredient) + .add("Items must not be empty") + .error() + .post(); + return; + } + JeiPlugin.hideItem(ingredient.getMatchingStacks()); + } + for (IRecipe recipe : ForgeRegistries.RECIPES) { + if (recipe.getRegistryName() != null) { + for (IIngredient ingredient : ingredients) { + if (ingredient.test(recipe.getRecipeOutput())) { + ReloadableRegistryManager.removeRegistryEntry(ForgeRegistries.RECIPES, recipe.getRegistryName()); + break; + } + } + } + } + } + public void yeet(IIngredient ingredient) { removeAndHide(ingredient); } + public void yeet(IIngredient... ingredients) { + removeAndHide(ingredients); + } + + public void yeet(Iterable ingredients) { + removeAndHide(ingredients); + } + public void hideCategory(String category) { if (category == null || category.isEmpty()) { GroovyLog.msg("Error hiding category")