let dungeon_chests_legendary = [
  /^betterdeserttemples:chests\/.*pharaoh.*/,
  /^bettertemples:chests\/.*treasure$/,
  /^betterstrongholds:chests\/.*treasure$/,
  "betteroceanmonuments:chests/upper_side_chamber",
  /^repurposed_structures:chests\/monuments\/.*/,
  "betterjungletemples:chests/treasure",
  "dungeoncrawl:chests/treasure",
  "dungeoncrawl:chests/secret_room",
  "dungeons_arise_seven_seas:chests/pirate_junk/pirate_junk_treasure",
  "dungeons_arise_seven_seas:chests/small_yacht/small_yacht_treasure",
  "dungeons_arise_seven_seas:chests/unicorn_galleon/unicorn_galleon_treasure",
  "dungeons_arise_seven_seas:chests/victory_frigate/victory_frigate_treasure",
  "dungeons_arise:chests/bandit_towers/bandit_towers_treasure",
  "dungeons_arise:chests/ceryneian_hind/ceryneian_hind_treasure",
  "dungeons_arise:chests/foundry/foundry_treasure",
  "dungeons_arise:chests/heavenly_challenger/heavenly_challenger_treasure",
  "dungeons_arise:chests/heavenly_conqueror/heavenly_conqueror_treasure",
  "dungeons_arise:chests/illager_corsair/illager_corsair_treasure",
  "dungeons_arise:chests/illager_fort/illager_fort_treasure",
  "dungeons_arise:chests/illager_windmill/illager_windmill_treasure",
  "dungeons_arise:chests/infested_temple/infested_temple_top_treasure",
  "dungeons_arise:chests/jungle_tree_house/jungle_tree_house_treasure",
  "dungeons_arise:chests/keep_kayra/keep_kayra_garden_treasure",
  "dungeons_arise:chests/keep_kayra/keep_kayra_library_treasure",
  "dungeons_arise:chests/keep_kayra/keep_kayra_treasure",
  "dungeons_arise:chests/mechanical_nest/mechanical_nest_treasure",
  "dungeons_arise:chests/mining_system/mining_system_treasure",
  "dungeons_arise:chests/mushroom_house/mushroom_house_treasure",
  "dungeons_arise:chests/mushroom_mines/mushroom_mines_treasure",
  "dungeons_arise:chests/mushroom_village/mushroom_village_treasure",
  "dungeons_arise:chests/plague_asylum/plague_asylum_treasure",
  "dungeons_arise:chests/scorched_mines/scorched_mines_treasure",
  "dungeons_arise:chests/shiraz_palace/shiraz_palace_treasure",
  "dungeons_arise:chests/small_blimp/small_blimp_treasure",
  "dungeons_arise:chests/thornborn_towers/thornborn_towers_top_treasure",
  "dungeons_arise:chests/typhon/typhon_treasure",
  "dungeons_arise:chests/undead_pirate_ship/undead_pirate_ship_treasure",
  "minecraft:chests/bastion_treasure",
  "minecraft:chests/buried_treasure",
  "minecraft:chests/end_city_treasure",
  "villagesandpillages:village_witch/house/attic_chest",
  "dungeons_arise:chests/greenwood_pub/greenwood_pub_normal",
  "repurposed_structures:chests/bastions/underground/treasure",
];

let dungeon_chests_rare = [
  "betterdungeons:spider_dungeon/chests/egg_room",
  "betterstrongholds:chests/trap",
  "betterdungeons:zombie_dungeon/chests/special",
  "betterstrongholds:chests/crypt",
  /^betterdeserttemples:chests\/.*statue$/,
  /^betterstrongholds:chests\/.*crypt$/,
  "dungeoncrawl:chests/stage_5",
  "dungeoncrawl:chests/stage_4",
  "dungeons_arise_seven_seas:chests/victory_frigate/victory_frigate_normal_lower",
  "dungeons_arise:chests/bandit_towers/bandit_towers_gardens",
  "dungeons_arise:chests/foundry/foundry_lava_pit",
  "dungeons_arise:chests/foundry/foundry_chains",
  "dungeons_arise:chests/greenwood_pub/greenwood_pub_barrels_normal",
  "dungeons_arise:chests/heavenly_challenger/heavenly_challenger_theater",
  "dungeons_arise:chests/heavenly_conqueror/heavenly_conqueror_normal",
  "dungeons_arise:chests/illager_campsite/illager_campsite_map",
  "dungeons_arise:chests/infested_temple/infested_temple_room_bookshelf",
  "dungeons_arise:chests/infested_temple/infested_temple_room_table",
  "dungeons_arise:chests/keep_kayra/keep_kayra_garden_normal",
  "dungeons_arise:chests/keep_kayra/keep_kayra_library_normal",
  "dungeons_arise:chests/mechanical_nest/mechanical_nest_equipment",
  "dungeons_arise:chests/plague_asylum/plague_asylum_cells",
  "dungeons_arise:chests/scorched_mines/scorched_mines_hub",
  "dungeons_arise:chests/shiraz_palace/shiraz_palace_elite",
  "dungeons_arise:chests/shiraz_palace/shiraz_palace_library",
  "dungeons_arise:chests/shiraz_palace/shiraz_palace_towers",
  "dungeons_arise:chests/thornborn_towers/thornborn_towers_top_rooms",
  "repurposed_structures:chests/ancient_cities/end_spawner_box",
  "repurposed_structures:chests/ancient_cities/nether_magma_box",
  "repurposed_structures:chests/ancient_cities/ocean_ice_box",
  "repurposed_structures:chests/bastions/underground/skeleton_horse_stable",
  /^repurposed_structures:chests\/fortresses\/.*/,
  /^repurposed_structures:chests\/pyramids\/.*/,
  /^repurposed_structures:chests\/temples\/.*/,
  /^repurposed_structures:trapped_chests\/pyramids\/.*/,
  /^structory_towers:top\/.*top$/,
];

let dungeon_chests_common = [
  "betterdungeons:skeleton_dungeon/chests/common",
  "betterdungeons:zombie_dungeon/chests/tombstone",
  "minecraft:chests/jungle_temple",
  "betterstrongholds:chests/grand_library",
  /^bettertemples:chests\/.*campsite$/,
  /^betterdeserttemples:chests\/(?!.*treasure)(?!.*statue).*$/,
  /^betterfortresses:.*chests\/.*/,
  /^betterstrongholds:chests\/(?!.*treasure)(?!.*crypt)(?!.*mess).*$/,
  "dungeoncrawl:chests/stage_3",
  "dungeons_arise_seven_seas:chests/victory_frigate/victory_frigate_normal_upper",
  "dungeons_arise_seven_seas:chests/corsair_corvette/corsair_corvette_normal",
  "dungeons_arise_seven_seas:chests/pirate_junk/pirate_junk_normal",
  "dungeons_arise_seven_seas:chests/small_yacht/small_yacht_normal",
  "dungeons_arise_seven_seas:chests/unicorn_galleon/unicorn_galleon_normal",
  "dungeons_arise:chests/abandoned_temple/abandoned_temple_top",
  "dungeons_arise:chests/abandoned_temple/abandoned_temple_map",
  "dungeons_arise:chests/bandit_towers/bandit_towers_rooms",
  "dungeons_arise:chests/bandit_village/bandit_village_normal",
  "dungeons_arise:chests/bandit_village/bandit_village_tents",
  "dungeons_arise:chests/aviary/aviary_normal",
  "dungeons_arise:chests/bathhouse/bathhouse_normal",
  "dungeons_arise:chests/bathhouse/bathhouse_barrels",
  "dungeons_arise:chests/foundry/foundry_passage_exterior",
  "dungeons_arise:chests/foundry/foundry_passage_normal",
  "dungeons_arise:chests/foundry/foundry_normal",
  "dungeons_arise:chests/heavenly_challenger/heavenly_challenger_normal",
  "dungeons_arise:chests/heavenly_conqueror/heavenly_conqueror_barrels",
  "dungeons_arise:chests/heavenly_rider/heavenly_rider_barrels",
  "dungeons_arise:chests/heavenly_rider/heavenly_rider_normal",
  "dungeons_arise:chests/illager_campsite/illager_campsite_tent",
  "dungeons_arise:chests/illager_corsair/illager_corsair_barrels",
  "dungeons_arise:chests/illager_fort/illager_fort_barrels",
  "dungeons_arise:chests/illager_fort/illager_fort_normal",
  "dungeons_arise:chests/illager_galley/illager_galley_barrels",
  "dungeons_arise:chests/illager_windmill/illager_windmill_barrels",
  "dungeons_arise:chests/infested_temple/infested_temple_room_forge",
  "dungeons_arise:chests/infested_temple/infested_temple_room_garden",
  "dungeons_arise:chests/infested_temple/infested_temple_room_normal",
  "dungeons_arise:chests/jungle_tree_house/jungle_tree_house_barrels",
  "dungeons_arise:chests/jungle_tree_house/jungle_tree_house_normal",
  "dungeons_arise:chests/keep_kayra/keep_kayra_normal",
  "dungeons_arise:chests/lighthouse/lighthouse_top",
  "dungeons_arise:chests/mechanical_nest/mechanical_nest_normal",
  "dungeons_arise:chests/mushroom_house/mushroom_house_barrels",
  "dungeons_arise:chests/mushroom_house/mushroom_house_normal",
  "dungeons_arise:chests/mushroom_mines/mushroom_mines_barrels",
  "dungeons_arise:chests/mushroom_mines/mushroom_mines_ores",
  "dungeons_arise:chests/plague_asylum/plague_asylum_barrels",
  "dungeons_arise:chests/plague_asylum/plague_asylum_normal",
  "dungeons_arise:chests/plague_asylum/plague_asylum_potions",
  "dungeons_arise:chests/scorched_mines/scorched_mines_barrels",
  "dungeons_arise:chests/scorched_mines/scorched_mines_hub",
  "dungeons_arise:chests/scorched_mines/scorched_mines_normal",
  "dungeons_arise:chests/shiraz_palace/shiraz_palace_gardens",
  "dungeons_arise:chests/shiraz_palace/shiraz_palace_normal",
  "dungeons_arise:chests/thornborn_towers/thornborn_towers_barrels",
  "dungeons_arise:chests/thornborn_towers/thornborn_towers_rooms",
  "dungeons_arise:chests/undead_pirate_ship/undead_pirate_ship_barrels",
  "betterdungeons:zombie_dungeon/chests/common",
  "minecraft:chests/simple_dungeon",
  "betterstrongholds:chests/common",
  "dungeons_arise:chests/bandit_towers/bandit_towers_barrels",
  "dungeons_arise:chests/bandit_towers/bandit_towers_normal",
  "repurposed_structures:chests/ancient_cities/end",
  "repurposed_structures:chests/ancient_cities/nether",
  "repurposed_structures:chests/ancient_cities/ocean",
  "repurposed_structures:chests/bastions/underground/bridge",
  "repurposed_structures:chests/bastions/underground/other",
  /^repurposed_structures:chests\/dungeons\/.*/,
  /^repurposed_structures:chests\/mansions\/(?!.*storage).*/,
  /^repurposed_structures:chests\/mineshafts\/.*/,
  /^repurposed_structures:chests\/outposts\/.*/,
];

let village_chests = [
  /^minecraft:chests\/village\/(?!.*fisher).*/,
  /^morevillagers:chests\/village\/.*/,
  /^repurposed_structures:chests\/villages\/(?!.*ocean).*/,
  /^betterstrongholds:chests\/.*mess$/,
  "dungeons_arise:chests/bandit_towers/bandit_towers_supply",
  "dungeons_arise:chests/bandit_village/bandit_village_supply",
  "dungeons_arise:chests/greenwood_pub/greenwood_pub_barrels_hallways",
  "dungeons_arise:chests/heavenly_challenger/heavenly_challenger_supply",
  "dungeons_arise:chests/illager_campsite/illager_campsite_supply",
  "dungeons_arise:chests/infested_temple/infested_temple_room_supply",
  "dungeons_arise:chests/mechanical_nest/mechanical_nest_supply",
  "dungeons_arise:chests/merchant_campsite/merchant_campsite_map",
  "dungeons_arise:chests/merchant_campsite/merchant_campsite_supply",
  "dungeons_arise:chests/merchant_campsite/merchant_campsite_tent",
  "dungeons_arise:chests/mining_system/mining_system_barrels",
  "dungeons_arise:chests/monastery/monastery_barrels",
  "dungeons_arise:chests/monastery/monastery_bridges",
  "dungeons_arise:chests/monastery/monastery_map",
  "dungeons_arise:chests/mushroom_mines/mushroom_mines_tools",
  "dungeons_arise:chests/mushroom_village/mushroom_village_barrels",
  "dungeons_arise:chests/plague_asylum/plague_asylum_storage",
  "dungeons_arise:chests/scorched_mines/scorched_mines_housing",
  "dungeons_arise:chests/shiraz_palace/shiraz_palace_rooms",
  "dungeons_arise:chests/shiraz_palace/shiraz_palace_supply",
  "dungeons_arise:chests/small_prairie_house/small_prairie_house_barrels",
  "dungeons_arise:chests/small_prairie_house/small_prairie_house_normal",
  "dungeons_arise:chests/small_prairie_house/small_prairie_house_ruined",
  "dungeons_arise:chests/undead_pirate_ship/undead_pirate_ship_supply",
  "repurposed_structures:chests/cities/nether",
  "repurposed_structures:chests/cities/overworld",
  /^repurposed_structures:chests\/igloos\/.*/,
  /^repurposed_structures:chests\/mansions\/.*storage$/,
  /^artifacts:chests\/.*/,
  /^structory_towers:basic\/.*basic$/,
];

let fishing_chests = [
  "waterloggedchests:chests/waterlogged_chest",
  "dungeons_arise_seven_seas:chests/pirate_junk/pirate_junk_supply",
  "dungeons_arise_seven_seas:chests/unicorn_galleon/unicorn_galleon_supply",
  "dungeons_arise_seven_seas:chests/victory_frigate/victory_frigate_supply",
  "dungeons_arise:chests/fishing_hut/fishing_hut_barrels",
  "dungeons_arise:chests/illager_corsair/illager_corsair_supply",
  "dungeons_arise:chests/illager_galley/illager_galley_supply",
  "minecraft:chests/village/village_fisher",
  "repurposed_structures:chests/villages/ocean_house",
  "ercerus:chests/ship_cargo_dropper",
  "ercerus:chests/ship_fish",
  "ercerus:chests/ship_illager",
  "ercerus:chests/ship_undead",
  "ercerus:chests/ship_villager",
  "ercerus:chests/ship_witch",
  "ercerus:chests/ship_wreck_treasure_double_chest",
  "ercerus:chests/ship_wreck_treasure",
  "ercerus:chests/ship_wreck",
];

LootJS.modifiers((event) => {
  dungeon_chests_legendary.forEach((chest) => {
    event.addLootTableModifier(chest).addLoot("dimdungeons:item_portal_key");
    event
      .addLootTableModifier(chest)
      .addLoot(LootEntry.of("#moa_decor_toys:plushies"));

    event.addLootTableModifier(chest).pool((p) => {
      p.rolls([1, 3]);
      p.randomChance(0.25).addWeightedLoot([
        LootEntry.of("nocubescreateexp:exp_block"),
        LootEntry.of("supplementaries:antique_ink"),
        LootEntry.of("rats:tiny_coin").limitCount([4, 8]),
      ]);
    });

    event.addLootTableModifier(chest).pool((p) => {
      p.rolls([1, 2]);
      p.randomChance(0.5).addWeightedLoot([
        LootEntry.of("minecards:foil_card_box").withChance(2),
        LootEntry.of("architects_palette:ancient_plating")
          .limitCount([8, 64])
          .withChance(3),
      ]);
    });

    event
      .addLootTableModifier(chest)
      .randomChance(0.25)
      .addWeightedLoot([
        LootEntry.of("botanypots:terracotta_botany_pot"),
        LootEntry.of("easy_villagers:trader"),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addLoot(LootEntry.of("#skinnedlanterns:lanterns"));

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .apply((ctx) => {
        Utils.rollChestLoot("wares:chests/sealed_agreements").forEach(
          (item) => {
            ctx.addLoot(item);
          }
        );
      });
  });

  dungeon_chests_rare.forEach((chest) => {
    event.addLootTableModifier(chest).removeLoot(Ingredient.of("#forge:seeds"));

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addLoot("dimdungeons:item_portal_key");

    event.addLootTableModifier(chest).pool((p) => {
      p.rolls([1, 2]);
      p.randomChance(0.5).addWeightedLoot([
        LootEntry.of("rats:tiny_coin").limitCount([2, 4]),
        LootEntry.of("cgm:advanced_bullet").limitCount([2, 4]),
        LootEntry.of("cgm:missile").limitCount([1, 2]),
        LootEntry.of("#forge:coins").limitCount([2, 4]),
      ]);
    });

    event.addLootTableModifier(chest).pool((p) => {
      p.rolls([1, 2]);
      p.randomChance(0.25).addWeightedLoot([
        LootEntry.of("architects_palette:oracle_jelly").limitCount([4, 16]),
        LootEntry.of("architects_palette:wardstone_blend").limitCount([4, 16]),
        LootEntry.of("architects_palette:entwine_rod").limitCount([4, 16]),
      ]);
    });

    event
      .addLootTableModifier(chest)
      .randomChance(0.25)
      .addWeightedLoot([
        LootEntry.of("create:andesite_alloy").limitCount([1, 4]),
        LootEntry.of("#skinnedlanterns:lanterns"),
        LootEntry.of("nocubescreateexp:exp_block"),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .apply((ctx) => {
        Utils.rollChestLoot("wares:chests/sealed_agreements").forEach(
          (item) => {
            ctx.addLoot(item);
          }
        );
      });

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addWeightedLoot([
        LootEntry.of("#moa_decor_toys:plushies"),
        LootEntry.of("supplementaries:antique_ink").limitCount([1, 2]),
        LootEntry.of("#minecards:card_boxes"),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addWeightedLoot([
        LootEntry.of("#dice:dice"),
        LootEntry.of("hyperbox:hyperbox"),
        LootEntry.of("sophisticatedstorage:upgrade_base"),
      ]);
  });

  dungeon_chests_common.forEach((chest) => {
    event
      .addLootTableModifier(chest)
      .randomChance(0.33)
      .addLoot(LootEntry.of("create:andesite_alloy").limitCount([1, 4]));

    event.addLootTableModifier(chest).pool((p) => {
      p.rolls([1, 2]);
      p.randomChance(0.25).addWeightedLoot([
        LootEntry.of("cgm:basic_bullet").limitCount([2, 4]),
        LootEntry.of("cgm:shell").limitCount([2, 4]),
        LootEntry.of("spawn:rotten_planks").limitCount([1, 3]),
        LootEntry.of("#forge:coins").limitCount([4, 8]),
      ]);
    });

    event.addLootTableModifier(chest).pool((p) => {
      p.rolls([1, 2]);
      p.randomChance(0.25).addWeightedLoot([
        LootEntry.of("architects_palette:nether_brass_blend").limitCount([
          4, 16,
        ]),
        LootEntry.of("architects_palette:sunmetal_blend").limitCount([4, 16]),
        LootEntry.of("architects_palette:cerebral_plate").limitCount([4, 16]),
      ]);
    });

    event.addLootTableModifier(chest).pool((p) => {
      p.rolls([1, 2]);
      p.randomChance(0.15).addWeightedLoot([
        LootEntry.of("torchbowmod:multitorch").limitCount([1, 3]),
        LootEntry.of("#skinnedlanterns:lanterns"),
        LootEntry.of("create:experience_block"),
        LootEntry.of("supplementaries:antique_ink"),
      ]);
    });

    event
      .addLootTableModifier(chest)
      .randomChance(0.05)
      .apply((ctx) => {
        Utils.rollChestLoot("wares:chests/sealed_agreements").forEach(
          (item) => {
            ctx.addLoot(item);
          }
        );
      });

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addWeightedLoot([
        LootEntry.of("dimdungeons:item_portal_key").withChance(10),
        LootEntry.of("#supplementaries:candle_holders")
          .limitCount([1, 4])
          .withChance(33),
        LootEntry.of("#supplementaries:sconces")
          .limitCount([1, 4])
          .withChance(33),
        LootEntry.of("some_assembly_required:golden_apple_slices")
          .limitCount([1, 3])
          .withChance(33),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addWeightedLoot([
        LootEntry.of("exposure:black_and_white_film"),
        LootEntry.of("exposure:color_film"),
        LootEntry.of("sophisticatedbackpacks:upgrade_base"),
        LootEntry.of("nocubescreateexp:exp_block"),
        LootEntry.of(
          "some_assembly_required:enchanted_golden_apple_slices"
        ).limitCount([1, 3]),
      ]);
  });

  village_chests.forEach((chest) => {
    event
      .addLootTableModifier(chest)
      .randomChance(0.2)
      .addLoot(LootEntry.of("create:andesite_alloy").limitCount([1, 4]));

    event
      .addLootTableModifier(chest)
      .randomChance(0.05)
      .apply((ctx) => {
        Utils.rollChestLoot("wares:chests/village_sealed_agreements").forEach(
          (item) => {
            ctx.addLoot(item);
          }
        );
      });

    event.addLootTableModifier(chest).pool((p) => {
      p.rolls([1, 3]);
      p.randomChance(0.25).addWeightedLoot([
        LootEntry.of("architects_palette:algal_blend").limitCount([4, 16]),
        LootEntry.of("create:experience_nugget").limitCount([2, 4]),
        LootEntry.of("supplementaries:soap").limitCount([1, 2]),
        LootEntry.of("wares:cardboard_box").limitCount([2, 8]),
      ]);
    });

    event
      .addLootTableModifier(chest)
      .randomChance(0.15)
      .addWeightedLoot([
        LootEntry.of("sophisticatedstorage:upgrade_base").withChance(10),
        LootEntry.of("cgm:basic_bullet").limitCount([2, 4]).withChance(30),
        LootEntry.of("cgm:shell").limitCount([2, 4]).withChance(30),
        LootEntry.of("advancementframes:advancement_frame").withChance(10),
        LootEntry.of("advancementframes:stat_frame").withChance(10),
        LootEntry.of("#snowyspirit:glow_lights").withChance(10),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addWeightedLoot([
        LootEntry.of("sophisticatedstorage:packing_tape").withChance(15),
        LootEntry.of("#skinnedlanterns:lanterns").withChance(30),
        LootEntry.of("supplementaries:antique_ink")
          .limitCount([1, 3])
          .withChance(50),
        LootEntry.of("snowyspirit:snow_globe").withChance(5),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.5)
      .addWeightedLoot([
        LootEntry.of(
          "some_assembly_required:sandwich",
          '{BlockEntityTag:{Sandwich:[{Count:1b,id:"some_assembly_required:burger_bun_bottom"},{Count:1b,id:"some_assembly_required:sliced_onion"},{Count:1b,id:"farmersdelight:beef_patty"},{Count:1b,id:"rats:cheese"},{Count:1b,id:"farmersdelight:cooked_bacon"},{Count:1b,id:"farmersdelight:cabbage_leaf"},{Count:1b,id:"some_assembly_required:tomato_slices"},{Count:1b,id:"some_assembly_required:burger_bun_top"}]},RepairCost:0,display:{Name:\'{"text":"Bacon Cheezy BoogerBurger™"}\'}}'
        ).limitCount([2, 4]),
        LootEntry.of(
          "some_assembly_required:sandwich",
          '{BlockEntityTag:{Sandwich:[{Count:1b,id:"some_assembly_required:burger_bun_bottom"},{Count:1b,id:"farmersdelight:cooked_chicken_cuts"},{Count:1b,id:"some_assembly_required:tomato_slices"},{Count:1b,id:"some_assembly_required:burger_bun_bottom"},{Count:1b,id:"minecraft:cooked_cod"},{Count:1b,id:"farmersdelight:cabbage_leaf"},{Count:1b,id:"some_assembly_required:burger_bun_bottom"},{Count:1b,id:"farmersdelight:beef_patty"},{Count:1b,id:"farmersdelight:cooked_bacon"},{Count:1b,id:"some_assembly_required:burger_bun_top"}]},RepairCost:0,display:{Name:\'{"text":"\\\\"Land, Sea, & Air\\\\" BoogerBurger™"}\'}}'
        ).limitCount([2, 4]),
        LootEntry.of(
          "some_assembly_required:sandwich",
          '{BlockEntityTag:{Sandwich:[{Count:1b,id:"some_assembly_required:burger_bun_bottom"},{Count:1b,id:"some_assembly_required:sliced_onion"},{Count:1b,id:"farmersdelight:beef_patty"},{Count:1b,id:"rats:cheese"},{Count:1b,id:"farmersdelight:cooked_bacon"},{Count:1b,id:"some_assembly_required:burger_bun_bottom"},{Count:1b,id:"farmersdelight:beef_patty"},{Count:1b,id:"rats:cheese"},{Count:1b,id:"farmersdelight:cooked_bacon"},{Count:1b,id:"farmersdelight:cabbage_leaf"},{Count:1b,id:"some_assembly_required:tomato_slices"},{Count:1b,id:"some_assembly_required:burger_bun_top"}]},RepairCost:0,display:{Name:\'{"text":"Dubby Wubby Bacon Cheezy BoogerBurger™"}\'}}'
        ).limitCount([2, 4]),
      ]);
  });

  fishing_chests.forEach((chest) => {
    event
      .addLootTableModifier(chest)
      .addWeightedLoot([
        LootEntry.of("twigs:bronzed_seashell").limitCount([1, 3]),
        LootEntry.of("twigs:opaline_seashell").limitCount([1, 3]),
        LootEntry.of("twigs:roseate_seashell").limitCount([1, 3]),
        LootEntry.of("twigs:tangerine_seashell").limitCount([1, 3]),
      ]);

    event.addLootTableModifier(chest).pool((p) => {
      p.rolls([2, 4]);
      p.randomChance(0.5).addWeightedLoot([
        LootEntry.of("minecraft:prismarine_bricks").limitCount([1, 4]),
        LootEntry.of("minecraft:prismarine").limitCount([1, 4]),
        LootEntry.of("minecraft:dark_prismarine").limitCount([1, 4]),
        LootEntry.of("minecraft:sea_lantern").limitCount([1, 2]),
        LootEntry.of("minecraft:sponge"),
        LootEntry.of("ecologics:seashell").limitCount([3, 8]),
      ]);
    });

    event
      .addLootTableModifier(chest)
      .randomChance(0.05)
      .addLoot(LootEntry.of("minecraft:heart_of_the_sea"));

    event
      .addLootTableModifier(chest)
      .randomChance(0.25)
      .addWeightedLoot([
        LootEntry.of("oceansdelight:cooked_stuffed_cod")
          .limitCount([1, 4])
          .withChance(70),
        LootEntry.of("crabbersdelight:stuffed_nautilus_shell")
          .limitCount([1, 4])
          .withChance(70),
        LootEntry.of("crabbersdelight:bisque")
          .limitCount([1, 4])
          .withChance(70),
        LootEntry.of("crabbersdelight:seafood_gumbo")
          .limitCount([1, 4])
          .withChance(70),
        LootEntry.of("crabbersdelight:clam_chowder")
          .limitCount([1, 4])
          .withChance(70),
        LootEntry.of("qualitysdelight:cooked_stuffed_cod_iron")
          .limitCount([1, 4])
          .withChance(15),
        LootEntry.of("qualitysdelight:stuffed_nautilus_shell_iron")
          .limitCount([1, 4])
          .withChance(15),
        LootEntry.of("qualitysdelight:bisque_iron")
          .limitCount([1, 4])
          .withChance(15),
        LootEntry.of("qualitysdelight:seafood_gumbo_iron")
          .limitCount([1, 4])
          .withChance(15),
        LootEntry.of("qualitysdelight:clam_chowder_iron")
          .limitCount([1, 4])
          .withChance(15),
        LootEntry.of("qualitysdelight:cooked_stuffed_cod_gold")
          .limitCount([1, 4])
          .withChance(10),
        LootEntry.of("qualitysdelight:stuffed_nautilus_shell_gold")
          .limitCount([1, 4])
          .withChance(10),
        LootEntry.of("qualitysdelight:bisque_gold")
          .limitCount([1, 4])
          .withChance(10),
        LootEntry.of("qualitysdelight:seafood_gumbo_gold")
          .limitCount([1, 4])
          .withChance(10),
        LootEntry.of("qualitysdelight:clam_chowder_gold")
          .limitCount([1, 4])
          .withChance(10),
        LootEntry.of("qualitysdelight:cooked_stuffed_cod_diamond")
          .limitCount([1, 4])
          .withChance(5),
        LootEntry.of("qualitysdelight:stuffed_nautilus_shell_diamond")
          .limitCount([1, 4])
          .withChance(5),
        LootEntry.of("qualitysdelight:bisque_diamond")
          .limitCount([1, 4])
          .withChance(5),
        LootEntry.of("qualitysdelight:seafood_gumbo_diamond")
          .limitCount([1, 4])
          .withChance(5),
        LootEntry.of("qualitysdelight:clam_chowder_diamond")
          .limitCount([1, 4])
          .withChance(5),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addWeightedLoot([
        LootEntry.of("crabbersdelight:bucket_of_clam_chum"),
        LootEntry.of("crabbersdelight:bucket_of_clawster_chum"),
        LootEntry.of("crabbersdelight:bucket_of_crab_chum"),
        LootEntry.of("crabbersdelight:bucket_of_shrimp_chum"),
        LootEntry.of("thermal:aquachow").limitCount([3, 8]),
        LootEntry.of("thermal:deep_aquachow").limitCount([3, 8]),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addWeightedLoot([
        LootEntry.of("crabbersdelight:crab_bucket"),
        LootEntry.of("spawn:seahorse_bucket"),
        LootEntry.of("spawn:tuna_egg_bucket"),
        LootEntry.of("spawn:angler_fish_bucket"),
        LootEntry.of("naturalist:catfish_bucket"),
        LootEntry.of("naturalist:bass_bucket"),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addLoot(LootEntry.of("supplementaries:antique_ink"));
    event
      .addLootTableModifier(chest)
      .randomChance(0.05)
      .addLoot(LootEntry.of("handcrafted:salmon_trophy"));
    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addLoot(LootEntry.of("seadwellers:aquamarine").limitCount([1, 3]));

    event
      .addLootTableModifier(chest)
      .randomChance(0.1)
      .addWeightedLoot([
        LootEntry.of("thermal:prismarine_rail")
          .limitCount([8, 16])
          .withChance(3),
        LootEntry.of("thermal:prismarine_powered_rail").limitCount([1, 3]),
        LootEntry.of("thermal:prismarine_detector_rail").limitCount([1, 2]),
        LootEntry.of("thermal:prismarine_activator_rail").limitCount([1, 2]),
        LootEntry.of("thermal:underwater_minecart"),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.05)
      .addLoot(LootEntry.of("crabbersdelight:crab_trap"));

    event
      .addLootTableModifier(chest)
      .randomChance(0.05)
      .addWeightedLoot([
        LootEntry.of("crabbersdelight:nautilus_shell_block"),
        LootEntry.of("crabbersdelight:pearl_block"),
        LootEntry.of("seadwellers:aquamarine_block"),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.05)
      .addWeightedLoot([
        LootEntry.of("minecards:aquatic_card_box").withChance(45),
        LootEntry.of("moa_decor_toys:delfin").withChance(5),
        LootEntry.of("moa_decor_toys:calamar").withChance(5),
        LootEntry.of("moa_decor_toys:calamarbrillante").withChance(5),
        LootEntry.of("moa_decor_toys:tortugamarina").withChance(5),
        LootEntry.of("moa_decor_toys:guardian").withChance(5),
        LootEntry.of("moa_decor_toys:guardiananciano").withChance(5),
        LootEntry.of("moa_decor_toys:ajoloteazul").withChance(5),
        LootEntry.of("moa_decor_toys:ajolotecafe").withChance(5),
        LootEntry.of("moa_decor_toys:ajolotecian").withChance(5),
        LootEntry.of("moa_decor_toys:ajolotedorado").withChance(5),
        LootEntry.of("moa_decor_toys:ajoloterosa").withChance(5),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.05)
      .addWeightedLoot([
        LootEntry.of("seadwellers:seashell_of_architect"),
        LootEntry.of("seadwellers:seashell_of_blacksmith"),
        LootEntry.of("seadwellers:seashell_of_farmer"),
        LootEntry.of("seadwellers:seashell_of_worker"),
        LootEntry.of("seadwellers:seashell_of_hunter"),
        LootEntry.of("bountiful:decree"),
      ]);

    event
      .addLootTableModifier(chest)
      .randomChance(0.01)
      .addLoot(LootEntry.of("thermal:device_fisher"));
    event
      .addLootTableModifier(chest)
      .randomChance(0.01)
      .addLoot(LootEntry.of("supplementaries:jar_boat"));
    event
      .addLootTableModifier(chest)
      .randomChance(0.01)
      .addLoot(
        LootEntry.of(
          Item.of(
            "minecraft:fishing_rod",
            '{display:{Name:\'{"text":"Ancient Fishing Rod"}\'}}'
          )
            .enchant("minecraft:unbreaking", 5)
            .enchant("minecraft:lure", 5)
            .enchant("minecraft:luck_of_the_sea", 5)
            .enchant("minecraft:mending", 1)
        )
      );

    event
      .addLootTableModifier(chest)
      .randomChance(0.01)
      .addWeightedLoot([
        LootEntry.of("thermal:diving_helmet"),
        LootEntry.of("thermal:diving_chestplate"),
        LootEntry.of("thermal:diving_leggings"),
        LootEntry.of("thermal:diving_boots"),
        LootEntry.of("artifacts:aqua_dashers"),
        LootEntry.of("artifacts:charm_of_sinking"),
        LootEntry.of("artifacts:snorkel"),
        LootEntry.of("artifacts:flippers"),
        LootEntry.of("artifacts:helium_flamingo"),
      ]);
  });

  // Removing default Wares Sealed Agreements
  event
    .addLootTableModifier(/^wares:chests\/village\/.*warehouse$/)
    .removeLoot("wares:sealed_delivery_agreement");

  // Removing dumb copper nuggies 
  event
  .addLootTableModifier("minecraft:chests/underwater_ruin_small")
  .removeLoot("copperative:copper_nugget");   
});
