|
6 | 6 | import io.redspace.ironsspellbooks.api.util.Utils;
|
7 | 7 | import io.redspace.ironsspellbooks.capabilities.magic.UpgradeData;
|
8 | 8 | import io.redspace.ironsspellbooks.item.UpgradeOrbItem;
|
| 9 | +import io.redspace.ironsspellbooks.registries.CreativeTabRegistry; |
9 | 10 | import io.redspace.ironsspellbooks.registries.ItemRegistry;
|
10 | 11 | import io.redspace.ironsspellbooks.util.UpgradeUtils;
|
11 | 12 | import mezz.jei.api.recipe.vanilla.IVanillaRecipeFactory;
|
12 | 13 | import mezz.jei.api.runtime.IIngredientManager;
|
13 | 14 | import net.minecraft.core.Registry;
|
| 15 | +import net.minecraft.world.item.CreativeModeTabs; |
| 16 | +import net.minecraft.world.item.Item; |
14 | 17 | import net.minecraft.world.item.ItemStack;
|
15 | 18 | import net.minecraft.world.item.SwordItem;
|
16 | 19 | import net.minecraftforge.registries.ForgeRegistries;
|
@@ -50,20 +53,24 @@ private static Stream<ArcaneAnvilRecipe> getScrollRecipes(IVanillaRecipeFactory
|
50 | 53 | }
|
51 | 54 |
|
52 | 55 | private static Stream<ArcaneAnvilRecipe> getImbueRecipes(IVanillaRecipeFactory vanillaRecipeFactory, IIngredientManager ingredientManager) {
|
53 |
| - return ForgeRegistries.ITEMS.getValues().stream() |
54 |
| - .filter(item -> Utils.canImbue(new ItemStack(item)) && item.getItemCategory() != null) |
| 56 | + return getVisibleItems().stream() |
| 57 | + .filter(item -> Utils.canImbue(new ItemStack(item))) |
55 | 58 | .map(item -> new ArcaneAnvilRecipe(new ItemStack(item), (AbstractSpell) null));
|
56 | 59 | }
|
57 | 60 |
|
58 | 61 | private static Stream<ArcaneAnvilRecipe> getUpgradeRecipes(IVanillaRecipeFactory vanillaRecipeFactory, IIngredientManager ingredientManager) {
|
59 | 62 | return ForgeRegistries.ITEMS.getValues().stream()
|
60 | 63 | .filter(item -> item instanceof UpgradeOrbItem)
|
61 | 64 | .flatMap(upgradeOrb ->
|
62 |
| - ForgeRegistries.ITEMS.getValues().stream() |
63 |
| - .filter(item -> Utils.canBeUpgraded(new ItemStack(item)) && item.getItemCategory() != null) |
| 65 | + getVisibleItems().stream() |
| 66 | + .filter(item -> Utils.canBeUpgraded(new ItemStack(item))) |
64 | 67 | .map(item -> new ArcaneAnvilRecipe(new ItemStack(item), List.of(new ItemStack(upgradeOrb)))));
|
65 | 68 | }
|
66 | 69 |
|
| 70 | + public static List<Item> getVisibleItems() { |
| 71 | + return ForgeRegistries.ITEMS.getValues().stream().filter(item -> CreativeModeTabs.allTabs().stream().anyMatch(tab -> tab.contains(new ItemStack(item)))).toList(); |
| 72 | + } |
| 73 | + |
67 | 74 | // private static ArcaneAnvilRecipe enumerateScrollCombinations(AbstractSpell spell) {
|
68 | 75 | // var scrollStack = new ItemStack(ItemRegistry.SCROLL.get());
|
69 | 76 | //
|
|
0 commit comments