package net.minecraft.world.item.enchantment;

import net.minecraft.world.item.CrossbowItem;
import net.minecraft.world.level.block.CarvedPumpkinBlock;
import net.minecraft.world.level.block.AbstractSkullBlock;
import net.minecraft.world.item.ElytraItem;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.item.BowItem;
import net.minecraft.world.item.TridentItem;
import net.minecraft.world.item.FishingRodItem;
import net.minecraft.world.item.DiggerItem;
import net.minecraft.world.item.SwordItem;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorItem;
import net.minecraft.world.item.Item;

public enum EnchantmentCategory {
    ALL {
        @Override
        public boolean canEnchant(final Item bei) {
            for (final EnchantmentCategory bhy6 : EnchantmentCategory.values()) {
                if (bhy6 != EnchantmentCategory.ALL) {
                    if (bhy6.canEnchant(bei)) {
                        return true;
                    }
                }
            }
            return false;
        }
    }, 
    ARMOR {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei instanceof ArmorItem;
        }
    }, 
    ARMOR_FEET {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei instanceof ArmorItem && ((ArmorItem)bei).getSlot() == EquipmentSlot.FEET;
        }
    }, 
    ARMOR_LEGS {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei instanceof ArmorItem && ((ArmorItem)bei).getSlot() == EquipmentSlot.LEGS;
        }
    }, 
    ARMOR_CHEST {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei instanceof ArmorItem && ((ArmorItem)bei).getSlot() == EquipmentSlot.CHEST;
        }
    }, 
    ARMOR_HEAD {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei instanceof ArmorItem && ((ArmorItem)bei).getSlot() == EquipmentSlot.HEAD;
        }
    }, 
    WEAPON {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei instanceof SwordItem;
        }
    }, 
    DIGGER {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei instanceof DiggerItem;
        }
    }, 
    FISHING_ROD {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei instanceof FishingRodItem;
        }
    }, 
    TRIDENT {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei instanceof TridentItem;
        }
    }, 
    BREAKABLE {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei.canBeDepleted();
        }
    }, 
    BOW {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei instanceof BowItem;
        }
    }, 
    WEARABLE {
        @Override
        public boolean canEnchant(final Item bei) {
            final Block bph3 = Block.byItem(bei);
            return bei instanceof ArmorItem || bei instanceof ElytraItem || bph3 instanceof AbstractSkullBlock || bph3 instanceof CarvedPumpkinBlock;
        }
    }, 
    CROSSBOW {
        @Override
        public boolean canEnchant(final Item bei) {
            return bei instanceof CrossbowItem;
        }
    };
    
    public abstract boolean canEnchant(final Item bei);
}
