LootJS.modifiers((event) => {
    // 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"
    ];

    // 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"
    ];

    // 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", "pointblank:javelin", "pointblank:at4", 
        "pointblank:m134minigun"
    ];

    const targets = event.addTableModifier([
        "spore:chests/equipment_chest",
        "lostcities:chests/lostcitychest",
        "lostcities:chests/raildungeonchest",
        "minecraft:chests/stronghold_corridor"
    ]);
            // 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))
        );
    });
});



