LootJS.modifiers((event) => {

const removeTargets = event.addTableModifier([
    "minecraft:chests/ancient_city",
    "minecraft:chests/simple_dungeon",
    "minecraft:chests/stronghold_library",
    "minecraft:chests/stronghold_corridor",
    "minecraft:chests/desert_pyramid",
    "minecraft:chests/jungle_temple",
    "minecraft:chests/abandoned_mineshaft",
    "minecraft:chests/buried_treasure",
    "minecraft:chests/shipwreck_treasure",
    "minecraft:chests/ruined_portal"
]);

removeTargets.removeLoot(/superbwarfare:.*_ammo_box/);
removeTargets.removeLoot(/superbwarfare:.*_blueprint/);

    // 1. REGULAR AMMO (15% Chance, 5-15 count)
    const regularAmmo = [
        "pointblank:ammo9mm", "pointblank:ammo45acp", "pointblank:ammo46", 
        "pointblank:ammo357", "pointblank:ammo57", "pointblank:ammo545", 
        "pointblank:ammo556", "pointblank:ammo68", "pointblank:ammo762", 
        "pointblank:ammo762x51", "pointblank:ammo12gauge", "superbwarfare:handgun_ammo", "superbwarfare:shotgun_ammo", "superbwarfare:handgun_ammo", "superbwarfare:rifle_ammo"
    ];

    // 2. HEAVY AMMO (8% Chance, 1-5 count)
    const heavyAmmo = [
        "pointblank:ammo50ae", "pointblank:ammo338lapua", 
        "pointblank:ammo50bmg", "pointblank:ammolasercharge"
    ];

    // 3. EXPLOSIVES (5% Chance, 1-2 count)
    const explosives = [
        "pointblank:grenade", "pointblank:grenade40mm", "pointblank:grenade20mm", 
        "pointblank:smaw_rocket", "pointblank:at4_rocket", "pointblank:javelin_rocket", "superbwarfare:grenade_40mm"
    ];

    // 4. THE GUNS (1% Inhumanly Rare)
    const allGuns = [
        "pointblank:m1911a1", "pointblank:tti_viper", "pointblank:p30l", "pointblank:mk23", 
        "pointblank:glock17", "pointblank:glock18", "pointblank:m9", "pointblank:deserteagle", 
        "pointblank:rhino", "pointblank:m4a1", "pointblank:m4a1mod1", "pointblank:ar57", 
        "pointblank:ro635", "pointblank:star15", "pointblank:m4sopmodii", "pointblank:m16a1", 
        "pointblank:hk416", "pointblank:scarl", "pointblank:xm7", "pointblank:xm29", 
        "pointblank:g36c", "pointblank:g36k", "pointblank:sl8", "pointblank:mk14ebr", 
        "pointblank:uar10", "pointblank:ak47", "pointblank:ak74", "pointblank:ak12", 
        "pointblank:an94", "pointblank:aug", "pointblank:aughbar", "pointblank:mp5", 
        "pointblank:mp7", "pointblank:ump45", "pointblank:vector", "pointblank:p90", 
        "pointblank:tmp", "pointblank:m950", "pointblank:g41", "pointblank:g3", 
        "pointblank:wa2000", "pointblank:xm3", "pointblank:c14", "pointblank:l96a1", 
        "pointblank:ballista", "pointblank:gm6lynx", "pointblank:m590", "pointblank:m870", 
        "pointblank:spas12", "pointblank:m1014", "pointblank:aa12", "pointblank:citoricxs", 
        "pointblank:hs12", "pointblank:lamg", "pointblank:mk48", "pointblank:m249", 
        "pointblank:m32mgl", "pointblank:smaw", "superbwarfare:rpg", "pointblank:javelin",
        "pointblank:at4", "pointblank:m134minigun", "superbwarfare:ak_47", "superbwarfare:trachelium", "superbwarfare:hk_416", "superbwarfare:qbz_191", "superbwarfare:mk_14", "superbwarfare:svd", "superbwarfare:m_79", "superbwarfare:mosin_nagant", "superbwarfare:rpk", "superbwarfare:hunting_rifle", "superbwarfare:mp_5", "superbwarfare:vector", "superbwarfare:sks", "superbwarfare:glock_18", "superbwarfare:mp_443", "superbwarfare:m_1911", "superbwarfare:homemade_shotgun"
    ];

    const targets = event.addTableModifier([
        "spore:chests/equipment_chest",
        "big_lost_city:chests/tier_3",
        "big_lost_city:chests/tier_4"
    ]);
            // AMMO & EXPLOSIVES: Stay as they were
    regularAmmo.forEach(id => { targets.addLoot(LootEntry.of(id).limitCount(5, 15).when(c => c.randomChance(0.15))) });
    heavyAmmo.forEach(id => { targets.addLoot(LootEntry.of(id).limitCount(1, 5).when(c => c.randomChance(0.08))) });
    explosives.forEach(id => { targets.addLoot(LootEntry.of(id).limitCount(1, 2).when(c => c.randomChance(0.05))) });

    // GUNS: Picking a NEW random gun using standard JavaScript
    // This creates a "Pool" that rolls every time a chest is opened
    allGuns.forEach(id => {
        targets.addLoot(
            LootEntry.of(id)
                .when(c => c.randomChance(0.30 / allGuns.length))
        );
    });
});



