// All recipe handelling

/*

// name
event.remove({output: ''}) 
event.shaped('', [
    '',
    '',
    ''
], {
    T: ''
}).id('kjs:')

*/

onEvent('recipes', event => {
    // ======================== Remove recipes ========================
    event.remove({output: 'advancedperipherals:chunk_controller'})

    event.remove({output: 'bountiful:bountyboard'})
    event.remove({output: 'bountiful:decree'})

    event.remove({id: 'charm:extra_recipes/trident'})
    event.remove({id: 'upgrade_aquatic:trident'})

    event.remove({id: 'quark:tweaks/smelting/bone_meal_utility'})

    event.remove({output: 'forbidden_arcanus:eternal_stella'})
    event.remove({input: 'forbidden_arcanus:eternal_stella'})

    event.remove({output: 'extraspace:extra_space_medium_back_pack'})
    event.remove({output: 'extraspace:extra_space_small_back_pack'})

    event.remove({output: 'pneumaticcraft:drone'})
    event.remove({output: '#pneumaticcraft:basic_drones'})

    event.remove({output: 'dannys_expansion:blue_slime'})
    event.remove({output: 'dannys_expansion:life_essence'})
    event.remove({output: 'dannys_expansion:slime'})

    event.remove({output: 'mekanism:upgrade_anchor'})

    event.remove({output: 'mining_helmet:mining_helmet'})

    event.remove({output: 'calemiutils:blueprint_filler'})

    event.remove({output: 'calemiutils:sledgehammer_wood'})
    event.remove({output: 'calemiutils:sledgehammer_stone'})
    event.remove({output: 'calemiutils:sledgehammer_iron'})
    event.remove({output: 'calemiutils:sledgehammer_gold'})
    event.remove({output: 'calemiutils:sledgehammer_diamond'})
    event.remove({output: 'calemiutils:sledgehammer_netherite'})
    event.remove({output: 'calemiutils:sledgehammer_starlight'})

    event.remove({id: 'organics:blaze_rod_recipe'})

    event.remove({id: 'quark:building/crafting/chests/chest_revert'})

    // ======================== Add New Recipes ========================
    // Best Book
    event.smelting(Item.of('minecraft:written_book', {pages:["{\"text\":\"Kekw\"}"],title:"Secrets Of EC.",author:"Eclipse Co"}), 'minecraft:netherite_block').id('eclipse:secret_recipe')

    event.shapeless('minecraft:chest', ['#forge:chests/wooden']).id('kjs:vanilla_chest')
    // ========================== Edit Recipes =========================
    // Trident
    event.remove({output: 'minecraft:trident'})
    event.shaped('minecraft:trident', [
        ' TT',
        ' HT',
        'R  '
    ], {
        T: '#forge:tooth',
        H: 'minecraft:heart_of_the_sea',
        R: '#forge:rods/prismarine'
    }).id('kjs:trident')

    // RFtools Builder
    event.remove({output: 'rftoolsbuilder:builder'})
    event.shaped('rftoolsbuilder:builder', [
        'BPB',
        'RMR',
        'BRB'
    ], {
        M: 'industrialforegoing:machine_frame_advanced',
        B: 'minecraft:bricks',
        R: 'minecraft:redstone',
        P: 'rftoolsbase:infused_enderpearl'
    }).id('kjs:rftools_builder')

    // mekanism digital miner
    event.remove({output: 'mekanism:digital_miner'})
    event.shaped('mekanism:digital_miner', [
        'PCP',
        'LRL',
        'TMT'
    ], {
        P: 'mekanism:pellet_polonium',
        C: 'mekanism:ultimate_control_circuit',
        L: 'mekanism:logistical_sorter',
        R: 'mekanism:robit',
        T: 'mekanism:teleportation_core',
        M: 'industrialforegoing:machine_frame_supreme'
    }).id('kjs:digital_miner')

    // shrinking device
    event.remove({output: 'shrink:shrinking_device'})
    event.shaped('shrink:shrinking_device', [
        'SCS',
        'SGS',
        'SMS'
    ], {
        S: '#forge:plates/steel',
        C: 'mekanism:ultimate_control_circuit',
        G: 'betterendforge:eternal_crystal',
        M: 'industrialforegoing:machine_frame_advanced'
    }).id('kjs:shrinking_device')

    // calemi's utils motor
    event.remove({output: 'calemiutils:motor'})
    event.shaped('calemiutils:motor', [
        'IRI',
        'IMI',
        'IRI'
    ], {
        I: '#forge:plates/iron',
        R: 'minecraft:redstone',
        M: 'immersiveengineering:component_iron'
    }).id('kjs:motor')

    // Leadstone Jetpack
    event.shaped('simplyjetpacks:jetpack_te1', [
        'LCL',
        'LSL',
        'T T'
    ], {
        L: '#forge:ingots/lead',
        C: 'thermal:rf_coil',
        S: 'simplyjetpacks:leather_strap',
        T: 'simplyjetpacks:thruster_te1'
    }).id('kjs:leadstone_jetpack')

    // Hardened Jetpack
    event.shaped('simplyjetpacks:jetpack_te2', [
        'ICI',
        'IJI',
        'T T'
    ], {
        I: '#forge:ingots/invar',
        C: 'thermal:upgrade_augment_1',
        J: 'simplyjetpacks:jetpack_te1',
        T: 'simplyjetpacks:thruster_te2'
    }).id('kjs:hardened_jetpack')

    // Electrum Jetpack
    event.shaped('simplyjetpacks:jetpack_te3', [
        'ICI',
        'IJI',
        'T T'
    ], {
        I: '#forge:ingots/electrum',
        C: 'thermal:upgrade_augment_2',
        J: 'simplyjetpacks:jetpack_te2',
        T: 'simplyjetpacks:thruster_te3'
    }).id('kjs:electrum_jetpack')

    // Resonant Jetpack
    event.shaped('simplyjetpacks:jetpack_te4', [
        'ICI',
        'IJI',
        'T T'
    ], {
        I: '#forge:ingots/enderium',
        C: 'thermal:upgrade_augment_3',
        J: 'simplyjetpacks:jetpack_te3',
        T: 'simplyjetpacks:thruster_te4'
    }).id('kjs:resonant_jetpack')

    // Leadstone Thruster
    event.shaped('simplyjetpacks:thruster_te1', [
        'ICI',
        'RER',
        'ISI'
    ], {
        I: '#forge:ingots/lead',
        C: 'thermal:rf_coil',
        R: 'minecraft:redstone',
        E: 'thermal:energy_cell',
        S: 'thermal:redstone_servo'
    }).id('kjs:leadstone_thruster')

    // Hardened Thruster
    event.shaped('simplyjetpacks:thruster_te2', [
        'ICI',
        'SES',
        'IGI'
    ], {
        I: '#forge:ingots/invar',
        C: 'thermal:upgrade_augment_1',
        S: '#forge:glass',
        E: 'thermal:energy_cell',
        G: '#forge:gears/gold'
    }).id('kjs:hardened_thruster')

    // Reinforced Thruster
    event.shaped('simplyjetpacks:thruster_te3', [
        'ICI',
        'SES',
        'IGI'
    ], {
        I: '#forge:ingots/electrum',
        C: 'thermal:upgrade_augment_2',
        S: '#forge:gems/quartz',
        E: 'thermal:energy_cell',
        G: '#forge:gears/signalum'
    }).id('kjs:reinforced_thruster')

    // Resonant Thruster
    event.shaped('simplyjetpacks:thruster_te4', [
        'ICI',
        'SES',
        'IGI'
    ], {
        I: '#forge:ingots/enderium',
        C: 'thermal:upgrade_augment_3',
        S: '#thermal:glass/hardened',
        E: 'thermal:energy_cell',
        G: '#forge:gears/lumium'
    }).id('kjs:resonant_thruster')

    // Location Link Book
    event.remove({output: 'calemiutils:link_book_location'})
    event.shapeless('calemiutils:link_book_location', ['rftoolsbase:infused_enderpearl', 'minecraft:book', 'supplementaries:globe']).id('kjs:link_book_location')

    // Mana Fiber
    event.remove({output: 'ars_nouveau:mana_fiber'})
    event.shapeless('2x ars_nouveau:mana_fiber', ['8x ars_nouveau:mana_bloom', 'ars_nouveau:mana_gem']).id('kjs:mana_fiber')
    event.shaped('2x ars_nouveau:mana_fiber', [
        'BBB',
        'BGB',
        'BBB'
    ], {
        B: 'ars_nouveau:mana_bloom',
        G: 'ars_nouveau:mana_gem'
    }).id('kjs:mana_fiber')

    // Blaze Fiber
    event.remove({output: 'ars_nouveau:blaze_fiber'})
    event.shapeless('4x ars_nouveau:blaze_fiber', ['8x ars_nouveau:mana_fiber', 'xreliquary:molten_core']).id('kjs:blaze_fiber')
    event.shaped('4x ars_nouveau:blaze_fiber', [
        'FFF',
        'FCF',
        'FFF'
    ], {
        F: 'ars_nouveau:mana_fiber',
        C: 'xreliquary:molten_core'
    }).id('kjs:blaze_fiber')

    //End Fiber
    event.remove({output: 'ars_nouveau:end_fiber'})
    event.shapeless('4x ars_nouveau:end_fiber', ['8x ars_nouveau:blaze_fiber', 'forbidden_arcanus:dragon_scale']).id('kjs:end_fiber')
    event.shaped('4x ars_nouveau:end_fiber', [
        'FFF',
        'FSF',
        'FFF'
    ], {
        F: 'ars_nouveau:blaze_fiber',
        S: 'forbidden_arcanus:dragon_scale'
    }).id('kjs:end_fiber')

    //Flux Core
    event.remove({output: 'fluxnetworks:flux_core'})
    event.shaped('2x fluxnetworks:flux_core', [
        'DOD',
        'OPO',
        'DOD'
    ], {
        D: 'fluxnetworks:flux_dust',
        O: 'mekanism:enriched_refined_obsidian',
        P: 'rftoolsbase:infused_enderpearl'
    }).id('kjs:flux_core')

    //Flux Plug
    event.remove({output: 'fluxnetworks:flux_plug'})
    event.shaped('fluxnetworks:flux_plug', [
        'DFD',
        'FCF',
        'DFD'
    ], {
        D: 'fluxnetworks:flux_dust',
        F: 'fluxnetworks:flux_core',
        C: 'mekanism:teleportation_core'
    }).id('kjs:flux_plug')

    //Flux Point
    event.remove({output: 'fluxnetworks:flux_point'})
    event.shaped('fluxnetworks:flux_point', [
        'DFD',
        'FCF',
        'DFD'
    ], {
        D: 'minecraft:redstone',
        F: 'fluxnetworks:flux_core',
        C: 'mekanism:teleportation_core'
    }).id('kjs:flux_point')

    //Flux Controller
    event.remove({output: 'fluxnetworks:flux_controller'})
    event.shaped('fluxnetworks:flux_controller', [
    'BBB',
    'FCF',
    'BBB'
    ], {
        B: 'fluxnetworks:flux_block',
    F: 'fluxnetworks:flux_core',
    C: 'mekanism:ultimate_control_circuit'
    }).id('kjs:flux_controller')

    //Basic Flux Storage
    event.remove({output: 'fluxnetworks:basic_flux_storage'})
    event.shaped('fluxnetworks:basic_flux_storage', [
        'BBB',
        'CFC',
        'BBB'
    ], {
        B: 'fluxnetworks:flux_block',
        F: 'fluxnetworks:flux_core',
        C: 'betterendforge:eternal_crystal'
    }).id('kjs:basic_flux_storage')

    //Herculean Flux Storage
    event.remove({output: 'fluxnetworks:herculean_flux_storage'})
    event.shaped('fluxnetworks:herculean_flux_storage', [
        'SSS',
        'CFC',
        'SSS'
    ], {
        S: 'fluxnetworks:basic_flux_storage',
        C: 'betterendforge:eternal_crystal',
        F: 'fluxnetworks:flux_core'
    }).id('kjs:herculean_flux_storage')

    //Gargantuan Flux Storage
    event.remove({output: 'fluxnetworks:gargantuan_flux_storage'})
    event.shaped('fluxnetworks:gargantuan_flux_storage', [
        'SSS',
        'CFC',
        'SSS'
    ], {
        S: 'fluxnetworks:herculean_flux_storage',
        C: 'betterendforge:eternal_crystal',
        F: 'minecraft:nether_star'
    }).id('kjs:gargantuan_flux_storage')

    // Item Pipe
    event.remove({output: 'pipez:item_pipe'})
    event.shaped('8x pipez:item_pipe', [
        '   ',
        'PIP',
        '   '
    ], {
        P: 'industrialforegoing:plastic',
        I: 'minecraft:iron_ingot'
    }).id('kjs:item_pipe')

    // Fluid Pipe
    event.remove({output: 'pipez:fluid_pipe'})
    event.shaped('8x pipez:fluid_pipe', [
        '   ',
        'PBP',
        '   '
    ], {
        P: 'industrialforegoing:plastic',
        B: 'minecraft:glass_bottle'
    }).id('kjs:fluid_pipe')

    // Energy Pipe
    event.remove({output: 'pipez:energy_pipe'})
    event.shaped('8x pipez:energy_pipe', [
        '   ',
        'PRP',
        '   '
    ], {
        P: 'industrialforegoing:plastic',
        R: 'minecraft:redstone'
    }).id('kjs:energy_pipe')

    // Gas Pipe
    event.remove({output: 'pipez:gas_pipe'})
    event.shaped('8x pipez:gas_pipe', [
        '   ',
        'PAP',
        '   '
    ], {
        P: 'industrialforegoing:plastic',
        A: 'mekanism:alloy_infused'
    }).id('kjs:gas_pipe')

    // Basic Upgrade
    event.remove({output: 'pipez:basic_upgrade'})
    event.shaped('pipez:basic_upgrade', [
        'RIR',
        'PNP',
        'RXR'
    ], {
        R: 'minecraft:redstone',
        I: 'minecraft:iron_ingot',
        P: 'industrialforegoing:plastic',
        N: 'minecraft:iron_nugget',
        X: 'minecraft:paper'
    }).id('kjs:basic_upgrade')

    // Improved Upgrade
    event.remove({output: 'pipez:improved_upgrade'})
    event.shaped('pipez:improved_upgrade', [
        'RGR',
        'PUP',
        'RXR'
    ], {
        R: 'minecraft:redstone',
        G: 'minecraft:gold_ingot',
        P: 'industrialforegoing:plastic',
        U: 'pipez:basic_upgrade',
        X: 'minecraft:paper'
    }).id('kjs:improved_upgrade')

    // Advanced Upgrade
    event.remove({output: 'pipez:advanced_upgrade'})
    event.shaped('pipez:advanced_upgrade', [
        'RDR',
        'PUP',
        'RXR'
    ], {
        R: 'minecraft:redstone',
        D:  'minecraft:diamond',
        P: 'industrialforegoing:plastic',
        U: 'pipez:improved_upgrade',
        X: 'minecraft:paper'
    }).id('kjs:advanced_upgrade')

    // Ultimate Upgrade
    event.remove({output: 'pipez:ultimate_upgrade'})
    event.shaped('pipez:ultimate_upgrade', [
        'RNR',
        'PUP',
        'RXR'
    ], {
        R: 'minecraft:redstone',
        N: 'minecraft:netherite_scrap',
        P: 'industrialforegoing:plastic',
        U: 'pipez:advanced_upgrade',
        X: 'minecraft:paper'
    }).id('kjs:ultimate_upgrade')
    
    // Laser Drill
    event.remove({output: 'industrialforegoing:laser_drill'}) 
    event.shaped('industrialforegoing:laser_drill', [
        'PDP',
        'IMI',
        'GLG'
    ], {
        P: 'industrialforegoing:plastic',
        D:'thermal:diamond_gear',
        I: 'minecraft:iron_block',
        M: 'industrialforegoing:machine_frame_advanced',
        G: 'thermal:gold_gear',
        L: 'industrialforegoing:laser_lens0'
    }).id('kjs:laser_drill')

    // Fluid Laser Base
    event.remove({output: 'industrialforegoing:fluid_laser_base'}) 
    event.shaped('industrialforegoing:fluid_laser_base', [
        'PSP',
        'HMH',
        'DLD'
    ], {
        P: 'industrialforegoing:plastic',
        S: 'minecraft:nether_star',
        H: 'minecraft:heart_of_the_sea',
        M: 'industrialforegoing:machine_frame_advanced',
        D: 'thermal:diamond_gear',
        L: 'industrialforegoing:laser_lens0'
    }).id('kjs:fluid_laser_base')

    // Ore Laser Base
    event.remove({output: 'industrialforegoing:ore_laser_base'}) 
    event.shaped('industrialforegoing:ore_laser_base', [
        'PSP',
        'NMN',
        'DLD'
    ], {
        P: 'industrialforegoing:plastic',
        S: 'minecraft:nether_star',
        N: 'minecraft:netherite_ingot',
        M: 'industrialforegoing:machine_frame_supreme',
        D: 'thermal:diamond_gear',
        L: 'industrialforegoing:laser_lens0'
    }).id('kjs:ore_laser_base')

    //Quark Iron Plates
    event.remove({output: 'quark:iron_plate'})
    event.shaped('24x quark:iron_plate', [
        'III',
        'INI',
        'III'
    ], {
        I: '#forge:ingots/iron',
        N: '#forge:nuggets/iron'
    }).id('quark:ironplate')

    //Blaze Mesh block
    event.remove({output: 'organics:blaze_rod_block'})
    event.shaped('organics:blaze_rod_block', [
        'RRR',
        'RPR',
        'RRR'
    ], {
        P: 'minecraft:blaze_powder',
        R: '#forge:rods/blaze'
    }).id('kjs:blaze_rod_block')

})