const ENCHANT_BLACKLIST = [
    "minecraft:binding_curse", "minecraft:loyalty", "minecraft:mending",
    "minecraft:unbreaking", "minecraft:vanishing_curse", "minecraft:smite",
    "minecraft:bane_of_arthropods", "minecraft:aqua_affinity", "minecraft:depth_strider",
    "minecraft:respiration", "minecraft:sweeping", "enchancement:slide",
    "enchancement:perception", "enchancement:buoy", "enchancement:berserk",
    "enchancement:molten", "enchancement:lumberjack", "enchancement:bury",
    "enchancement:scooping", "enchancement:grapple", "enchancement:extracting",
    "enchancement:assimilation", "enchancement:frostbite", "majruszsenchantments:breaking_curse",
    "majruszsenchantments:corrosion_curse", "majruszsenchantments:fatigue_curse",
    "majruszsenchantments:incompatibility_curse", "majruszsenchantments:slippery_curse",
    "majruszsenchantments:gold_fuelled", "majruszsenchantments:fuse_cutter",
    "majruszsenchantments:harvester", "majruszsenchantments:immortality",
    "majruszsenchantments:leech", "majruszsenchantments:misanthropy",
    "majruszsenchantments:smelter", "majruszsenchantments:telekinesis",
    "majruszsenchantments:magic_protection", "grapplemod:doublejumpenchantment",
    "grapplemod:wallrunenchantment", "grapplemod:slidingenchantment",
    "spectrum:indestructible", "spectrum:autosmelt", "minecraft:feather_falling", "origins:water_protection"
];

LootJS.modifiers((event) => {
    // 1. REMOVALS
    event.addLootTypeModifier([LootType.CHEST, LootType.ENTITY])
        .removeLoot([
            /minecraft:(iron|golden|diamond|netherite|chainmail)_(helmet|chestplate|leggings|boots)/,
            /minecraft:(wooden|golden)_(sword|shovel|pickaxe|hoe|axe)/,
            "minecraft:shield",
            /soulsweapons:(arkenplate|enhanced_arkenplate|withered_chest|enhanced_withered_chest|chaos_helmet|soul_ingot|soul_robes|forlorn).*/,
            /justhammers:.*_hammer/, /justhammers:.*_core/,
            /endrem:(witch_pupil|undead_soul|black_eye|old_eye|rogue_eye|witch_eye)/,
            /artifacts:(everlasting_beef|eternal_steak|pickaxe_heater|rooted_boots|universal_attractor)/,
            "archers:golden_spear", "farmersdelight:golden_knife", "forcemaster_rpg:golden_knuckle",
            "jewelry:gold_ring", "paladins:golden_claymore", "paladins:golden_great_hammer"
        ]);

    // 2. ENCHANTMENT STRIPPING (NBT Method)
    event.addLootTypeModifier([LootType.CHEST, LootType.ENTITY])
        .modifyLoot(Ingredient.all, (itemStack) => {
            // If the item isn't enchanted, don't waste time
            if (!itemStack.enchanted) return itemStack;

            // Iterate through the blacklist and strip them
            ENCHANT_BLACKLIST.forEach((enchantId) => {
                itemStack.removeEnchantment(enchantId);
            });

            // Specific Fix for Enchanted Books
            if (itemStack.id === 'minecraft:enchanted_book') {
                // If we stripped all enchants and the book is now "empty", delete it
                if (itemStack.enchantments.size() === 0) {
                    return Item.empty;
                }
            }

            return itemStack;
        });
});