From e423cdd18ca06fd0575938037fdc1757ebe5dc4b Mon Sep 17 00:00:00 2001 From: iron431 <34083081+iron431@users.noreply.github.com> Date: Thu, 4 Jul 2024 20:39:26 -0500 Subject: [PATCH] Update ArcaneAnvilRecipeMaker.java --- .../jei/ArcaneAnvilRecipeMaker.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/redspace/ironsspellbooks/jei/ArcaneAnvilRecipeMaker.java b/src/main/java/io/redspace/ironsspellbooks/jei/ArcaneAnvilRecipeMaker.java index 66f367825..021c406e8 100644 --- a/src/main/java/io/redspace/ironsspellbooks/jei/ArcaneAnvilRecipeMaker.java +++ b/src/main/java/io/redspace/ironsspellbooks/jei/ArcaneAnvilRecipeMaker.java @@ -6,11 +6,14 @@ import io.redspace.ironsspellbooks.api.util.Utils; import io.redspace.ironsspellbooks.capabilities.magic.UpgradeData; import io.redspace.ironsspellbooks.item.UpgradeOrbItem; +import io.redspace.ironsspellbooks.registries.CreativeTabRegistry; import io.redspace.ironsspellbooks.registries.ItemRegistry; import io.redspace.ironsspellbooks.util.UpgradeUtils; import mezz.jei.api.recipe.vanilla.IVanillaRecipeFactory; import mezz.jei.api.runtime.IIngredientManager; import net.minecraft.core.Registry; +import net.minecraft.world.item.CreativeModeTabs; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.SwordItem; import net.minecraftforge.registries.ForgeRegistries; @@ -50,8 +53,8 @@ private static Stream getScrollRecipes(IVanillaRecipeFactory } private static Stream getImbueRecipes(IVanillaRecipeFactory vanillaRecipeFactory, IIngredientManager ingredientManager) { - return ForgeRegistries.ITEMS.getValues().stream() - .filter(item -> Utils.canImbue(new ItemStack(item)) && item.getItemCategory() != null) + return getVisibleItems().stream() + .filter(item -> Utils.canImbue(new ItemStack(item))) .map(item -> new ArcaneAnvilRecipe(new ItemStack(item), (AbstractSpell) null)); } @@ -59,11 +62,15 @@ private static Stream getUpgradeRecipes(IVanillaRecipeFactory return ForgeRegistries.ITEMS.getValues().stream() .filter(item -> item instanceof UpgradeOrbItem) .flatMap(upgradeOrb -> - ForgeRegistries.ITEMS.getValues().stream() - .filter(item -> Utils.canBeUpgraded(new ItemStack(item)) && item.getItemCategory() != null) + getVisibleItems().stream() + .filter(item -> Utils.canBeUpgraded(new ItemStack(item))) .map(item -> new ArcaneAnvilRecipe(new ItemStack(item), List.of(new ItemStack(upgradeOrb))))); } + public static List getVisibleItems() { + return ForgeRegistries.ITEMS.getValues().stream().filter(item -> CreativeModeTabs.allTabs().stream().anyMatch(tab -> tab.contains(new ItemStack(item)))).toList(); + } + // private static ArcaneAnvilRecipe enumerateScrollCombinations(AbstractSpell spell) { // var scrollStack = new ItemStack(ItemRegistry.SCROLL.get()); //