//priority: 0
onEvent('item.tags', event => {

    const tagAdditions = [
        { tag: 'forge:gems/coal', item: 'minecraft:coal' },
        { tag: 'forge:dusts/blizz', item: 'thermal:blizz_powder' },
        { tag: 'forge:dusts/blitz', item: 'thermal:blitz_powder' },
        { tag: 'forge:dusts/basalz', item: 'thermal:basalz_powder' },
        { tag: 'forge:chunks/nebu', item: 'atum:nebu_ore' },
        { tag: 'forge:dusts/coke', item: 'immersivepetroleum:petcoke_dust' },
        { tag: 'forge:chunks/iesnium', item: 'occultism:iesnium_ore' },
        { tag: 'forge:ores/rock_crystal', item: 'astralsorcery:rock_crystal_ore' },
        { tag: 'forge:nuggets/dryrubber', item: 'industrialforegoing:tinydryrubber' },
        { tag: 'forge:ingots/dryrubber', item: 'industrialforegoing:dryrubber' },
        { tag: 'botania:generating_primitive_flowers', item: 'botania:hydroangeas' },
        { tag: 'botania:generating_primitive_flowers', item: 'botania:endoflame' },
        { tag: 'forge:gems/dimensional', item: 'rftoolsbase:dimensionalshard' },
        { tag: 'forge:gems', item: 'rftoolsbase:dimensionalshard' },
        { tag: 'forge:gems/quartz_dark', item: 'botania:quartz_dark' },
        { tag: 'forge:gems', item: 'botania:quartz_dark' },
        { tag: 'forge:storage_blocks/quartz_dark', item: 'botania:dark_quartz' },
        { tag: 'forge:gems/quartz_red', item: 'botania:quartz_red' },
        { tag: 'forge:gems', item: 'botania:quartz_red' },
        { tag: 'forge:storage_blocks/quartz_red', item: 'botania:red_quartz' },
        { tag: 'forge:gems/quartz_mana', item: 'botania:quartz_mana' },
        { tag: 'forge:gems', item: 'botania:quartz_mana' },
        { tag: 'forge:storage_blocks/quartz_mana', item: 'botania:mana_quartz' },
        { tag: 'forge:gems/quartz_blaze', item: 'botania:quartz_blaze' },
        { tag: 'forge:gems', item: 'botania:quartz_blaze' },
        { tag: 'forge:storage_blocks/quartz_blaze', item: 'botania:blaze_quartz' },
        { tag: 'forge:gems/quartz_lavender', item: 'botania:quartz_lavender' },
        { tag: 'forge:gems', item: 'botania:quartz_lavender' },
        { tag: 'forge:storage_blocks/quartz_lavender', item: 'botania:lavender_quartz' },
        { tag: 'forge:gems/quartz_elven', item: 'botania:quartz_elven' },
        { tag: 'forge:gems', item: 'botania:quartz_elven' },
        { tag: 'forge:storage_blocks/quartz_elven', item: 'botania:elf_quartz' },
        { tag: 'forge:gems/quartz_sunny', item: 'botania:quartz_sunny' },
        { tag: 'forge:gems', item: 'botania:quartz_sunny' },
        { tag: 'forge:storage_blocks/quartz_sunny', item: 'botania:sunny_quartz' },
    ];

    const metalParts = [
        'thermal:blizz_rod',
        'thermal:blitz_rod',
        'thermal:basalz_rod',
        'kubejs:holy_ingot',
        'kubejs:holy_dust',
        'kubejs:holy_plate',
        'kubejs:holy_rod',
        'kubejs:holy_gear',
        'kubejs:holy_block',
        'kubejs:holy_nugget',
        'kubejs:titanium_ingot',
        'kubejs:titanium_dust',
        'kubejs:chromium_ingot',
        'kubejs:chromium_dust',
        'kubejs:vanadium_dust',
        'kubejs:chromium_ore',
        'kubejs:titanium_ore',
        'kubejs:stainless_steel_ingot',
        'kubejs:stainless_steel_dust',
        'kubejs:stainless_steel_plate',
        'kubejs:stainless_steel_rod',
        'kubejs:stainless_steel_gear',
        'kubejs:stainless_steel_block',
        'kubejs:stainless_steel_nugget',
        'kubejs:stainless_steel_sheetmetal',
        'kubejs:aquamarine_block',
        'kubejs:dimension_ingot',
        'kubejs:dimension_plate',
        'kubejs:dimension_rod',
        'kubejs:dimension_gear',
        'kubejs:dimension_block',
        'kubejs:dimension_nugget',
        'kubejs:fluix_steel_dust',
        'kubejs:fluix_steel_plate',
        'kubejs:fluix_steel_rod',
        'kubejs:fluix_steel_gear',
        'kubejs:fluix_steel_block',
        'kubejs:fluix_steel_nugget',
        'kubejs:fluix_steel_sheetmetal',
    ]

    const corals = ['tube', 'brain', 'bubble', 'fire', 'horn'];

    tagAdditions.forEach(addition => {
        event.get(addition.tag).add(addition.item);
    });

    metalParts.forEach(metalPart => {
        let index1 = metalPart.indexOf(':');
        let index2 = metalPart.lastIndexOf('_');
        let part = metalPart.substring(index2+1);
        part = part=='block'? 'storage_blocks':part+'s';
        let metal = metalPart.substring(index1+1, index2);
        event.get(`forge:${part}`).add(metalPart);
        event.get(`forge:${part}/${metal}`).add(metalPart);
    });

    corals.forEach(coral => {
        event.get('forge:coral_fans').add(`minecraft:${coral}_coral_fan`);
        event.get('forge:corals').add(`minecraft:${coral}_coral`);
        event.get('forge:coral_blocks').add(`minecraft:${coral}_coral_block`);
    });

    const crushed_ores = ['iron','gold','copper','zinc','osmium','silver','tin','lead','aluminum','uranium','nickel'];
    crushed_ores.forEach(ore => {
        event.get(`create:crushed_ores/${ore}`).add(`create:crushed_${ore}_ore`);
    });

    colors.forEach(color => {
        if(color=="purple") color = "violet";
        if(color=="cyan") color = "indigo";
        var id = `quark:${color}_crystal_cluster`;
        if(Item.exists(id)){
            event.get('quark:crystal_cluster').add(id);
        }
    })

})