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

    const tagAdditions = [
        { tag: 'forge:gems/coal', item: 'minecraft:coal' },
        { tag: 'forge:gems/charcoal', item: 'minecraft:charcoal' },
        { 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: 'create:crushed_ores/netherite_scrap', item: 'emendatusenigmatica:ancient_debris_crushed' },
        { tag: 'mob_grinding_utils:spawner_upgrades', item: 'mob_grinding_utils:spawner_upgrade_width' },
        { tag: 'mob_grinding_utils:spawner_upgrades', item: 'mob_grinding_utils:spawner_upgrade_height' },
        { 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: 'forge:ingots/rubber', item: 'thermal:rubber' },
        { tag: 'forge:ingots', item: 'thermal:rubber' },
        { 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',
        'atum:khnumite_block',
        'botania:mana_diamond_block',
        'botania:dragonstone_block',
    ]

    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);
        }
    });

    relic_material.forEach(mat => {
        let tag = `atum:relic/${mat}`;
        relic_type.forEach(type => {
            let id = `atum:relic_${mat}_${type}`;
            event.get(tag).add(id);
        });
    });
    

})