From 14b3a4c8b8ba94272943b9ad2ffba3a514bb4368 Mon Sep 17 00:00:00 2001 From: Len Bucchino Date: Wed, 21 Jun 2023 00:00:29 -0500 Subject: [PATCH] Adding scrolls to the creative search --- build.gradle | 4 ++-- gradle.properties | 4 ++-- .../redspace/ironsspellbooks/item/Scroll.java | 17 ----------------- .../registries/CreativeTabRegistry.java | 16 +++++++++++++++- 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index c66a8697c..728f7220a 100644 --- a/build.gradle +++ b/build.gradle @@ -177,7 +177,7 @@ dependencies { // JEI ******************************************************************************************************** compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}") compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-forge-api:${jei_version}") - //runtimeOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-forge:${jei_version}") + runtimeOnly fg.deobf("mezz.jei:jei-${jei_mc_version}-forge:${jei_version}") // CURIOS ***************************************************************************************************** implementation fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api") @@ -229,7 +229,7 @@ def replaceProperties = [ loader_version_range: loader_version_range, mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, mod_authors : mod_authors, mod_description: mod_description, mod_credits: mod_credits, - mod_issue_tracker : mod_issue_tracker, mod_display_url: mod_display_url, mod_logo_file : mod_logo_file + mod_issue_tracker : mod_issue_tracker, mod_display_url: mod_display_url, mod_logo_file: mod_logo_file ] processResources { diff --git a/gradle.properties b/gradle.properties index e0db92445..c70704625 100644 --- a/gradle.properties +++ b/gradle.properties @@ -36,8 +36,8 @@ caelus_version=1.20-3.0.0.10 player_animator_version=1.0.2+1.19.4 tetra_version=289712:4414851 mutil_version=5.1.0 -jei_version=14.0.0.4 -jei_mc_version=1.20 +jei_version=15.1.0.19 +jei_mc_version=1.20.1 curios_version=5.2.0-beta.2+1.20 # General diff --git a/src/main/java/io/redspace/ironsspellbooks/item/Scroll.java b/src/main/java/io/redspace/ironsspellbooks/item/Scroll.java index ef7ca4226..9a5e0245a 100644 --- a/src/main/java/io/redspace/ironsspellbooks/item/Scroll.java +++ b/src/main/java/io/redspace/ironsspellbooks/item/Scroll.java @@ -32,23 +32,6 @@ public Scroll() { super(new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON)); } -// @Override -// public void fillItemCategory(CreativeModeTab category, NonNullList items) { -// if (/*category == SpellbookModCreativeTabs.SPELL_EQUIPMENT_TAB ||*/ category == CreativeModeTab.TAB_SEARCH) { -// Arrays.stream(SpellType.values()) -// .filter(spellType -> spellType != SpellType.NONE_SPELL && spellType.isEnabled()) -// .forEach(spellType -> { -// int min = category == SpellbookModCreativeTabs.SPELL_EQUIPMENT_TAB ? spellType.getMaxLevel() : spellType.getMinLevel(); -// -// for (int i = min; i <= spellType.getMaxLevel(); i++) { -// var itemstack = new ItemStack(ItemRegistry.SCROLL.get()); -// SpellData.setSpellData(itemstack, spellType, i); -// items.add(itemstack); -// } -// }); -// } -// } - protected void removeScrollAfterCast(ServerPlayer serverPlayer, ItemStack stack) { //irons_spellbooks.LOGGER.debug("removeScrollAfterCast {}", serverPlayer.getName().getString()); if (!serverPlayer.isCreative()) { diff --git a/src/main/java/io/redspace/ironsspellbooks/registries/CreativeTabRegistry.java b/src/main/java/io/redspace/ironsspellbooks/registries/CreativeTabRegistry.java index 77e99135f..392708b6a 100644 --- a/src/main/java/io/redspace/ironsspellbooks/registries/CreativeTabRegistry.java +++ b/src/main/java/io/redspace/ironsspellbooks/registries/CreativeTabRegistry.java @@ -1,6 +1,8 @@ package io.redspace.ironsspellbooks.registries; import io.redspace.ironsspellbooks.IronsSpellbooks; +import io.redspace.ironsspellbooks.capabilities.spell.SpellData; +import io.redspace.ironsspellbooks.spells.SpellType; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; @@ -19,6 +21,7 @@ import net.minecraftforge.registries.RegistryObject; import software.bernie.geckolib.GeckoLib; +import java.util.Arrays; import java.util.List; @@ -179,9 +182,20 @@ public static void fillCreativeTabs(final BuildCreativeModeTabContentsEvent even event.accept(ItemRegistry.ARMOR_PILE_BLOCK_ITEM.get()); } + if (event.getTab() == CreativeModeTabs.searchTab()) { + Arrays.stream(SpellType.values()) + .filter(spellType -> spellType != SpellType.NONE_SPELL && spellType.isEnabled()) + .forEach(spellType -> { + for (int i = spellType.getMinLevel(); i <= spellType.getMaxLevel(); i++) { + var itemstack = new ItemStack(ItemRegistry.SCROLL.get()); + SpellData.setSpellData(itemstack, spellType, i); + event.accept(itemstack); + } + }); + } + if (event.getTab() == BuiltInRegistries.CREATIVE_MODE_TAB.get(CreativeModeTabs.NATURAL_BLOCKS)) { event.accept(ItemRegistry.ARCANE_DEBRIS_BLOCK_ITEM.get()); } - } }