Skip to content

Commit

Permalink
Add enchanted staves to combat tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
Provismet committed Jan 2, 2024
1 parent 43baa52 commit 45154e2
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.provismet.AdditionalArmoury.registries;

import com.provismet.AdditionalArmoury.enchantments.staff.StaffEnchantment;
import com.provismet.AdditionalArmoury.items.DaggerItem;

import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
Expand All @@ -20,6 +21,19 @@ public static void register () {
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(content -> content.addAfter(Items.NETHERITE_SWORD, AAItems.DAGGERS.toArray(new DaggerItem[0])));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(content -> content.addAfter(Items.TRIDENT, AAItems.STAFF));

ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(content -> {
content.getContext().lookup().getOptionalWrapper(RegistryKeys.ENCHANTMENT).ifPresent(wrapper -> {
wrapper.streamEntries()
.filter(entry -> entry.value() instanceof StaffEnchantment)
.map(entry -> {
ItemStack stack = AAItems.STAFF.getDefaultStack();
stack.addEnchantment(entry.value(), 1);
return stack;
})
.forEach(stack -> content.add(stack));
});
});

ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(content -> {
content.getContext().lookup().getOptionalWrapper(RegistryKeys.POTION).ifPresent(wrapper -> {
AAItems.DAGGERS.forEach(dagger -> addPotions(content, wrapper, dagger, ItemGroup.StackVisibility.PARENT_AND_SEARCH_TABS));
Expand Down

0 comments on commit 45154e2

Please sign in to comment.