From 980c82e282425170d0adb214510419871e2c75ca Mon Sep 17 00:00:00 2001 From: WakelessSloth56 Date: Thu, 22 Feb 2024 11:06:56 +0800 Subject: [PATCH] fix(ench): fix efficacy category --- .../enchantment/impl/EfficacyEnchantment.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/EfficacyEnchantment.java b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/EfficacyEnchantment.java index 46cb22e..91c5676 100644 --- a/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/EfficacyEnchantment.java +++ b/src/main/java/org/auioc/mcmod/harmonicench/enchantment/impl/EfficacyEnchantment.java @@ -26,8 +26,8 @@ import net.minecraft.world.entity.projectile.Arrow; import net.minecraft.world.entity.projectile.FireworkRocketEntity; import net.minecraft.world.entity.projectile.SpectralArrow; +import net.minecraft.world.item.BowItem; import net.minecraft.world.item.CrossbowItem; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentCategory; @@ -55,10 +55,15 @@ */ public class EfficacyEnchantment extends HLEnchantment implements IProjectileEnchantment.TippedArrow, IProjectileEnchantment.SpectralArrow, IProjectileEnchantment.FireworkRocket { + private static final EnchantmentCategory PROJECTILE_WEAPON = EnchantmentCategory.create( + "PROJECTILE_WEAPON", + (item) -> item instanceof BowItem || item instanceof CrossbowItem + ); + public EfficacyEnchantment() { super( Enchantment.Rarity.RARE, - EnchantmentCategory.BOW, + PROJECTILE_WEAPON, EquipmentSlot.MAINHAND, 4, (o) -> o != Enchantments.POWER_ARROWS @@ -78,11 +83,6 @@ public int getMaxCost(int lvl) { return 50; } - @Override - public boolean canEnchant(ItemStack itemStack) { - return itemStack.getItem() instanceof CrossbowItem || super.canEnchant(itemStack); - } - @Override public void handleTippedArrow(int lvl, Arrow arrow, ITippedArrow potionArrow) { var effects = potionArrow.getEffects();