LootJS.modifiers((event) => {
    // 1. On vide la table de butin d'origine
    event.addLootTableModifier("floating_cargo:entities/box")
        .removeLoot(Ingredient.all);

    // 2. CAS GÉNÉRAL (99% de chance) : Tirage de 2 à 4 items
    event.addLootTableModifier("floating_cargo:entities/box")
        .not((n) => n.randomChance(0.01)) // Si ce n'est PAS la box ultra rare
        .addWeightedLoot([2, 4], [
            // CATEGORIE COMMUNE (Poids 50) - Inclus nouveaux drops image "pas très bon"
            LootEntry.of('bigfish:cooked_snark').withWeight(50),
            LootEntry.of('bigfish:cooked_monkfish').withWeight(50),
            LootEntry.of('oceanicrealms:cooked_mackerel_fish').withWeight(50),
            LootEntry.of('fishofthieves:cooked_ancient_scale').withWeight(50),
            LootEntry.of('aquaculture:algae').withWeight(50),
            LootEntry.of('oceanicrealms:red_algae').withWeight(50),
            LootEntry.of('minecraft:kelp').withWeight(50),
            LootEntry.of('abyssaria:pressure_kelp').withWeight(50),
            LootEntry.of('oceanicrealms:giant_kelp').withWeight(50),
            LootEntry.of('minecraft:mossy_cobblestone').withWeight(50),
            LootEntry.of('minecraft:cobblestone').withWeight(50),
            LootEntry.of('minecraft:stone').withWeight(50),
            LootEntry.of('minecraft:dirt').withWeight(50),
            LootEntry.of('minecraft:coarse_dirt').withWeight(50),
            LootEntry.of('minecraft:rooted_dirt').withWeight(50),
            LootEntry.of('minecraft:jungle_sapling').withWeight(50),
            LootEntry.of('minecraft:acacia_sapling').withWeight(50),
            LootEntry.of('minecraft:birch_sapling').withWeight(50),
            LootEntry.of('minecraft:spruce_sapling').withWeight(50),
            LootEntry.of('minecraft:sea_pickle').withWeight(50),
            LootEntry.of('farmersdelight:cabbage_seeds').withWeight(50),
            LootEntry.of('minecraft:pumpkin_seeds').withWeight(50),
            LootEntry.of('minecraft:wheat_seeds').withWeight(50),
            LootEntry.of('minecraft:raw_copper').withWeight(50),
            LootEntry.of('minecraft:iron_nugget').withWeight(50),
            LootEntry.of('minecraft:gold_nugget').withWeight(50),
            LootEntry.of('minecraft:charcoal').withWeight(50),
            // Nouveaux ajouts "pas très bon"
            LootEntry.of('minecraft:sand').withWeight(50),
            LootEntry.of('minecraft:gravel').withWeight(50),
            LootEntry.of('minecraft:clay_ball').withWeight(50),
            LootEntry.of('minecraft:stick').withWeight(50),
            LootEntry.of('minecraft:oak_planks').withWeight(50),

            // CATEGORIE RARE (Poids 40) - Inclus nouveaux drops image "bon"
            LootEntry.of('farmersdelight:kelp_roll_slice').withWeight(40),
            LootEntry.of('seadwellers:kelp_shearer').withWeight(40),
            LootEntry.of('minecraft:sweet_berries').withWeight(40),
            LootEntry.of('minecraft:glow_berries').withWeight(40),
            LootEntry.of('quark:blue_blossom_sapling').withWeight(40),
            LootEntry.of('minecraft:cherry_sapling').withWeight(40),
            LootEntry.of('minecraft:oak_sapling').withWeight(40),
            LootEntry.of('fishofthieves:pomegranate_seeds').withWeight(40),
            LootEntry.of('fishofthieves:pineapple_seeds').withWeight(40),
            LootEntry.of('culturaldelights:cucumber_seeds').withWeight(40),
            LootEntry.of('create_bic_bit:roasted_sunflower_seeds').withWeight(40),
            LootEntry.of('create_bic_bit:sunflower_seeds').withWeight(40),
            LootEntry.of('minecraft:beetroot_seeds').withWeight(40),
            LootEntry.of('minecraft:melon_seeds').withWeight(40),
            LootEntry.of('minecraft:raw_gold').withWeight(40),
            LootEntry.of('minecraft:raw_iron').withWeight(40),
            LootEntry.of('galosphere:raw_palladium').withWeight(40),
            LootEntry.of('minecraft:coal').withWeight(40),
            LootEntry.of('minecraft:string').withWeight(40),
            LootEntry.of('minecraft:bone').withWeight(40),
            LootEntry.of('minecraft:lapis_lazuli').withWeight(40),
            LootEntry.of('quark:egg_parrot_gray').withWeight(40),
            LootEntry.of('quark:egg_parrot_yellow_blue').withWeight(40),
            LootEntry.of('quark:egg_parrot_green').withWeight(40),
            LootEntry.of('quark:egg_parrot_blue').withWeight(40),
            // Nouveaux ajouts "bon"
            LootEntry.of('minecraft:iron_ingot').withWeight(40),
            LootEntry.of('minecraft:gold_ingot').withWeight(40),
            LootEntry.of('minecraft:copper_ingot').withWeight(40),
            LootEntry.of('minecraft:redstone').withWeight(40),
            LootEntry.of('minecraft:bucket').withWeight(40),
            LootEntry.of('minecraft:fishing_rod').withWeight(40),

            // CATEGORIE TRÈS RARE (Poids 10)
            LootEntry.of('minecraft:emerald').withWeight(10),
            LootEntry.of('minecraft:diamond').withWeight(10),
            LootEntry.of('minecraft:blaze_powder').withWeight(10),
            LootEntry.of(Item.of('minecraft:potion', '{Potion:"minecraft:long_water_breathing"}')).withWeight(10),
            LootEntry.of('minecraft:golden_carrot').withWeight(10),
            LootEntry.of('minecraft:milk_bucket').withWeight(10),
            LootEntry.of('minecraft:netherite_scrap').withWeight(10),
            LootEntry.of('expanded_combat:diamond_gauntlet').withWeight(10),
            LootEntry.of('expanded_combat:shield_1').withWeight(10),
            LootEntry.of('expanded_combat:iron_bow').withWeight(10),
            LootEntry.of('just_in_ocean:water_spirit_upgrade_smithing_template').withWeight(10),
            LootEntry.of('minecraft:amethyst_shard').withWeight(10),
            LootEntry.of('oceanvillagertrader:turtle_armor_leggings').withWeight(10),
            LootEntry.of('oceanvillagertrader:turtle_armor_chestplate').withWeight(10),
            LootEntry.of('tide:diamond_fishing_rod').withWeight(10),
            LootEntry.of('liden:midas_fishing_rod').withWeight(10),
            LootEntry.of('amendments:dragon_charge').withWeight(10),
            LootEntry.of('tide:aqua_scepter').withWeight(10),
            LootEntry.of('quark:pickarang').withWeight(10),
            LootEntry.of('minecraft:golden_apple').withWeight(10),
            LootEntry.of('minecraft:bamboo_block').withWeight(10),
            LootEntry.of('pirates:fire_cannonball').withWeight(10),
            LootEntry.of('minecraft:turtle_helmet').withWeight(10),
            LootEntry.of('minecraft:totem_of_undying').withWeight(10),
            LootEntry.of('galosphere:palladium_bomb').withWeight(10),
            LootEntry.of('tide:golden_hook').withWeight(10),
            LootEntry.of('expanded_combat:soul_gauntlet').withWeight(10)
        ]);

    // 3. CAS ULTRA RARE (1% de chance) : Toujours 5 items de la liste "Trés Rare"
    event.addLootTableModifier("floating_cargo:entities/box")
        .randomChance(0.01)
        .addWeightedLoot([5, 5], [
            LootEntry.of('minecraft:emerald'),
            LootEntry.of('minecraft:diamond'),
            LootEntry.of('minecraft:blaze_powder'),
            LootEntry.of(Item.of('minecraft:potion', '{Potion:"minecraft:long_water_breathing"}')),
            LootEntry.of('minecraft:golden_carrot'),
            LootEntry.of('minecraft:milk_bucket'),
            LootEntry.of('minecraft:netherite_scrap'),
            LootEntry.of('expanded_combat:diamond_gauntlet'),
            LootEntry.of('expanded_combat:shield_1'),
            LootEntry.of('expanded_combat:iron_bow'),
            LootEntry.of('just_in_ocean:water_spirit_upgrade_smithing_template'),
            LootEntry.of('minecraft:amethyst_shard'),
            LootEntry.of('oceanvillagertrader:turtle_armor_leggings'),
            LootEntry.of('oceanvillagertrader:turtle_armor_chestplate'),
            LootEntry.of('tide:diamond_fishing_rod'),
            LootEntry.of('liden:midas_fishing_rod'),
            LootEntry.of('amendments:dragon_charge'),
            LootEntry.of('tide:aqua_scepter'),
            LootEntry.of('quark:pickarang'),
            LootEntry.of('minecraft:golden_apple'),
            LootEntry.of('minecraft:bamboo_block'),
            LootEntry.of('pirates:fire_cannonball'),
            LootEntry.of('minecraft:turtle_helmet'),
            LootEntry.of('minecraft:totem_of_undying'),
            LootEntry.of('galosphere:palladium_bomb'),
            LootEntry.of('tide:golden_hook'),
            LootEntry.of('expanded_combat:soul_gauntlet')
        ]);
});