//Item tags go here
events.listen('item.tags', function (e) {
  var add = function(tag, id) {
    e.get(tag).add(id)
  }
  var remove = function(tag, id) {
    e.get(tag).remove(id)
  }

  //Add
  add('curios:curio',['simplemagnets:basicmagnet','simplemagnets:advancedmagnet'])
  add('curios:angelring',['botania:flight_tiara'])
  add('forge:ores/rat_gem','rats:ratlantean_gem_ore')
  add('forge:ores/dimensionalshard',['rftoolsbase:dimensionalshard_overworld','rftoolsbase:dimensionalshard_overworld','rftoolsbase:dimensionalshard_end'])
  add('forge:ores',['#forge:ores/certus_quartz','#forge:ores/oratchalcum','#forge:ores/rat_gem','#forge:ores/dimensionalshard'])
  add('forge:plastic',['#pneumaticcraft:plastic_sheets','silents_mechanisms:plastic_sheet','mekanism:hdpe_sheet'])
  add('misctags:farmland/tier1',['mysticalagriculture:inferium_farmland','mysticalagriculture:prudentium_farmland','mysticalagriculture:tertium_farmland','mysticalagriculture:imperium_farmland','mysticalagriculture:supremium_farmland','mysticalagradditions:insanium_farmland'])
  add('misctags:farmland/tier2',['mysticalagriculture:prudentium_farmland','mysticalagriculture:tertium_farmland','mysticalagriculture:imperium_farmland','mysticalagriculture:supremium_farmland','mysticalagradditions:insanium_farmland'])
  add('misctags:farmland/tier3',['mysticalagriculture:tertium_farmland','mysticalagriculture:imperium_farmland','mysticalagriculture:supremium_farmland','mysticalagradditions:insanium_farmland'])
  add('misctags:farmland/tier4',['mysticalagriculture:imperium_farmland','mysticalagriculture:supremium_farmland','mysticalagradditions:insanium_farmland'])
  add('misctags:farmland/tier5',['mysticalagriculture:supremium_farmland','mysticalagradditions:insanium_farmland'])
  add('misctags:farmland/tier6',['mysticalagradditions:insanium_farmland'])
  add('misctags:biofuel2',['#minecraft:saplings','#minecraft:leaves','#forge:seeds','minecraft:dried_kelp','minecraft:kelp','minecraft:seagrass','minecraft:grass'])
  add('misctags:biofuel4',['#forge:fruits','minecraft:tall_grass','minecraft:nether_sprouts','minecraft:dried_kelp_block','minecraft:cactus','minecraft:sugar_cane','minecraft:weeping_vines','minecraft:twisting_vines','minecraft:vine','minecraft:melon_slice','byg:skyris_vine','byg:embur_gel_vines'])
  add('misctags:biofuel5',['#forge:vegetables','#forge:cookies','#forge:flour_plants','#forge:mushrooms','#forge:mushroom_stems','#minecraft:flowers','minecraft:lily_pad','minecraft:sea_pickle','minecraft:shroomlight','minecraft:large_fern','minecraft:fern','minecraft:crimson_roots','minecraft:warped_roots','minecraft:carved_pumpkin','minecraft:nether_wart','minecraft:cocoa_beans'])
  add('misctags:biofuel7',['#forge:wart_blocks','#forge:mushroom_caps','minecraft:baked_potato','minecraft:hay_block','#forge:bread'])
  add('misctags:biofuel8',['minecraft:cake','minecraft:pumpkin_pie'])
  add('forge:axes',['minecraft:wooden_axe','minecraft:stone_axe','minecraft:golden_axe','minecraft:iron_axe','minecraft:diamond_axe','minecraft:netherite_axe','byg:pendorite_axe','byg:pendorite_battleaxe','rats:ratlantis_axe','mekanismtools:refined_obsidian_paxel','mekanismtools:refined_obsidian_axe','mekanismtools:steel_axe','mekanismtools:steel_paxel','mekanismtools:refined_glowstone_paxel','mekanismtools:refined_glowstone_axe','mekanismtools:lapis_lazuli_paxel','mekanismtools:lapis_lazuli_axe','mekanismtools:bronze_paxel','mekanismtools:bronze_axe','mekanismtools:osmium_axe','mekanismtools:osmium_paxel','mekanismtools:netherite_paxel','mekanismtools:diamond_paxel','mekanismtools:iron_paxel','mekanismtools:gold_paxel','mekanismtools:stone_paxel','mekanismtools:wood_paxel','immersiveengineering:axe_steel','forbidden_arcanus:bone_axe','forbidden_arcanus:obsidian_axe','forbidden_arcanus:reinforced_arcane_golden_axe','forbidden_arcanus:arcane_golden_axe','forbidden_arcanus:draco_arcanus_axe','bluepower:ruby_axe','bluepower:sapphire_axe','bluepower:malachite_axe','bluepower:amethyst_axe','bluepower:tungcarb_axe','allthemodium:alloy_axe','engineerstools:redia_tool'])
  add('forge:shovels',['minecraft:wooden_shovel','minecraft:stone_shovel','minecraft:golden_shovel','minecraft:iron_shovel','minecraft:diamond_shovel','minecraft:netherite_shovel','byg:pendorite_shovel','rats:ratlantis_shovel','mekanismtools:refined_obsidian_paxel','mekanismtools:refined_obsidian_shovel','mekanismtools:steel_shovel','mekanismtools:steel_paxel','mekanismtools:refined_glowstone_paxel','mekanismtools:refined_glowstone_shovel','mekanismtools:lapis_lazuli_paxel','mekanismtools:lapis_lazuli_shovel','mekanismtools:bronze_paxel','mekanismtools:bronze_shovel','mekanismtools:osmium_shovel','mekanismtools:osmium_paxel','mekanismtools:netherite_paxel','mekanismtools:diamond_paxel','mekanismtools:iron_paxel','mekanismtools:gold_paxel','mekanismtools:stone_paxel','mekanismtools:wood_paxel','immersiveengineering:shovel_steel','forbidden_arcanus:bone_shovel','forbidden_arcanus:obsidian_shovel','forbidden_arcanus:reinforced_arcane_golden_shovel','forbidden_arcanus:arcane_golden_shovel','forbidden_arcanus:draco_arcanus_shovel','bluepower:ruby_shovel','bluepower:sapphire_shovel','bluepower:malachite_shovel','bluepower:amethyst_shovel','bluepower:tungcarb_shovel','engineerstools:redia_tool'])
  add('forge:pickaxes',['minecraft:wooden_pickaxe','minecraft:stone_pickaxe','minecraft:golden_pickaxe','minecraft:iron_pickaxe','minecraft:diamond_pickaxe','minecraft:netherite_pickaxe','byg:pendorite_pickaxe','rats:ratlantis_pickaxe','mekanismtools:refined_obsidian_paxel','mekanismtools:refined_obsidian_pickaxe','mekanismtools:steel_pickaxe','mekanismtools:steel_paxel','mekanismtools:refined_glowstone_paxel','mekanismtools:refined_glowstone_pickaxe','mekanismtools:lapis_lazuli_paxel','mekanismtools:lapis_lazuli_pickaxe','mekanismtools:bronze_paxel','mekanismtools:bronze_pickaxe','mekanismtools:osmium_pickaxe','mekanismtools:osmium_paxel','mekanismtools:netherite_paxel','mekanismtools:diamond_paxel','mekanismtools:iron_paxel','mekanismtools:gold_paxel','mekanismtools:stone_paxel','mekanismtools:wood_paxel','immersiveengineering:pickaxe_steel','forbidden_arcanus:bone_pickaxe','forbidden_arcanus:obsidian_pickaxe','forbidden_arcanus:reinforced_arcane_golden_pickaxe','forbidden_arcanus:arcane_golden_pickaxe','forbidden_arcanus:draco_arcanus_pickaxe','bluepower:ruby_pickaxe','bluepower:sapphire_pickaxe','bluepower:malachite_pickaxe','bluepower:amethyst_pickaxe','bluepower:tungcarb_pickaxe','allthemodium:alloy_pick','engineerstools:redia_tool'])
  add('minecraft:stone_tool_materials',['#forge:stone','#forge:cobblestone'])
  add('minecraft:stone_crafting_materials',['#forge:stone','#forge:cobblestone'])
  add('appliedenergistics2:nether_quartz_dust','#forge:dusts/quartz')
  add('appliedenergistics2:dusts/nether_quartz','#forge:dusts/quartz')
  add('appliedenergistics2:dusts/quartz','#forge:dusts/quartz')
  add('forge:seeds',['bluepower:flax_seeds','immersiveengineering:seed'])
  add('engineerstools:musli_bar_seeds','#forge:seeds')
  add('forge:ingots',['#forge:ingots/unobtainium_allthemodium_alloy','#forge:ingots/vibranium_unobtainium_alloy','#forge:ingots/vibranium_allthemodium_alloy','#forge:ingots/oratchalcum'])
  add('forge:sand',['byg:white_sand','byg:black_sand','byg:purple_sand','byg:blue_sand'])
  add('forge:nuggets','#forge:nuggets/oratchalcum')
  add('forge:fruits',['byg:holly_berries'])
  add('forge:gems/dimensionalshard','rftoolsbase:dimensionalshard')
  add('forge:storage_blocks/uraninite','powah:uraninite_block')
  add('forge:mushroom_caps/black_puff_mushroom','byg:black_puff_mushroom_block')
  add('forge:mushroom_caps/blue_glowshroom','byg:blue_glowshroom_block')
  add('forge:mushroom_caps/weeping_milkcap_mushroom','byg:weeping_milkcap_mushroom_block')
  add('forge:mushroom_caps/green_mushroom','byg:green_mushroom_block')
  add('forge:mushroom_caps/purple_glowshroom','byg:purple_glowshroom_block')
  add('forge:mushroom_caps/brown_mushroom','minecraft:brown_mushroom_block')
  add('forge:mushroom_caps/red_mushroom','minecraft:red_mushroom_block')
  add('forge:mushroom_stems/brown_mushroom','byg:brown_mushroom_stem')
  add('forge:mushroom_stems/red_glowshroom','byg:red_glowshroom_stem')
  add('forge:mushroom_stems/white_mushroom','byg:white_mushroom_stem')
  add('forge:mushroom_stems/yellow_glowshroom','byg:yellow_glowshroom_stem')
  add('forge:mushroom_stems/mushroom','minecraft:mushroom_stem')
  add('forge:mushroom_caps',['#forge:mushroom_caps/red_mushroom','#forge:mushroom_caps/brown_mushroom','#forge:mushroom_caps/blue_glowshroom','#forge:mushroom_caps/purple_glowshroom','#forge:mushroom_caps/green_mushroom','#forge:mushroom_caps/black_puff_mushroom','#forge:mushroom_caps/weeping_milkcap_mushroom'])
  add('forge:mushroom_stems',['#forge:mushroom_stems/mushroom','#forge:mushroom_stems/brown_mushroom','#forge:mushroom_stems/white_mushroom','#forge:mushroom_stems/red_glowshroom','#forge:mushroom_stems/yellow_glowshroom'])
  add('forge:mushrooms',['minecraft:warped_fungus','minecraft:crimson_fungus','byg:blue_glowshroom','byg:purple_glowshroom'])
  add('forge:storage_blocks',['#forge:storage_blocks/uraninite','#forge:storage_blocks/oratchalcum'])
  add('forge:wart_blocks',['minecraft:nether_wart_block','minecraft:warped_wart_block'])
  add('forge:gems/rat_gem','rats:gem_of_ratlantis')
  add('forge:gems',['#forge:gems/dimensionalshard','#forge:gems/rat_gem'])

  //Remove
  remove('forge:leather','forbidden_arcanus:rotten_leather')
  remove('engineerstools:musli_bar_food_blacklisted','minecraft:chicken')
  remove('forge:dyes','mekanism:dust_sulfur')
  remove('forge:dyes/yellow','mekanism:dust_sulfur')
  remove('forge:nether_stars','forbidden_arcanus:dark_nether_star')
  remove('curios:charm',['angelring:itemring'])
  remove('curios:head',['botania:flight_tiara'])
  remove('appliedenergistics2:glass',['#forge:glass','minecraft:glass'])
  remove('appliedenergistics2:metal_ingots',['#forge:ingots/gold','#forge:ingots/iron'])
  remove('appliedenergistics2:wool','#minecraft:wool')
  remove('appliedenergistics2:workbench','minecraft:crafting_table')
})

//Block tags go here
events.listen('block.tags', function (e) {
  var add = function(tag, id) {
    e.get(tag).add(id)
  }
  var remove = function(tag, id) 
    {e.get(tag).remove(id)
  }

  //Add
  add('forge:ores/certus_quartz',['appliedenergistics2:quartz_ore','appliedenergistics2:charged_quartz_ore'])
  add('forge:ores/oratchalcum','#minecraft:gold_ores')
  add('forge:ores/quartz','#forge:ores/certus_quartz')
  add('forge:ores/rat_gem','rats:ratlantean_gem_ore')
  add('forge:ores/dimensionalshard',['rftoolsbase:dimensionalshard_overworld','rftoolsbase:dimensionalshard_nether','rftoolsbase:dimensionalshard_end'])
  add('forge:ores',['#forge:ores/certus_quartz','#forge:ores/oratchalcum','#forge:ores/rat_gem','#forge:ores/dimensionalshard'])
  add('mekanism:cardboard_blacklist',['#minecraft:wither_immune','potionsmaster:cauldron'])
  add('bagofyurting:blacklist','#mekanism:cardboard_blacklist')
  add('misctags:flowers/draconic_flowers',['minecraft:dragon_egg'])
  add('misctags:flowers/end_flowers',['minecraft:chorus_flower','minecraft:chorus_plant'])
  add('misctags:flowers/forest_flowers',['#minecraft:flowers','minecraft:sweet_berry_bush'])
  add('misctags:flowers/glowing_flowers',['minecraft:shroomlight','minecraft:glowstone','minecraft:redstone_lamp'])
  add('misctags:flowers/magical_flowers',['#botania:special_flowers','#botania:mystical_flowers','#botania:double_mystical_flowers'])
  add('misctags:flowers/nether_flowers',['minecraft:crimson_fungus','minecraft:warped_fungus','minecraft:nether_wart','minecraft:crimson_roots','minecraft:warped_roots','minecraft:weeping_vines','minecraft:twisting_vines'])
  add('misctags:flowers/swamp_flowers',['byg:tiny_lilypads','byg:reeds','byg:cattail','minecraft:lily_pad','minecraft:sugar_cane','minecraft:brown_mushroom','minecraft:red_mushroom'])
  add('misctags:flowers/wither_flowers',['minecraft:wither_rose'])
  add('resourcefulbees:valid_apiary',['minecraft:polished_blackstone_bricks','#misctags:concrete','#mcwwindows:window'])
  add('forge:mushroom_caps/black_puff_mushroom','byg:black_puff_mushroom_block')
  add('forge:mushroom_caps/blue_glowshroom','byg:blue_glowshroom_block')
  add('forge:mushroom_caps/weeping_milkcap_mushroom','byg:weeping_milkcap_mushroom_block')
  add('forge:mushroom_caps/green_mushroom','byg:green_mushroom_block')
  add('forge:mushroom_caps/purple_glowshroom','byg:purple_glowshroom_block')
  add('forge:mushroom_caps/brown_mushroom','minecraft:brown_mushroom_block')
  add('forge:mushroom_caps/red_mushroom','minecraft:red_mushroom_block')
  add('forge:mushroom_stems/brown_mushroom','byg:brown_mushroom_stem')
  add('forge:mushroom_stems/red_glowshroom','byg:red_glowshroom_stem')
  add('forge:mushroom_stems/white_mushroom','byg:white_mushroom_stem')
  add('forge:mushroom_stems/yellow_glowshroom','byg:yellow_glowshroom_stem')
  add('forge:mushroom_stems/mushroom','minecraft:mushroom_stem')
  add('forge:mushroom_caps',['#forge:mushroom_caps/red_mushroom','#forge:mushroom_caps/brown_mushroom','#forge:mushroom_caps/blue_glowshroom','#forge:mushroom_caps/purple_glowshroom','#forge:mushroom_caps/green_mushroom','#forge:mushroom_caps/black_puff_mushroom','#forge:mushroom_caps/weeping_milkcap_mushroom'])
  add('forge:mushroom_stems',['#forge:mushroom_stems/mushroom','#forge:mushroom_stems/brown_mushroom','#forge:mushroom_stems/white_mushroom','#forge:mushroom_stems/red_glowshroom','#forge:mushroom_stems/yellow_glowshroom'])
  add('forge:mushrooms',['minecraft:warped_fungus','minecraft:crimson_fungus','byg:blue_glowshroom','byg:purple_glowshroom'])
  add('forge:storage_blocks',['#forge:storage_blocks/uraninite','#forge:storage_blocks/oratchalcum'])
  add('forge:storage_blocks/uraninite','powah:uraninite_block')
  add('forge:storage_blocks/oratchalcum','rats:oratchalcum_block')

  //Special tag systems
  function special(tags, items) {
    var tag = e.get(tags)
    ingredient.of(items).stacks.forEach(stack => tag.add(stack.id))
  }
  special('mcwwindows:window','/mcwwindows:.+_win/')
  special('misctags:concrete','/minecraft:.+_concrete/')
  special('mekanism:cardboard_blacklist',['/refinedstorage:.+/','/waystones:.+/','/appliedenergistics2:.+/','appliedenergistics2:cable_bus'])
})

//Fluid tags go here
events.listen('fluid.tags', function (e) {
  var add = function(tag, id) 
    {e.get(tag).add(id)
  }
  var remove = function(tag, id) 
    {e.get(tag).remove(id)
  }
  //Add
  add('forge:essence','pneumaticcraft:memory_essence')
})