// Priority: 10
const FORBIDDEN_ITEMS = [
    "alexsmobs:ancient_dart", "alexsmobs:pigshoes", "minecraft:iron_helmet", "minecraft:iron_chestplate", "minecraft:iron_leggings", "minecraft:iron_boots",
    "minecraft:golden_helmet", "minecraft:golden_chestplate", "minecraft:golden_leggings", "minecraft:golden_boots",
    "minecraft:chainmail_helmet", "minecraft:chainmail_chestplate", "minecraft:chainmail_leggings", "minecraft:chainmail_boots",
    "minecraft:diamond_helmet", "minecraft:diamond_chestplate", "minecraft:diamond_leggings", "minecraft:diamond_boots",
    "minecraft:netherite_helmet", "minecraft:netherite_chestplate", "minecraft:netherite_leggings", "minecraft:netherite_boots",
    "minecraft:wooden_sword", "minecraft:wooden_shovel", "minecraft:wooden_pickaxe", "minecraft:wooden_axe", "minecraft:wooden_hoe",
    "minecraft:golden_sword", "minecraft:golden_shovel", "minecraft:golden_pickaxe", "minecraft:golden_axe", "minecraft:golden_hoe",
    "farmersdelight:flint_knife", "farmersdelight:golden_knife", "farmersdelight:diamond_knife", "farmersdelight:netherite_knife",
    "archers:golden_spear", "forcemaster_rpg:golden_knuckle", "paladins:golden_claymore", "paladins:golden_great_hammer",
    "soulsweapons:arkenplate", "soulsweapons:enhanced_arkenplate", "soulsweapons:withered_chest", "soulsweapons:enhanced_withered_chest",
    "soulsweapons:chaos_helmet", "soulsweapons:forlorn_helmet", "soulsweapons:forlorn_chestplate", "soulsweapons:forlorn_leggings",
    "soulsweapons:forlorn_boots", "soulsweapons:soul_ingot_helmet", "soulsweapons:soul_ingot_chestplate", "soulsweapons:soul_ingot_leggings",
    "soulsweapons:soul_robes_boots", "artifacts:everlasting_beef", "artifacts:eternal_steak", "artifacts:pickaxe_heater",
    "artifacts:rooted_boots", "artifacts:vampiric_glove", "endrem:witch_pupil", "endrem:undead_soul", "endrem:black_eye",
    "endrem:old_eye", "endrem:rogue_eye", "endrem:witch_eye", "artifacts:cross_necklace", "paladins:golden_kite_shield", 
    "rogues:golden_double_axe", "paladins:golden_mace", "rogues:golden_sickle", "rogues:golden_dagger", 
    "rogues:golden_glaive", "berserker_rpg:golden_berserker_axe", "minecraft:golden_horse_armor", "minecraft:shield", 
    "paladins:wooden_great_hammer", "forcemaster_rpg:wooden_knuckle", "minecraft:obsidian", "minecraft:turtle_helmet"
];

const REPLACEMENT_MAP = {
    "ancient_dart": "minecraft:iron_nugget",
    "pigshoes": "minecraft:iron_ingot",
    "turtle_helmet": "minecraft:scute",
    "netherite": "minecraft:netherite_scrap",
    "diamond": "minecraft:diamond",
    "golden": "minecraft:gold_ingot",
    "gold_": "minecraft:gold_ingot",
    "iron": "minecraft:iron_ingot",
    "chainmail": "minecraft:iron_ingot",
    "soul_ingot": "soulsweapons:soul_ingot",
    "soul_robes": "minecraft:phantom_membrane",
    "arkenplate": "soulsweapons:soul_ingot",
    "forlorn": "minecraft:crying_obsidian",
    "artifacts": "minecraft:diamond",
    "endrem": "minecraft:ender_eye",
    "obsidian": "minecraft:crying_obsidian"
};

LootJS.modifiers((event) => {
    event.addLootTypeModifier(LootType.CHEST, LootType.ENTITY)
        .replaceLoot(FORBIDDEN_ITEMS, (itemStack) => {
            let id = itemStack.getId();
            let replacementId = "minecraft:gold_nugget"; 

            for (let key in REPLACEMENT_MAP) {
                if (id.includes(key)) {
                    replacementId = REPLACEMENT_MAP[key];
                    break; 
                }
            }

            let count = Math.floor(Math.random() * 3) + 1;
            return Item.of(replacementId, count);
        });
});