//
// This should be used only for item, block, recipe, fluid and loot tags
// Biome tags should prefer datapacks, or tags_add_remove_worldgen_biome script

ServerEvents.tags("item", (event) => {
  // Ember Metals
  global.emberMetal.forEach((metalInput) => {
    event.add(`forge:plates`, `embers:${metalInput}_plate`);
    event.add(`forge:plates/${metalInput}`, `embers:${metalInput}_plate`);
    event.add(`forge:plates`, `create:${metalInput}_sheet`);
    event.add(`forge:plates/${metalInput}`, `create:${metalInput}_sheet`);
    event.add(`forge:plates`, `thermal:${metalInput}_plate`);
    event.add(`forge:plates/${metalInput}`, `thermal:${metalInput}_plate`);
  });

  // Undergarden
  event.add(`forge:nuggets/forgotten`, `undergarden:forgotten_nugget`);
  event.add(`forge:ingots/forgotten`, `undergarden:forgotten_ingot`);

  // Scorched Guns Hazmat
  event.add(`scguns:gas_mask`, `thermal:hazmat_helmet`);

  // Cloggrum and Industrial Iron Nugget for bullet tips
  event.add(`scguns:advanced_bullet_tips`, `undergarden:cloggrum_nugget`);
  event.add(`scguns:advanced_bullet_material`, `undergarden:cloggrum_ingot`);
  event.add(`scguns:advanced_bullet_tips`, `create_dd:industrial_iron_nugget`);
  event.add(
    `scguns:advanced_bullet_material`,
    `create_dd:industrial_iron_ingot`,
  );

  // =========================================
  // Tagging Mainly for Loot Tables, Bountiful Boards, etc
  // =========================================

  // Plushies
  event.add(
    "moa_decor_toys:plushies",
    /^moa_decor_toys:(?!.*gemadejuguetes).*/,
  );

  // Thermal Press Dies
  event.add("thermal:crafting/dies", /^scguns:.*mold$/);

  // Minecards
  event.add("minecards:card_boxes", /^minecards:.*box$/);
  event.add("minecards:smeltable_cards", [
    "minecards:card_set_overworld",
    "minecards:card_the_overworld",
    "minecards:card_grass_block",
    "minecards:card_stone",
    "minecards:card_sand",
    "minecards:card_wood",
    "minecards:card_copper_ore",
    "minecards:card_coal_ore",
    "minecards:card_iron_ore",
    "minecards:card_gold_ore",
    "minecards:card_emerald_ore",
    "minecards:card_lapis_lazuli_ore",
    "minecards:card_diamond_ore",
    "minecards:card_water",
    "minecards:card_lava",
    "minecards:card_air",
    "minecards:card_crafting_table",
    "minecards:card_bed",
    "minecards:card_tnt",
    "minecards:card_zombie",
    "minecards:card_skeleton",
    "minecards:card_spider",
    "minecards:card_player",
    "minecards:card_creeper",
    "minecards:card_diamond_sword",
    "minecards:card_set_nether",
    "minecards:card_the_nether",
    "minecards:card_netherrack",
    "minecards:card_glowstone",
    "minecards:card_nether_quartz",
    "minecards:card_nether_wart",
    "minecards:card_piglin",
    "minecards:card_zombified_piglin",
    "minecards:card_ghast",
    "minecards:card_magma_cube",
    "minecards:card_blaze",
    "minecards:card_nether_fortress",
    "minecards:card_wither",
    "minecards:card_set_end",
    "minecards:card_the_end",
    "minecards:card_endstone",
    "minecards:card_obsidian",
    "minecards:card_chorus_plant",
    "minecards:card_end_crystal",
    "minecards:card_eye_of_ender",
    "minecards:card_elytra",
    "minecards:card_stronghold",
    "minecards:card_end_city",
    "minecards:card_enderman",
    "minecards:card_shulker",
    "minecards:card_ender_dragon",
    "minecards:card_set_aquatic",
    "minecards:card_squid",
    "minecards:card_dolphin",
    "minecards:card_turtle",
    "minecards:card_coral",
    "minecards:card_salmon",
    "minecards:card_pufferfish",
    "minecards:card_guardian",
    "minecards:card_elder_guardian",
    "minecards:card_fishing_rod",
    "minecards:card_kelp",
    "minecards:card_sponge",
    "minecards:card_ocean_monument",
    "minecards:card_set_retro",
    "minecards:card_cobblestone",
    "minecards:card_gravel",
    "minecards:card_rose",
    "minecards:card_cyan_flower",
    "minecards:card_nether_reactor_core",
    "minecards:card_cow_token",
    "minecards:card_sheep_token",
    "minecards:card_zombie_token",
    "minecards:card_skeleton_token",
    "minecards:card_creeper_token",
    "minecards:card_human",
    "minecards:card_testificate",
    "minecards:card_brick_pyramid",
    "minecards:card_feather",
    "minecards:card_disc_eleven",
    "minecards:card_herobrine",
    "minecards:card_the_far_lands",
    "minecards:card_enchanted_golden_apple",
    "minecards:card_set_deep_and_dark",
    "minecards:card_deepslate",
    "minecards:card_glow_berry",
    "minecards:card_dripleaf",
    "minecards:card_sculk",
    "minecards:card_glow_squid",
    "minecards:card_sculk_shrieker",
    "minecards:card_echo_shard",
    "minecards:card_lush_caves",
    "minecards:card_dripstone_caves",
    "minecards:card_deep_dark",
    "minecards:card_warden",
    "minecards:card_ancient_city",
    "minecards:card_ace_of_diamonds",
    "minecards:card_forge",
    "minecards:card_rules_card",
    "minecards:card_blank_card",
  ]);

  // Skinned Lanterns
  event.add("skinnedlanterns:lanterns", /^skinnedlanterns:.*/);

  // Sword in the Stone
  event.add("swordinthestone:swords", /^swordinthestone:.*/);

  // Dice
  event.add("dice:dice", /^dice:.*/);

  // Immersive Armors
  event.add("immersive_armors:armor", /^immersive_armors:.*/);

  // Colored Water Buckets
  event.add(
    "colored_water:waterbuckets",
    /^colored_water:(?!.*condense)(?!.*luminous).*water_bucket$/,
  );

  // Twigs are Sticks
  event.add("forge:rods/wooden", "twigs:twig");

  // Custom Drills
  event.add("createoreexcavation:drills", [
    "createoreexcavation:steel_drill",
    "createoreexcavation:forgotten_drill",
  ]);

  event.add("createoreexcavation:drills", [
    "createoreexcavation:desh_drill",
    "createoreexcavation:ostrum_drill",
    "createoreexcavation:calorite_drill",
  ]);

  // Naturalist Froglass
  event.add("naturalist:froglass", [
    "naturalist:azure_froglass",
    "naturalist:verdant_froglass",
    "naturalist:crimson_froglass",
  ]);

  // Kukulkan Idol Divinity Sacrifices
  event.add("call_of_yucutan:kukulkan_ressources", [
    "scguns:ancient_brass_block",
    "pigsteel:pigsteel_chunk_block",
    "minecards:deckite_block",
    "etcetera:raw_bismuth_block",
  ]);

  // Ah Puch Idol Divinity Sacrifices
  event.add("call_of_yucutan:ah_puch_ressources", [
    "architects_palette:salmon_scales",
    "architects_palette:cod_scales",
    "alexscaves:block_of_pearl",
    "ecologics:seashell_block",
    "crabbersdelight:pearl_block",
    "architects_palette:entrails",
  ]);

  // Quality Crops Dough FD compatibility
  event.add("forge:dough", "qualitycrops:dough");
  event.add("forge:dough/wheat", "qualitycrops:dough");

  // Tentacles are Tentacles
  event.add("forge:tentacles", "oceansdelight:tentacles");

  // Right Click Harvest Hoes
  event.add("minecraft:hoes", [
    "cavesanddepths:rosegoldhoe",
    "create_sa:brass_hoe",
    "create_sa:copper_hoe",
    "create_sa:zinc_hoe",
    "experienceobelisk:cognitive_hoe",
    "nethers_exoticism:kiwano_hoe",
    "seadwellers:depth_hoe",
  ]);

  event.add("rightclickharvest:high_tier_hoes", [
    "deeperdarker:warden_hoe",
    "rats:ratlantis_hoe",
    "seadwellers:depth_hoe",
    "undergarden:forgotten_hoe",
  ]);

  event.add("rightclickharvest:low_tier_hoes", [
    "create_sa:copper_hoe",
    "create_sa:zinc_hoe",
    "embers:lead_hoe",
    "embers:silver_hoe",
    "nethers_exoticism:kiwano_hoe",
    "undergarden:cloggrum_hoe",
    "undergarden:froststeel_hoe",
  ]);

  event.add("rightclickharvest:mid_tier_hoes", [
    "cavesanddepths:rosegoldhoe",
    "experienceobelisk:cognitive_hoe",
    "create_sa:brass_hoe",
    "embers:dawnstone_hoe",
    "undergarden:utherium_hoe",
  ]);

  // Add Proper Tags To Modded Axes
  event.add("minecraft:axes", [
    "cavesanddepths:rosegoldaxe",
    "create_sa:blazing_axe",
    "create_sa:brass_axe",
    "create_sa:copper_axe",
    "create_sa:rose_quartz_axe",
    "create_sa:zinc_axe",
    "create_sa:experience_axe",
    "deeperdarker:warden_axe",
    "experienceobelisk:cognitive_axe",
    "kubejs:stone_hatchet",
    "nethers_exoticism:kiwano_axe",
    "seadwellers:depth_axe",
    "thermal:flux_saw",
  ]);

  // Add Proper Tags To Modded Pickaxes
  event.add("minecraft:pickaxes", [
    "cavesanddepths:rosegoldpickaxe",
    "create_sa:blazing_pickaxe",
    "create_sa:brass_pickaxe",
    "create_sa:copper_pickaxe",
    "create_sa:experience_pickaxe",
    "create_sa:rose_quartz_pickaxe",
    "create_sa:zinc_pickaxe",
    "deeperdarker:warden_pickaxe",
    "experienceobelisk:cognitive_pickaxe",
    "nethers_exoticism:kiwano_pickaxe",
    "seadwellers:depth_pickaxe",
    "thermal:flux_drill",
  ]);

  event.add("create_new_age:magnet", [
    "create_new_age:neodymized_magnet",
    "create_new_age:overcharged_magnet",
    "create_new_age:sculked_magnet",
    "create_new_age:lunar_magnet",
    "create_new_age:martian_magnet",
  ]);

  event.add("create:item_vault_crafting_component", [
    "create_vibrant_vaults:vertical_item_vault",
    "create_connected:item_silo",
    "create_sa:vault_component",
  ]);
});

ServerEvents.tags("fluid", (event) => {
  global.emberMetal.forEach((metalInput) => {
    event.add(`forge:molten_${metalInput}`, `embers:molten_${metalInput}`);
  });

  event.add("bumblezone:sugarwater", "the_bumblezone:sugar_water_still");

  event.add("embers:ingot_tooltip", [
    "embers:molten_froststeel",
    "embers:molten_cloggrum",
  ]);
});

ServerEvents.tags("block", (event) => {
  // Anthill Rotten Plank Tags
  event.add("minecraft:overworld_natural_logs", [
    "ecologics:coconut_log",
    "ecologics:azalea_log",
    "ecologics:walnut_log",
    "thermal:rubberwood_log",
  ]);

  event.add(
    "create_new_age:magnets/strength_14",
    "architects_palette:chiseled_emerald_ore_bricks",
  );
  event.add(
    "create_new_age:magnets/strength_31",
    "architects_palette:chiseled_diamond_ore_bricks",
  );
  //event.add("create_new_age:magnets/strength_79", "twigs:polished_amethyst");
});

ServerEvents.tags("entity_type", (event) => {
  // DMMTTBA Boat Steerable
  event.add("forge:boats", [
    /^alexscaves:.*boat$/,
    /^deeperdarker:.*boat$/,
    /^rats:.*boat$/,
    /^regions_unexplored:.*boat$/,
    /^snifferplus:.*boat$/,
    /^undergarden:.*boat$/,
  ]);

  // Supplementaries Jar Catching
  event.add("supplementaries:jar_catchable", [
    "naturalist:dragonfly",
    "spawn:ant",
    "spawn:snail",
    "alexscaves:gloomoth",
  ]);

  // Supplementaries Cage Catching
  event.add("supplementaries:cage_catchable", [
    "naturalist:dragonfly",
    "spawn:ant",
    "spawn:snail",
    "spawn:hamster",
    "alexscaves:raycat",
    "ecologics:squirrel",
    "alexscaves:gingerbread_man",
    "crabbersdelight:crab",
    "call_of_yucutan:mitnal_monkey",
    "etcetera:chapple",
    "ribbits:ribbit",
    "beggars:villager_beggar",
    "beggars:zombie_beggar",
    "beggars:witch_beggar",
  ]);
});
