From 8d0231aa40e58676781be78cb1ed64d0fdd20af5 Mon Sep 17 00:00:00 2001 From: iron431 <34083081+iron431@users.noreply.github.com> Date: Tue, 16 Jul 2024 20:26:51 -0500 Subject: [PATCH 1/3] 3.3.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 0a8685f24..8fcc39247 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,7 +23,7 @@ mapping_version=2022.11.27-1.19.2 # Irons Mod mod_id=irons_spellbooks -mod_version=1.19.2-3.2.2 +mod_version=1.19.2-3.3.0 mod_group_id=io.redspace.ironsspellbooks # Irons mods.toml From 395a947c2702622c30731de2c90dfa50ab5c0dc7 Mon Sep 17 00:00:00 2001 From: iron431 <34083081+iron431@users.noreply.github.com> Date: Tue, 16 Jul 2024 20:56:03 -0500 Subject: [PATCH 2/3] Update LATEST_CHANGES.MD --- LATEST_CHANGES.MD | 3 +++ 1 file changed, 3 insertions(+) diff --git a/LATEST_CHANGES.MD b/LATEST_CHANGES.MD index 0b21d7b43..0779bd0d3 100644 --- a/LATEST_CHANGES.MD +++ b/LATEST_CHANGES.MD @@ -12,6 +12,9 @@ - Increased stack size to 64 - Upgrading scrolls now requires one ink per level, instead of a scroll of equal level - The rarity of the ink is equal to the rarity of the resulting scroll rarity + - Upgrade Orbs + - Spell Power Upgrade Orbs now give +5% power (previously +3%) + - Cooldown and Resistance Upgrade Orbs now give +5% Cooldown/Spell Resistance (Previously +6%) - Spellbooks - Spellbooks now give max mana - "High Tier" spellbooks (spellbooks with spell power buffs) now give +200 Max Mana From 6273849bb604de41adb5f2ed30fc4f14a45d7939 Mon Sep 17 00:00:00 2001 From: iron431 <34083081+iron431@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:44:04 -0500 Subject: [PATCH 3/3] significantly optimize iterations over item registry in arcane anvil recipe maker --- .../jei/ArcaneAnvilRecipeMaker.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/io/redspace/ironsspellbooks/jei/ArcaneAnvilRecipeMaker.java b/src/main/java/io/redspace/ironsspellbooks/jei/ArcaneAnvilRecipeMaker.java index b4f981074..c0a438acb 100644 --- a/src/main/java/io/redspace/ironsspellbooks/jei/ArcaneAnvilRecipeMaker.java +++ b/src/main/java/io/redspace/ironsspellbooks/jei/ArcaneAnvilRecipeMaker.java @@ -11,6 +11,7 @@ import mezz.jei.api.recipe.vanilla.IVanillaRecipeFactory; import mezz.jei.api.runtime.IIngredientManager; import net.minecraft.core.Registry; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.SwordItem; import net.minecraftforge.registries.ForgeRegistries; @@ -34,36 +35,40 @@ private ArcaneAnvilRecipeMaker() { } public static List getRecipes(IVanillaRecipeFactory vanillaRecipeFactory, IIngredientManager ingredientManager) { + var visibleItems = getVisibleItems(); return Stream.of( - getScrollRecipes(vanillaRecipeFactory, ingredientManager), - getImbueRecipes(vanillaRecipeFactory, ingredientManager), - getUpgradeRecipes(vanillaRecipeFactory, ingredientManager)) + getScrollRecipes(visibleItems), + getImbueRecipes(visibleItems), + getUpgradeRecipes(visibleItems)) .flatMap(x -> x) .toList(); } - private static Stream getScrollRecipes(IVanillaRecipeFactory vanillaRecipeFactory, IIngredientManager ingredientManager) { + private static Stream getScrollRecipes(List visibleItems) { return SpellRegistry.getEnabledSpells().stream() .sorted(Comparator.comparing(AbstractSpell::getSpellId)) .flatMap(spell -> IntStream.rangeClosed(spell.getMinLevel(), spell.getMaxLevel() - 1).mapToObj(i -> new ArcaneAnvilRecipe(spell, i))); /*.filter(ArcaneAnvilRecipe::isValid)*///Filter out any blank recipes created where min and max spell level are equal } - private static Stream getImbueRecipes(IVanillaRecipeFactory vanillaRecipeFactory, IIngredientManager ingredientManager) { - return ForgeRegistries.ITEMS.getValues().stream() - .filter(item -> Utils.canImbue(new ItemStack(item)) && item.getItemCategory() != null) + private static Stream getImbueRecipes(List visibleItems) { + return visibleItems.stream() + .filter(item -> Utils.canImbue(new ItemStack(item))) .map(item -> new ArcaneAnvilRecipe(new ItemStack(item), (AbstractSpell) null)); } - private static Stream getUpgradeRecipes(IVanillaRecipeFactory vanillaRecipeFactory, IIngredientManager ingredientManager) { + private static Stream getUpgradeRecipes(List visibleItems) { + var upgradable = visibleItems.stream().filter(item -> Utils.canBeUpgraded(new ItemStack(item))).toList(); 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) + .flatMap(upgradeOrb -> upgradable.stream() .map(item -> new ArcaneAnvilRecipe(new ItemStack(item), List.of(new ItemStack(upgradeOrb))))); } + public static List getVisibleItems() { + return ForgeRegistries.ITEMS.getValues().stream().filter(item -> item.getItemCategory() != null).toList(); + } + // private static ArcaneAnvilRecipe enumerateScrollCombinations(AbstractSpell spell) { // var scrollStack = new ItemStack(ItemRegistry.SCROLL.get()); //