// priority: 10

onEvent('recipes', event => {

const metals = [
    'iron',
    'gold',
    'copper',
    'aluminum',
    'silver',
    'lead',
    'nickel',
    'uranium',
    'osmium',
    'tin',
    'zinc',
    'cobalt',
    'iridium',
    'bronze',
    'brass',
    'constantan',
    'electrum',
    'steel',
    'invar',
    'signalum',
    'lumium',
    'enderium',
    'cast_iron'
]

const gems = [
    'diamond',
    'emerald',
    'lapis'
]

metals.forEach((material) => {
    event.remove({id: `emendatusenigmatica:gear_from_ingot/${material}`})
    event.remove({id: `emendatusenigmatica:plate_from_ingot/${material}`})
    event.remove({id: `thermal:parts/${material}_gear`})
    event.remove({id: `immersiveengineering:plate_${material}_hammering`})
    event.remove({id: `immersiveengineering:crafting/plate_${material}_hammering`})
    event.remove({id: `thermal:machine/press/press_${material}_ingot_to_plate`})
    event.recipes.thermal.crucible(Fluid.of(`emendatusenigmatica:molten_${material}`, 144), `#forge:ingots/${material}`).energy(10000)
    event.recipes.thermal.crucible(Fluid.of(`emendatusenigmatica:molten_${material}`, 1296), `#forge:storage_blocks/${material}`).energy(90000)
    event.recipes.immersiveengineeringMetalPress(`emendatusenigmatica:${material}_plate`, `#forge:ingots/${material}`, 'immersiveengineering:mold_plate')
    event.recipes.immersiveengineeringMetalPress(`emendatusenigmatica:${material}_gear`, `4x #forge:ingots/${material}`, 'immersiveengineering:mold_gear')
    event.recipes.immersiveengineeringMetalPress(`2x emendatusenigmatica:${material}_rod`, `#forge:ingots/${material}`, 'immersiveengineering:mold_rod')
    event.recipes.create.pressing(`emendatusenigmatica:${material}_plate`, `#forge:ingots/${material}`)
    event.recipes.createCutting(`2x emendatusenigmatica:${material}_rod`, `#forge:ingots/${material}`)
    event.recipes.thermal.press(`emendatusenigmatica:${material}_plate`, `#forge:ingots/${material}`).energy(4000)
    event.recipes.thermal.press(`2x emendatusenigmatica:${material}_rod`, [`#forge:ingots/${material}`, "immersiveengineering:mold_rod"]).energy(4000)
    event.recipes.create.milling(`emendatusenigmatica:${material}_dust`, `#forge:ingots/${material}`)
    event.recipes.create.crushing(`emendatusenigmatica:${material}_dust`, `#forge:ingots/${material}`)

    if (material != 'iron' && material != 'gold') {
        event.recipes.thermal.chiller(`emendatusenigmatica:${material}_ingot`, ['thermal:chiller_ingot_cast', Fluid.of(`emendatusenigmatica:molten_${material}`, 144)])
    }
})

gems.forEach(material => { 
    event.remove({id: `thermal:parts/${material}_gear`})

    event.recipes.createCutting(`2x emendatusenigmatica:${material}_rod`, `#forge:gems/${material}`)
    event.recipes.thermal.press(`2x emendatusenigmatica:${material}_rod`, [`#forge:gems/${material}`, "immersiveengineering:mold_rod"]).energy(4000)
    event.recipes.thermal.press(`emendatusenigmatica:${material}_plate`, `#forge:gems/${material}`).energy(4000)
    event.recipes.thermal.press(`emendatusenigmatica:${material}_gear`, [`4x #forge:gems/${material}`, "thermal:press_gear_die"]).energy(4000)
    event.recipes.create.pressing(`emendatusenigmatica:${material}_plate`, `#forge:gems/${material}`)
    event.recipes.immersiveengineeringMetalPress(`2x emendatusenigmatica:${material}_rod`, `#forge:gems/${material}`, 'immersiveengineering:mold_rod')
    event.recipes.immersiveengineeringMetalPress(`emendatusenigmatica:${material}_plate`, `#forge:gems/${material}`, 'immersiveengineering:mold_plate')
    event.recipes.immersiveengineeringMetalPress(`emendatusenigmatica:${material}_gear`, `4x #forge:gems/${material}`, 'immersiveengineering:mold_gear')

    event.remove({output: `emendatusenigmatica:${material}_gear`})
})

event.remove({input: 'immersiveengineering:mold_plate'})
event.remove({input: 'immersiveengineering:mold_gear'})
event.remove({input: 'immersiveengineering:mold_rod'})
event.remove({input: 'thermal:chiller_ingot_cast'})
event.remove({input: 'emendatusenigmatica:enigmatic_hammer'})

const removeId = [
    'industrialforegoing:iron_gear',
    'industrialforegoing:gold_gear',
    'pneumaticcraft:compressed_iron_gear',
    'thermal:parts/netherite_gear',
    'futurepack:spaceship_12',
    'immersiveengineering:crafting/stick_iron',
    'immersiveengineering:crafting/stick_aluminum',
    'immersiveengineering:crafting/stick_steel',
    'industrialforegoing:diamond_gear'
]

removeId.forEach(recipe => event.remove({id: recipe}))

event.recipes.immersiveengineeringMetalPress('thermal:netherite_gear', `4x #forge:ingots/netherite`, 'immersiveengineering:mold_gear')
event.recipes.immersiveengineeringMetalPress('kubejs:platinum_gear', `4x kubejs:platinum_ingot`, 'immersiveengineering:mold_gear')
event.recipes.thermal.press('kubejs:platinum_gear', ['4x kubejs:platinum_ingot', 'thermal:press_gear_die']).energy(3200)
event.recipes.thermal.press('kubejs:platinum_plate', 'kubejs:platinum_ingot').energy(3200)
event.recipes.create.pressing('kubejs:platinum_plate', 'kubejs:platinum_ingot')
event.recipes.immersiveengineeringMetalPress('kubejs:platinum_plate', 'kubejs:platinum_ingot', 'immersiveengineering:mold_plate')
event.recipes.thermal.press('emendatusenigmatica:aluminum_gear', ['4x #forge:ingots/aluminum', 'thermal:press_gear_die']).energy(3200)
event.recipes.thermal.press('emendatusenigmatica:steel_gear', ['4x #forge:ingots/steel', 'thermal:press_gear_die']).energy(3200)
event.recipes.thermal.press('2x immersiveengineering:wire_copper', ['#forge:ingots/copper', "immersiveengineering:mold_wire"]).energy(4000)
event.recipes.thermal.press('2x immersiveengineering:wire_electrum', ['#forge:ingots/electrum', "immersiveengineering:mold_wire"]).energy(4000)
event.recipes.thermal.press('2x immersiveengineering:wire_aluminum', ['#forge:ingots/aluminum', "immersiveengineering:mold_wire"]).energy(4000)
event.recipes.thermal.press('2x immersiveengineering:wire_steel', ['#forge:ingots/steel', "immersiveengineering:mold_wire"]).energy(4000)
event.recipes.thermal.press('2x immersiveengineering:wire_lead', ['#forge:ingots/lead', "immersiveengineering:mold_wire"]).energy(4000)

event.recipes.thermal.chiller('iron_ingot', ['thermal:chiller_ingot_cast', Fluid.of('emendatusenigmatica:molten_iron', 144)])
event.recipes.thermal.chiller('iron_ingot', ['thermal:chiller_ingot_cast', Fluid.of('emendatusenigmatica:molten_iron', 144)])

})
