// Script to standardize materials

onEvent('recipes', event => {

    // iron
    event.replaceOutput({}, '#forge:ingots/iron', 'minecraft:iron_ingot')
    event.replaceOutput({}, '#forge:nuggets/iron', 'minecraft:iron_nugget')
    event.replaceOutput({}, '#forge:plates/iron', 'thermal:iron_plate')
    event.replaceOutput({}, '#forge:rods/iron', 'immersiveengineering:stick_iron')

    // gold
    event.replaceOutput({}, '#forge:ingots/gold', 'minecraft:gold_ingot')
    event.replaceOutput({}, '#forge:nuggets/gold', 'minecraft:gold_nugget')
    event.replaceOutput({}, '#forge:plates/gold', 'thermal:gold_plate')
    
    // copper
    event.replaceOutput({}, '#forge:ingots/copper', 'thermal:copper_ingot')
    event.replaceOutput({}, '#forge:nuggets/copper', 'thermal:copper_nugget')
    event.replaceOutput({}, '#forge:plates/copper', 'thermal:copper_plate')

    // tin
    event.replaceOutput({}, '#forge:ingots/tin', 'thermal:tin_ingot')
    event.replaceOutput({}, '#forge:nuggets/tin', 'thermal:tin_nugget')
    event.replaceOutput({}, '#forge:plates/tin', 'thermal:tin_plate')

    // lead
    event.replaceOutput({}, '#forge:ingots/lead', 'thermal:lead_ingot')
    event.replaceOutput({}, '#forge:nuggets/lead', 'thermal:lead_nugget')
    event.replaceOutput({}, '#forge:plates/lead', 'thermal:lead_plate')

    // silver
    event.replaceOutput({}, '#forge:ingots/silver', 'thermal:silver_ingot')
    event.replaceOutput({}, '#forge:nuggets/silver', 'thermal:silver_nugget')
    event.replaceOutput({}, '#forge:plates/silver', 'thermal:silver_plate')

    // nickel
    event.replaceOutput({}, '#forge:ingots/nickel', 'thermal:nickel_ingot')
    event.replaceOutput({}, '#forge:nuggets/nickel', 'thermal:nickel_nugget')
    event.replaceOutput({}, '#forge:plates/nickel', 'thermal:nickel_plate')

    // bronze
    event.replaceOutput({}, '#forge:ingots/bronze', 'thermal:bronze_ingot')
    event.replaceOutput({}, '#forge:nuggets/bronze', 'thermal:bronze_nugget')
    event.replaceOutput({}, '#forge:plates/bronze', 'thermal:bronze_plate')

    // electrum
    event.replaceOutput({}, '#forge:ingots/electrum', 'thermal:electrum_ingot')
    event.replaceOutput({}, '#forge:nuggets/electrum', 'thermal:electrum_nugget')
    event.replaceOutput({}, '#forge:plates/electrum', 'thermal:electrum_plate')

    // constantan
    event.replaceOutput({}, '#forge:ingots/constantan', 'thermal:constantan_ingot')
    event.replaceOutput({}, '#forge:nuggets/constantan', 'thermal:constantan_nugget')
    event.replaceOutput({}, '#forge:plates/constantan', 'thermal:constantan_plate')

    // aluminum
    event.replaceOutput({}, '#forge:ingots/aluminum', 'immersiveengineering:ingot_aluminum')
    event.replaceOutput({}, '#forge:nuggets/aluminum', 'immersiveengineering:nugget_aluminum')
    event.replaceOutput({}, '#forge:plates/aluminum', 'immersiveengineering:plate_aluminum')
    event.replaceOutput({}, '#forge:rods/aluminum', 'immersiveengineering:stick_aluminum')

    // steel
    event.replaceOutput({}, '#forge:ingots/steel', 'immersiveengineering:ingot_steel')
    event.replaceOutput({}, '#forge:nuggets/steel', 'immersiveengineering:nugget_steel')
    event.replaceOutput({}, '#forge:plates/steel', 'immersiveengineering:plate_steel')
    event.replaceOutput({}, '#forge:rods/steel', 'immersiveengineering:stick_steel')

    // uranium
    event.replaceOutput({}, '#forge:ingots/uranium', 'immersiveengineering:ingot_uranium')
    event.replaceOutput({}, '#forge:nuggets/uranium', 'immersiveengineering:nugget_uranium')
    event.replaceOutput({}, '#forge:plates/uranium', 'immersiveengineering:plate_uranium')

    
})

onEvent('item.tags', event => {

    // Add plastic tag to pneumaticcraft plastic
    event.add('forge:plastic', 'pneumaticcraft:plastic')

    // Add prismarine rods tag to outvoted prismarine rod
    event.add('forge:rods/prismarine', 'outvoted:prismarine_rod')

    // Add tooth tag
    event.add('forge:tooth', ['upgrade_aquatic:thrasher_tooth','outvoted:kraken_tooth'])

    //Organics ores
    event.add('forge:ores', ['organics:endium_ore','organics:lava_ore','organics:nether_emerald_ore','organics:nether_diamond_ore','organics:nether_gold_ore','organics:nether_iron_ore','organics:nether_redstone_ore','organics:nether_coal_ore','organics:quartz_ice_ore','organics:gold_terracotta_ore','organics:kuko_ore','organics:iridite_ore','organics:gunpowder_ore','organics:ender_pearl_ore','organics:bone_ore'])
    event.add('forge:ores/emerald', 'organics:nether_emerald_ore')
    event.add('forge:ores/diamond', 'organics:nether_diamond_ore')
    event.add('forge:ores/gold', ['organics:nether_gold_ore','organics:gold_terracotta_ore'])
    event.add('forge:ores/iron', 'organics:nether_iron_ore')
    event.add('forge:ores/redstone', 'organics:nether_redstone_ore')
    event.add('forge:ores/coal', 'organics:nether_coal_ore')
    event.add('forge:ores/quartz', 'organics:quartz_ice_ore')

    //Removed forge nugget tags from immersive engineering nuggets to prevent conflict with thermal
    event.remove('forge:nuggets', ['immersiveengineering:nugget_electrum', 'immersiveengineering:nugget_nickel', 'immersiveengineering:nugget_silver', 'immersiveengineering:nugget_copper', 'immersiveengineering:nugget_lead', 'immersiveengineering:nugget_constantan'])
    event.remove('forge:nuggets/electrum', ['immersiveengineering:nugget_electrum'])
    event.remove('forge:nuggets/nickel', ['immersiveengineering:nugget_nickel'])
    event.remove('forge:nuggets/silver', ['immersiveengineering:nugget_silver'])
    event.remove('forge:nuggets/copper', ['immersiveengineering:nugget_copper'])
    event.remove('forge:nuggets/lead', ['immersiveengineering:nugget_lead'])
    event.remove('forge:nuggets/constantan', ['immersiveengineering:nugget_constantan'])
    
})

//Removed forge nugget tags from immersive engineering nuggets to prevent conflict with thermal
onEvent('item.tags', event => {
    event.remove('forge:nuggets', ['immersiveengineering:nugget_electrum', 'immersiveengineering:nugget_nickel', 'immersiveengineering:nugget_silver', 'immersiveengineering:nugget_copper', 'immersiveengineering:nugget_lead', 'immersiveengineering:nugget_constantan'])
    event.remove('forge:nuggets/electrum', ['immersiveengineering:nugget_electrum'])
    event.remove('forge:nuggets/nickel', ['immersiveengineering:nugget_nickel'])
    event.remove('forge:nuggets/silver', ['immersiveengineering:nugget_silver'])
    event.remove('forge:nuggets/copper', ['immersiveengineering:nugget_copper'])
    event.remove('forge:nuggets/lead', ['immersiveengineering:nugget_lead'])
    event.remove('forge:nuggets/constantan', ['immersiveengineering:nugget_constantan'])
    
})
onEvent('recipes', event => {
    event.remove({output: 'immersiveengineering:nugget_electrum'})
    event.remove({output: 'immersiveengineering:nugget_nickel'})
    event.remove({output: 'immersiveengineering:nugget_silver'})
    event.remove({output: 'immersiveengineering:nugget_copper'})
    event.remove({output: 'immersiveengineering:nugget_lead'})
    event.remove({output: 'immersiveengineering:nugget_constantan'})
    
})