Skip to content

Commit

Permalink
Update ArcaneAnvilRecipeMaker.java
Browse files Browse the repository at this point in the history
  • Loading branch information
iron431 committed Jul 5, 2024
1 parent 4435861 commit e423cdd
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -50,20 +53,24 @@ private static Stream<ArcaneAnvilRecipe> getScrollRecipes(IVanillaRecipeFactory
}

private static Stream<ArcaneAnvilRecipe> 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));
}

private static Stream<ArcaneAnvilRecipe> getUpgradeRecipes(IVanillaRecipeFactory vanillaRecipeFactory, IIngredientManager ingredientManager) {
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<Item> 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());
//
Expand Down

0 comments on commit e423cdd

Please sign in to comment.