// priority 10

const chestBanList = [
  "alltheores:steel_plate",
  "enderio:copper_alloy_ingot",
  "enderio:dark_steel_ingot",
  "enderio:dark_steel_sword",
  "enderio:energized_gear",
  "enderio:iron_gear",
  "enderio:loot_capacitor",
  "enderio:pulsating_alloy_ingot",
  "enderio:redstone_alloy_ingot",
  "enderio:stone_gear",
  "enderio:vibrant_alloy_ingot",
  "enderio:vibrant_gear",
  "enderio:wood_gear",
  "immersiveengineering:ingot_aluminum",
  "immersiveengineering:seed",
  "railcraft:charge_meter",
  "railcraft:creosote_bottle",
  "railcraft:goggles",
  "railcraft:iron_crowbar",
  "railcraft:iron_spike_maul",
  "railcraft:overalls",
  "railcraft:seasons_crowbar",
  "railcraft:signal_block_surveyor",
  "railcraft:signal_tuner",
  "railcraft:steam_locomotive",
  "railcraft:steel_axe",
  "railcraft:steel_boots",
  "railcraft:steel_chestplate",
  "railcraft:steel_helmet",
  "railcraft:steel_leggings",
  "railcraft:steel_pickaxe",
  "railcraft:steel_plate",
  "railcraft:steel_sword",
  "railcraft:tank_minecart",
  "gtceu:steel_ingot",
  "sgjourney:jaffa_boots",
  "sgjourney:jaffa_chestplate",
  "sgjourney:jaffa_helmet",
  "sgjourney:jaffa_leggings",
  "sgjourney:naquadah_alloy",
  "sgjourney:raw_naquadah",
  "tfc:metal/ingot/steel",
  "tfc:metal/sheet/steel",
  "minecraft:bow",
  "minecraft:campfire",
  "minecraft:compass",
  "minecraft:copper_ingot",
  "minecraft:cornflower",
  "minecraft:crossbow",
  "minecraft:anvil",
  "minecraft:fishing_rod",
  "minecraft:flower_pot",
  "minecraft:furnace",
  "minecraft:furnace_minecart",
  "minecraft:netherite_hoe",
  "minecraft:netherite_ingot",
  "minecraft:stone_brick",
  "minecraft:cobblestone",
  "minecraft:stone",
  "minecraft:iron_nugget",
  "minecraft:powder_snow_bucket",
  "minecraft:soul_torch",
  "minecraft:enchanting_table"

]

const chestReplacementMap = {
  "alltheores:brass_ingot": "workerstfc:coin",
  "alltheores:bronze_ingot": "workerstfc:coin",
  "alltheores:invar_ingot": "workerstfc:coin",
  "alltheores:lead_ingot": "workerstfc:coin",
  "alltheores:lead_plate": "workerstfc:coin",
  "alltheores:nickel_plate": "workerstfc:coin",
  "alltheores:silver_ingot": "workerstfc:coin",
  "alltheores:silver_plate": "workerstfc:coin",
  "alltheores:steel_plate": "workerstfc:coin",
  "alltheores:tin_ingot": "workerstfc:coin",
  "alltheores:zinc_ingot": "workerstfc:coin",
  "alltheores:zinc_plate": "workerstfc:coin",
  "create:copper_sheet": "workerstfc:coin",
  "create:golden_sheet": "workerstfc:coin",
  "create:zinc_ingot": "workerstfc:coin",
  "createaddition:zinc_sheet": "workerstfc:coin",
  "immersiveengineering:ingot_aluminum": "workerstfc:coin",
  "immersiveengineering:ingot_lead": "workerstfc:coin",
  "immersiveengineering:ingot_nickel": "workerstfc:coin",
  "immersiveengineering:plate_lead": "workerstfc:coin",
  "immersiveengineering:plate_nickel": "workerstfc:coin",
  "minecraft:amethyst": "workerstfc:coin",
  "minecraft:allium": "workerstfc:coin",
  "minecraft:apple": "tfc:food/red_apple",
  "minecraft:baked_potato": "tfc:food/potato",
  "minecraft:barrel": "tfc:wood/chest/chestnut",
  "minecraft:beef": "tfc:food/beef",
  "minecraft:beetroot": "tfc:food/beet",
  "minecraft:beetroot_seeds": "tfc:seeds/beet",
  "minecraft:beetroot_soup": "tfc:food/beet",
  "minecraft:blue_orchid": "tfc:plant/blue_orchid",
  "minecraft:bread": "tfc:food/wheat_bread",
  "minecraft:bucket": "tfc:powder/salt",
  "minecraft:bundle": "tfc:stick_bundle",
  "minecraft:cake": "tfc:cake",
  "minecraft:carrot": "tfc:food/carrot",
  "minecraft:cherry_sapling": "tfc:plant/cherry_sapling",
  "minecraft:chest_minecart": "tfc:wood/chest_minecart/oak",
  "minecraft:cocoa_beans": "tfc:powder/flux",
  "minecraft:cod": "tfc:food/cod",
  "minecraft:cooked_cod": "tfc:food/cooked_cod",
  "minecraft:cooked_porkchop": "tfc:food/cooked_pork",
  "minecraft:cooked_rabbit": "tfc:food/cooked_rabbit",
  "minecraft:cooked_salmon": "tfc:food/cooked_salmon",
  "minecraft:birch_log": "workerstfc:coin",
  "minecraft:birch_sapling": "workerstfc:coin",
  "minecraft:acacia_log": "tfc:wood/log/acacia",
  "minecraft:acacia_sapling": "tfc:wood/sapling/acacia",
  "minecraft:dark_oak_boat": "tfc:wood/boat/hickory",
  "minecraft:dark_oak_log": "tfc:wood/log/hickory",
  "minecraft:dark_oak_sapling": "tfc:wood/sapling/hickory",
  "minecraft:dandelion": "tfc:plant/dandelion",
  "minecraft:dead_bush": "tfc:plant/dead_bush",
  "minecraft:deepslate_copper_ore": "tfc:ore/rich_malachite",
  "minecraft:deepslate_redstone_ore": "tfc:ore/cinnabar",
  "minecraft:diamond_axe": "tfc:ore/diamond",
  "minecraft:diamond_boots": "tfc:ore/diamond",
  "minecraft:diamond_chestplate": "tfc:ore/diamond",
  "minecraft:diamond_helmet": "tfc:ore/diamond",
  "minecraft:diamond_hoe": "tfc:ore/diamond",
  "minecraft:diamond": "tfc:ore/diamond",
  "minecraft:diamond_horse_armor": "minecraft:leather_horse_armor",
  "minecraft:diamond_leggings": "tfc:ore/diamond",
  "minecraft:diamond_pickaxe": "tfc:ore/diamond",
  "minecraft:diamond_shovel": "tfc:ore/diamond",
  "minecraft:diamond_sword": "tfc:ore/diamond",
  "minecraft:dried_kelp": "tfc:food/dried_kelp",
  "minecraft:emerald": "tfc:gem/emerald",
  "minecraft:emerald_block": "tfc:gem/emerald",
  "minecraft:fern": "tfc:plant/tree_fern",
  "minecraft:glass_bottle": "tfc:silica_glass_batch",
  "minecraft:golden_carrot": "tfc:seeds/carrot",
  "minecraft:golden_axe": "tfc:metal/ingot/gold",
  "minecraft:golden_boots": "tfc:metal/ingot/gold",
  "minecraft:golden_chestplate": "tfc:metal/ingot/gold",
  "minecraft:golden_helmet": "tfc:metal/ingot/gold",
  "minecraft:golden_hoe": "tfc:metal/ingot/gold",
  "minecraft:golden_horse_armor": "minecraft:leather_horse_armor",
  "minecraft:golden_leggings": "tfc:metal/ingot/gold",
  "minecraft:golden_pickaxe": "tfc:metal/ingot/gold",
  "minecraft:golden_shovel": "tfc:metal/ingot/gold",
  "minecraft:golden_sword": "tfc:metal/ingot/gold",
  "minecraft:gold_ingot": "tfc:metal/ingot/gold",
  "minecraft:gold_ore": "tfc:ore/rich_native_gold",
  "minecraft:iron_axe": "workerstfc:coin",
  "minecraft:iron_bars": "tfc:metal/bars/wrought_iron",
  "minecraft:iron_block": "workerstfc:coin",
  "minecraft:iron_boots": "workerstfc:coin",
  "minecraft:iron_chestplate": "workerstfc:coin",
  "minecraft:iron_helmet": "workerstfc:coin",
  "minecraft:iron_hoe": "workerstfc:coin",
  "minecraft:iron_horse_armor": "minecraft:leather_horse_armor",
  "minecraft:iron_ingot": "workerstfc:coin",
  "minecraft:iron_leggings": "workerstfc:coin",
  "minecraft:iron_ore": "tfc:ore/rich_hematite",
  "minecraft:iron_pickaxe": "workerstfc:coin",
  "minecraft:iron_shovel": "workerstfc:coin",
  "minecraft:iron_sword": "workerstfc:coin",
  "minecraft:jungle_log": "tfc:wood/log/palm",
  "minecraft:jungle_sapling": "tfc:wood/sapling/palm",
  "minecraft:kelp": "tfc:plant/leafy_kelp",
  "minecraft:lapis_block": "tfc:gem/lapis_lazuli",
  "minecraft:lapis_lazuli": "tfc:ore/lapis_lazuli",
  "minecraft:lava_bucket": "tfc:rock/magma/basalt",
  "minecraft:lilac": "tfc:plant/lilac",
  "minecraft:lily_of_the_valley": "tfc:plant/lily_of_the_valley",
  "minecraft:lily_pad": "tfc:plant/water_lily",
  "minecraft:mangrove_log": "tfc:wood/log/mangrove",
  "minecraft:mangrove_propagule": "tfc:wood/sapling/mangrove",
  "minecraft:melon": "tfc:melon",
  "minecraft:melon_seeds": "tfc:seeds/melon",
  "minecraft:melon_slice": "tfc:seeds/melon",
  "minecraft:mud_bricks": "tfc:mud_brick/loam",
  "minecraft:mushroom_stew": "tfc:food/potato",
  "minecraft:mutton": "tfc:food/mutton",
  "minecraft:oak_boat": "tfc:wood/boat/oak",
  "minecraft:oak_chest_boat": "tfc:wood/boat/oak",
  "minecraft:oak_log": "tfc:wood/log/oak",
  "minecraft:oak_planks": "tfc:wood/planks/oak",
  "minecraft:oak_sapling": "tfc:wood/sapling/oak",
  "minecraft:orange_tulip": "tfc:plant/tulip_orange",
  "minecraft:oxeye_daisy": "tfc:plant/oxeye_daisy",
  "minecraft:pink_tulip": "tfc:plant/tulip_pink",
  "minecraft:poisonous_potato": "tfc:food/potato",
  "minecraft:poppy": "tfc:plant/poppy",
  "minecraft:porkchop": "tfc:food/pork",
  "minecraft:potato": "tfc:food/potato",
  "minecraft:pumpkin": "tfc:pumpkin",
  "minecraft:pumpkin_seeds": "tfc:seeds/pumpkin",
  "minecraft:rabbit": "tfc:food/rabbit",
  "minecraft:raw_copper": "tfc:ore/rich_native_copper",
  "minecraft:raw_copper_block": "tfc:metal/ingot/copper",
  "minecraft:raw_gold": "workerstfc:coin",
  "minecraft:raw_iron": "workerstfc:coin",
  "minecraft:red_tulip": "workerstfc:coin",
  "minecraft:rose_bush": "workerstfc:coin",
  "minecraft:salmon": "workerstfc:coin",
  "minecraft:shears": "workerstfc:coin",
  "minecraft:spruce_log": "workerstfc:coin",
  "minecraft:spruce_sapling": "workerstfc:coin",
  "minecraft:spruce_sign": "workerstfc:coin",
  "minecraft:stone_axe": "workerstfc:coin",
  "minecraft:stone_hoe": "workerstfc:coin",
  "minecraft:stone_pickaxe": "workerstfc:coin",
  "minecraft:stone_shovel": "workerstfc:coin",
  "minecraft:stone_sword": "workerstfc:coin",
  "minecraft:sugar_cane": "workerstfc:coin",
  "minecraft:suspicious_stew": "workerstfc:coin",
  "minecraft:sweet_berries": "workerstfc:coin",
  "minecraft:torch": "workerstfc:coin",
  "minecraft:water_bucket": "workerstfc:coin",
  "minecraft:wheat": "workerstfc:coin",
  "minecraft:wheat_seeds": "workerstfc:coin",
  "minecraft:white_tulip": "workerstfc:coin",
  "minecraft:wooden_axe": "workerstfc:coin",
  "minecraft:wooden_pickaxe": "workerstfc:coin",
  "minecraft:chiseled_red_sandstone": "workerstfc:coin",
  "railcraft:brass_plate": "workerstfc:coin",
  "railcraft:bronze_ingot": "workerstfc:coin",
  "railcraft:gold_plate": "workerstfc:coin",
  "railcraft:lead_ingot": "workerstfc:coin",
  "railcraft:silver_ingot": "workerstfc:coin",
  "railcraft:silver_plate": "workerstfc:coin",
  "railcraft:tin_plate": "workerstfc:coin",
  "tfc:metal/ingot/brass": "workerstfc:coin",
  "tfc:metal/ingot/bronze": "workerstfc:coin",
  "tfc:metal/ingot/silver": "workerstfc:coin",
  "tfc:metal/ingot/wrought_iron": "workerstfc:coin",
  "tfc:metal/sheet/silver": "workerstfc:coin",
  "tfc:metal/sheet/zinc": "workerstfc:coin",
  "tfc:metal/ingot/steel": "workerstfc:coin",
  "gtceu:quarktech_chestplate": "gtceu:bronze_ingot",
  "gtceu:quarktech_leggings"  : "gtceu:bronze_ingot",
  "gtceu:quarktech_boots"  : "gtceu:bronze_ingot",
  "gtceu:quarktech_helmet"  : "gtceu:bronze_ingot",
  "gtceu:advanced_quarktech_chestplate"  : "workerstfc:coin",
  "gtceu:manganese_ingot"  : "workerstfc:coin",
  "gtceu:neodymium_dust"  : "workerstfc:coin",
}

let modifyAndRemoveChestLoot = (/** @type {Internal.LootModificationEventJS} */ event) => {
  event
    .addLootTypeModifier([LootType.CHEST, LootType.UNKNOWN])
    .anyDimension(["minecraft:overworld", "minecraft:the_nether"])
    .removeLoot(Ingredient.of(chestBanList))
  event
    .addLootTypeModifier([LootType.CHEST, LootType.UNKNOWN])
    .anyDimension(["minecraft:overworld", "minecraft:the_nether"])
    .modifyLoot(Ingredient.of(Object.keys(chestReplacementMap)), (/** @type {Internal.ItemStack} */ item) =>
      Item.of(chestReplacementMap[item.item.id], item.count)
    )
}
