LootJS.modifiers(event => {
    const bannedEnchants = [
        "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"
    ];

    // We use modifyItems directly here, as it is safer for your build's item handling
    event.addLootTypeModifier([LootType.CHEST, LootType.ENTITY, LootType.FISHING])
        .modifyLoot(/.*/, (lootContext) => {
            // Safety check: ensure we are iterating over the correct loot object
            if (lootContext.addLoot) { 
                lootContext.forEachItem(itemStack => {
                    bannedEnchants.forEach(enchant => {
                        if (itemStack.hasEnchantment(enchant)) {
                            itemStack.removeEnchantment(enchant);
                        }
                    });
                });
            }
            return lootContext;
        });
});