Skip to content

Commit

Permalink
Adding scrolls to the creative search
Browse files Browse the repository at this point in the history
  • Loading branch information
lab3 committed Jun 21, 2023
1 parent 619f901 commit 14b3a4c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 0 additions & 17 deletions src/main/java/io/redspace/ironsspellbooks/item/Scroll.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,6 @@ public Scroll() {
super(new Item.Properties().stacksTo(1).rarity(Rarity.UNCOMMON));
}

// @Override
// public void fillItemCategory(CreativeModeTab category, NonNullList<ItemStack> 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()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -19,6 +21,7 @@
import net.minecraftforge.registries.RegistryObject;
import software.bernie.geckolib.GeckoLib;

import java.util.Arrays;
import java.util.List;


Expand Down Expand Up @@ -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());
}

}
}

0 comments on commit 14b3a4c

Please sign in to comment.