Skip to content

Commit

Permalink
Added scroll creative tab
Browse files Browse the repository at this point in the history
  • Loading branch information
iron431 committed Jun 21, 2023
1 parent e25a995 commit 2bd3a05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ public static void register(IEventBus eventBus) {
.withTabsBefore(EQUIPMENT_TAB.getKey())
.build());

public static final RegistryObject<CreativeModeTab> SCROLLS_TAB = TABS.register("spellbook_scrolls", () -> CreativeModeTab.builder()
.title(Component.translatable("itemGroup." + IronsSpellbooks.MODID + ".spellbook_scrolls_tab"))
.icon(() -> new ItemStack(ItemRegistry.SCROLL.get()))
.withTabsBefore(MATERIALS_TAB.getKey())
.build());

@SubscribeEvent
public static void fillCreativeTabs(final BuildCreativeModeTabContentsEvent event) {
if (event.getTab() == BuiltInRegistries.CREATIVE_MODE_TAB.get(CreativeModeTabs.FUNCTIONAL_BLOCKS)) {
Expand All @@ -182,7 +188,7 @@ public static void fillCreativeTabs(final BuildCreativeModeTabContentsEvent even
event.accept(ItemRegistry.ARMOR_PILE_BLOCK_ITEM.get());
}

if (event.getTab() == CreativeModeTabs.searchTab()) {
if (event.getTab() == CreativeModeTabs.searchTab() || event.getTab() == SCROLLS_TAB.get()) {
Arrays.stream(SpellType.values())
.filter(spellType -> spellType != SpellType.NONE_SPELL && spellType.isEnabled())
.forEach(spellType -> {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/irons_spellbooks/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@

"itemGroup.irons_spellbooks.spell_materials_tab": "Iron's Spellbooks Materials",
"itemGroup.irons_spellbooks.spell_equipment_tab": "Iron's Spellbooks Equipment",
"itemGroup.irons_spellbooks.spellbook_scrolls_tab": "Iron's Spellbooks Scrolls",

"advancements.irons_spellbooks.root.title": "Iron's Spells 'n Spellbooks",
"advancements.irons_spellbooks.root.description": "There's more than meets the eye to this world...",
Expand Down

0 comments on commit 2bd3a05

Please sign in to comment.