Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -23,6 +26,18 @@ public void hide(IIngredient ingredient) {
}
}

public void hide(IIngredient... ingredients) {
for (IIngredient ingredient : ingredients) {
hide(ingredient);
}
}

public void hide(Iterable<IIngredient> ingredients) {
for (IIngredient ingredient : ingredients) {
hide(ingredient);
}
}

public void removeAndHide(IIngredient ingredient) {
if (IngredientHelper.isEmpty(ingredient)) {
GroovyLog.msg("Error remove and hide items {}", ingredient)
Expand All @@ -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<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 yeet(IIngredient ingredient) {
removeAndHide(ingredient);
}

public void yeet(IIngredient... ingredients) {
removeAndHide(ingredients);
}

public void yeet(Iterable<IIngredient> ingredients) {
removeAndHide(ingredients);
}

public void hideCategory(String category) {
if (category == null || category.isEmpty()) {
GroovyLog.msg("Error hiding category")
Expand Down