onEvent('recipes', event =>{
    event.replaceInput({id: 'appliedenergistics2:network/blocks/storage_drive'}, 'minecraft:iron_ingot', 'immersiveengineering:ingot_steel')
    event.replaceInput({id: 'appliedenergistics2:network/blocks/energy_energy_acceptor'}, 'minecraft:iron_ingot', 'immersiveengineering:ingot_steel')
    event.replaceOutput({id: 'create:compat/ae2/milling/certus_quartz'}, 'appliedenergistics2:certus_quartz_dust', 'kubejs:charged_certus_quartz_dust')

    //function for reuse the item in the deployer
    function ifiniDeploying(output, input, tool) {
      return {
          "type": "create:deploying",
          "ingredients": [
              Ingredient.of(input).toJson(),
              Ingredient.of(tool).toJson()
          ],
          "results": [
              Item.of(output).toResultJson()
          ],
          "keepHeldItem": true
      }
    }

    //Printed silicon 
    //console.log("peppuccio")
    event.remove({id: 'appliedenergistics2:inscriber/silicon_print'})
    event.recipes.createSequencedAssembly([
        Item.of('appliedenergistics2:printed_silicon').withChance(99.0),
        Item.of('appliedenergistics2:silicon'), ],
      'appliedenergistics2:silicon', [
        event.custom(ifiniDeploying('create:incomplete_large_cogwheel','create:incomplete_large_cogwheel','appliedenergistics2:silicon_press'))
        ]).transitionalItem('kubejs:incomplete_logic_processor').loops(1)

    //Logic
    event.remove({id: 'appliedenergistics2:inscriber/logic_processor_print'})
    event.recipes.createSequencedAssembly([
        Item.of('appliedenergistics2:printed_logic_processor').withChance(99.0),
        Item.of('create:golden_sheet'), ],
        'create:golden_sheet', [
        event.custom(ifiniDeploying('create:incomplete_large_cogwheel','create:incomplete_large_cogwheel','appliedenergistics2:logic_processor_press'))
        ]).transitionalItem('kubejs:incomplete_logic_processor').loops(1)

    //Calculation
    event.remove({id: 'appliedenergistics2:inscriber/calculation_processor_print'})
    event.recipes.createSequencedAssembly([
        Item.of('appliedenergistics2:printed_calculation_processor').withChance(99.0),
        Item.of('kubejs:certus_quartz_sheet'), ],
        'kubejs:certus_quartz_sheet', [
        event.custom(ifiniDeploying('create:incomplete_large_cogwheel','create:incomplete_large_cogwheel','appliedenergistics2:calculation_processor_press'))
        ]).transitionalItem('kubejs:incomplete_logic_processor').loops(1)
    
    //Engineering
    event.remove({id: 'appliedenergistics2:inscriber/engineering_processor_print'})
    event.recipes.createSequencedAssembly([
        Item.of('appliedenergistics2:printed_engineering_processor').withChance(99.0),
        Item.of('kubejs:diamond_sheet'), ],
        'kubejs:diamond_sheet', [
        event.custom(ifiniDeploying('create:incomplete_large_cogwheel','create:incomplete_large_cogwheel','appliedenergistics2:engineering_processor_press'))
        ]).transitionalItem('kubejs:incomplete_logic_processor').loops(1)

    //Logic Processor
    event.remove({id: 'appliedenergistics2:inscriber/logic_processor'})
    event.recipes.createSequencedAssembly([
        Item.of('appliedenergistics2:logic_processor').withChance(32.0),
        Item.of('appliedenergistics2:printed_logic_processor'), ],
        'appliedenergistics2:printed_logic_processor', [
        event.recipes.createDeploying('create:incomplete_large_cogwheel', ['create:incomplete_large_cogwheel', 'kubejs:integrated_circuit']),
        event.recipes.createPressing('create:incomplete_large_cogwheel', 'create:incomplete_large_cogwheel').processingTime(65)
      ]).transitionalItem('kubejs:incomplete_logic_processor').loops(1)

    //Calculation Processor
    event.remove({id: 'appliedenergistics2:inscriber/calculation_processor'})
    event.recipes.createSequencedAssembly([
        Item.of('appliedenergistics2:calculation_processor').withChance(32.0),
        Item.of('appliedenergistics2:printed_calculation_processor'), ],
        'appliedenergistics2:printed_calculation_processor', [
        event.recipes.createDeploying('create:incomplete_large_cogwheel', ['create:incomplete_large_cogwheel', 'kubejs:integrated_circuit']),
        event.recipes.createPressing('create:incomplete_large_cogwheel', 'create:incomplete_large_cogwheel').processingTime(65)
      ]).transitionalItem('kubejs:incomplete_calculation_processor').loops(1)

    //Engineering Processor
    event.remove({id: 'appliedenergistics2:inscriber/engineering_processor'})
    event.recipes.createSequencedAssembly([
        Item.of('appliedenergistics2:engineering_processor').withChance(60.0),
        Item.of('appliedenergistics2:printed_engineering_processor'), ],
        'appliedenergistics2:printed_engineering_processor', [
        event.recipes.createDeploying('create:incomplete_large_cogwheel', ['create:incomplete_large_cogwheel', 'kubejs:integrated_circuit']),
        event.recipes.createPressing('create:incomplete_large_cogwheel', 'create:incomplete_large_cogwheel').processingTime(65)
        ]).transitionalItem('kubejs:incomplete_engineering_processor').loops(1)

    event.recipes.immersiveengineeringMetalPress('kubejs:certus_quartz_sheet', '2x appliedenergistics2:certus_quartz_dust', 'immersiveengineering:mold_plate')
    event.recipes.immersiveengineeringMetalPress('kubejs:charged_certus_quartz_sheet', '2x kubejs:charged_certus_quartz_dust', 'immersiveengineering:mold_plate')

    event.recipes.createCompacting(['kubejs:diamond_sheet', 'immersiveengineering:mold_plate'],
    ['immersiveengineering:mold_plate', '2x createaddition:diamond_grit'])
    .superheated()

    //lapis sheet
    event.recipes.createCompacting(['kubejs:lapis_sheet', 'immersiveengineering:mold_plate'],
    ['immersiveengineering:mold_plate', '4x minecraft:lapis_lazuli'])
    .heated()

    //lapis sheet
    event.recipes.createCompacting('32x appliedenergistics2:sky_stone_block',
    ['4x create:powdered_obsidian','progressivebosses:nether_star_shard', '4x minecraft:blaze_powder', Fluid.of('minecraft:lava',250)])
    .heated()

    //Silicon with electron tube
    event.recipes.createSequencedAssembly([
      Item.of('kubejs:silicon_with_electron_tube', '{Damage:4}')],
      'appliedenergistics2:printed_silicon', [
      event.recipes.createDeploying('create:incomplete_large_cogwheel', ['create:incomplete_large_cogwheel', 'create:electron_tube']),
      ]).transitionalItem('kubejs:incomplete_logic_processor').loops(1)

    //Silicon with electron tube and a cogwheel
    event.recipes.createSequencedAssembly([
      Item.of('kubejs:silicon_with_electron_tube_and_a_cogwheel', '{Damage:3}')],
      Item.of('kubejs:silicon_with_electron_tube', '{Damage:4}'), [
      event.recipes.createDeploying('create:incomplete_large_cogwheel', ['create:incomplete_large_cogwheel', 'create:cogwheel']),
      ]).transitionalItem('kubejs:incomplete_logic_processor').loops(1)

    //Integrated circuit 1
    event.recipes.createSequencedAssembly([
      Item.of('kubejs:integrated_circuit_1', '{Damage:2}')],
      Item.of('kubejs:silicon_with_electron_tube_and_a_cogwheel', '{Damage:3}'), [
      event.recipes.createDeploying('create:incomplete_large_cogwheel', ['create:incomplete_large_cogwheel', 'minecraft:gold_nugget']),
      ]).transitionalItem('kubejs:incomplete_logic_processor').loops(1)

    //Integrated circuit 2
    event.recipes.createSequencedAssembly([
      Item.of('kubejs:integrated_circuit_2', '{Damage:1}')],
      Item.of('kubejs:integrated_circuit_1', '{Damage:2}'), [
      event.recipes.createDeploying('create:incomplete_large_cogwheel', ['create:incomplete_large_cogwheel', 'kubejs:lapis_sheet']),
      ]).transitionalItem('kubejs:incomplete_logic_processor').loops(1)

    //Integrated circuit
    event.recipes.createSequencedAssembly([
      Item.of('kubejs:integrated_circuit')],
      Item.of('kubejs:integrated_circuit_2', '{Damage:1}'), [
      event.recipes.createPressing('create:incomplete_large_cogwheel', 'create:incomplete_large_cogwheel').processingTime(20)
      ]).transitionalItem('kubejs:incomplete_logic_processor').loops(1)
    
    //Dense Smart Cable
    event.shaped('appliedenergistics2:fluix_smart_dense_cable', [
      'ABA',
      'ACA'
    ], {
      A: 'appliedenergistics2:fluix_smart_cable',
      B: 'minecraft:redstone',
      C: 'minecraft:glowstone_dust'
    })
})

