Skip to content

Commit

Permalink
fix(ench): fix efficacy category
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Feb 22, 2024
1 parent 59be4ce commit 980c82e
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down

0 comments on commit 980c82e

Please sign in to comment.