/*
██╗  ██╗ █████╗ ██╗   ██╗███████╗███╗   ██╗    ███╗   ███╗ ██████╗ ██████╗ ██████╗  █████╗  ██████╗██╗  ██╗███████╗
██║  ██║██╔══██╗██║   ██║██╔════╝████╗  ██║    ████╗ ████║██╔═══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║ ██╔╝██╔════╝
███████║███████║██║   ██║█████╗  ██╔██╗ ██║    ██╔████╔██║██║   ██║██║  ██║██████╔╝███████║██║     █████╔╝ ███████╗
██╔══██║██╔══██║╚██╗ ██╔╝██╔══╝  ██║╚██╗██║    ██║╚██╔╝██║██║   ██║██║  ██║██╔═══╝ ██╔══██║██║     ██╔═██╗ ╚════██║
██║  ██║██║  ██║ ╚████╔╝ ███████╗██║ ╚████║    ██║ ╚═╝ ██║╚██████╔╝██████╔╝██║     ██║  ██║╚██████╗██║  ██╗███████║
╚═╝  ╚═╝╚═╝  ╚═╝  ╚═══╝  ╚══════╝╚═╝  ╚═══╝    ╚═╝     ╚═╝ ╚═════╝ ╚═════╝ ╚═╝     ╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝╚══════╝
*/
ServerEvents.recipes(e => {
    let incompleteBasic = 'haven:incomplete_research_tier_basic';
    let incompleteIntermediate = 'haven:incomplete_research_tier_intermediate';
    let incompleteElite = 'haven:incomplete_research_tier_elite';
    let incompleteUltimate = 'haven:incomplete_research_tier_ultimate';

    // Incomplete Basic Research Tier
    e.recipes.createMechanicalCrafting(incompleteBasic, [
        "  SSS  ",
        " SAAAS ",
        "SANCNAS",
        "SAAUAAS",
        "SANCNAS",
        " SAAAS ",
        "  SSS  "
    ], {
        S: 'mekanism:basic_control_circuit',
        A: 'powah:crystal_blazing',
        N: 'create:rose_quartz',
        U: 'bloodmagic:blankslate',
        C: 'thermal:rf_coil'
    })

    // Incomplete Intermediate Research Tier
    e.recipes.createMechanicalCrafting(incompleteIntermediate, [
        "  SSS  ",
        " SAAAS ",
        "SANCNAS",
        "SAAUAAS",
        "SANCNAS",
        " SAAAS ",
        "  SSS  "
    ], {
        S: 'mekanism:advanced_control_circuit',
        A: 'powah:crystal_niotic',
        N: 'create:polished_rose_quartz',
        U: 'bloodmagic:reinforcedslate',
        C: 'thermal:rf_coil'
    })

    // Incomplete Elite Research Tier
    e.recipes.createMechanicalCrafting(incompleteElite, [
        "  SSS  ",
        " SAAAS ",
        "SANCNAS",
        "SAAUAAS",
        "SANCNAS",
        " SAAAS ",
        "  SSS  "
    ], {
        S: 'mekanism:elite_control_circuit',
        A: 'powah:crystal_spirited',
        N: 'create_new_age:overcharged_golden_sheet',
        U: 'bloodmagic:infusedslate',
        C: 'thermal:rf_coil'
    })

    // Incomplete Ultimate Research Tier
    e.recipes.createMechanicalCrafting(incompleteUltimate, [
        "  SSS  ",
        " SAAAS ",
        "SANCNAS",
        "SAAUAAS",
        "SANCNAS",
        " SAAAS ",
        "  SSS  "
    ], {
        S: 'mekanism:ultimate_control_circuit',
        A: 'powah:crystal_nitro',
        N: 'create_new_age:overcharged_diamond',
        U: 'bloodmagic:demonslate',
        C: 'thermal:rf_coil'
    })

    // Sequenced Assembly for Basic Research Tier
    e.recipes.createSequencedAssembly([
        Item.of('havenalchemy:research_tier_basic').withChance(100)
    ], incompleteBasic, [
        e.recipes.createDeploying(incompleteBasic, [incompleteBasic, 'mekanism:ultimate_control_circuit']),
        e.recipes.createDeploying(incompleteBasic, [incompleteBasic, 'powah:nitro_crystal_block']),
        e.recipes.createDeploying(incompleteBasic, [incompleteBasic, 'create:precision_mechanism']),
        e.recipes.createDeploying(incompleteBasic, [incompleteBasic, 'bloodmagic:demonslate']),
        e.recipes.createPressing(incompleteBasic, incompleteBasic)
    ]).transitionalItem(incompleteBasic).loops(7).id('haven:research_tier_basic')

    // Sequenced Assembly for Intermediate Research Tier
    e.recipes.createSequencedAssembly([
        Item.of('havenalchemy:research_tier_intermediate').withChance(100)
    ], incompleteIntermediate, [
        e.recipes.createDeploying(incompleteIntermediate, [incompleteIntermediate, 'mekanism:ultimate_control_circuit']),
        e.recipes.createDeploying(incompleteIntermediate, [incompleteIntermediate, 'powah:nitro_crystal_block']),
        e.recipes.createDeploying(incompleteIntermediate, [incompleteIntermediate, 'create:precision_mechanism']),
        e.recipes.createDeploying(incompleteIntermediate, [incompleteIntermediate, 'bloodmagic:demonslate']),
        e.recipes.createPressing(incompleteIntermediate, incompleteIntermediate)
    ]).transitionalItem(incompleteIntermediate).loops(9).id('haven:research_tier_intermediate')

    // Sequenced Assembly for Elite Research Tier
    e.recipes.createSequencedAssembly([
        Item.of('havenalchemy:research_tier_elite').withChance(100)
    ], incompleteElite, [
        e.recipes.createDeploying(incompleteElite, [incompleteElite, 'mekanism:ultimate_control_circuit']),
        e.recipes.createDeploying(incompleteElite, [incompleteElite, 'powah:nitro_crystal_block']),
        e.recipes.createDeploying(incompleteElite, [incompleteElite, 'create:precision_mechanism']),
        e.recipes.createDeploying(incompleteElite, [incompleteElite, 'bloodmagic:demonslate']),
        e.recipes.createPressing(incompleteElite, incompleteElite)
    ]).transitionalItem(incompleteElite).loops(11).id('haven:research_tier_elite')

    // Sequenced Assembly for Ultimate Research Tier
    e.recipes.createSequencedAssembly([
        Item.of('havenalchemy:research_tier_ultimate').withChance(100)
    ], incompleteUltimate, [
        e.recipes.createDeploying(incompleteUltimate, [incompleteUltimate, 'mekanism:ultimate_control_circuit']),
        e.recipes.createDeploying(incompleteUltimate, [incompleteUltimate, 'powah:nitro_crystal_block']),
        e.recipes.createDeploying(incompleteUltimate, [incompleteUltimate, 'create:precision_mechanism']),
        e.recipes.createDeploying(incompleteUltimate, [incompleteUltimate, 'bloodmagic:demonslate']),
        e.recipes.createPressing(incompleteUltimate, incompleteUltimate)
    ]).transitionalItem(incompleteUltimate).loops(15).id('haven:research_tier_ultimate')

    // Infinite Storage Disk
    e.recipes.createMechanicalCrafting('extradisks:infinite_storage_disk', [
        "ZYYXYYZ",
        "YWASAWY",
        "YPCVEPY",
        "XSVFVSX",
        "YPEVCPY",
        "YWASAWY",
        "ZYYXYYZ"
    ], {
        P: 'mekanism:pellet_antimatter',
        E: 'extradisks:advanced_storage_housing',
        A: 'industrialforegoing:machine_frame_supreme',
        S: 'mekanism:ultimate_control_circuit',
        V: 'havenalchemy:void_matter',
        F: 'ad_astra:calorite_block',
        C: 'havenalchemy:neosphore_block',
        W: 'havenalchemy:research_tier_basic',
        X: 'havenalchemy:research_tier_intermediate',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:infinite_storage_disk')

    // Infinite Fluid Storage Disk
    e.recipes.createMechanicalCrafting('extradisks:infinite_fluid_storage_disk', [
        "ZYYXYYZ",
        "YWASAWY",
        "YPCVEPY",
        "XSVFVSX",
        "YPEVCPY",
        "YWASAWY",
        "ZYYXYYZ"
    ], {
        P: 'mekanism:pellet_antimatter',
        E: 'extradisks:advanced_storage_housing',
        A: 'mekanism:ultimate_fluid_tank',
        S: 'mekanism:ultimate_control_circuit',
        V: 'havenalchemy:void_matter',
        F: 'ad_astra:calorite_block',
        C: 'havenalchemy:neosphore_block',
        W: 'havenalchemy:research_tier_basic',
        X: 'havenalchemy:research_tier_intermediate',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:infinite_fluid_storage_disk')

    // Creative Reclamation Chamber
    e.recipes.createMechanicalCrafting('thermal:machine_catalyst_creative_augment', [
        "ZYYXYYZ",
        "YWPMPWY",
        "YPAVAPY",
        "XSVEVSX",
        "YPAVAPY",
        "YWPMPWY",
        "ZYYXYYZ"
    ], {
        E: 'thermal:machine_catalyst_augment',
        P: 'mekanism:pellet_antimatter',
        M: 'mekanism:ultimate_control_circuit',
        A: 'industrialforegoing:machine_frame_supreme',
        S: 'rebornstorage:super_advanced_processor',
        V: 'havenalchemy:void_matter',
        W: 'havenalchemy:research_tier_basic',
        X: 'havenalchemy:research_tier_intermediate',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:machine_catalyst_creative_augment')

    // Machine Efficiency Creative Augment
    e.recipes.createMechanicalCrafting('thermal:machine_efficiency_creative_augment', [
        "ZYYXYYZ",
        "YWPMPWY",
        "YPAVAPY",
        "XSVEVSX",
        "YPAVAPY",
        "YWPMPWY",
        "ZYYXYYZ"
    ], {
        E: 'thermal:machine_efficiency_augment',
        P: 'mekanism:pellet_antimatter',
        M: 'mekanism:ultimate_control_circuit',
        A: 'industrialforegoing:machine_frame_supreme',
        S: 'rebornstorage:super_advanced_processor',
        V: 'havenalchemy:void_matter',
        W: 'havenalchemy:research_tier_basic',
        X: 'havenalchemy:research_tier_intermediate',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:machine_efficiency_creative_augment')

    // Fluid Tank Creative Augment
    e.recipes.createMechanicalCrafting('thermal:fluid_tank_creative_augment', [
        "ZYYXYYZ",
        "YWPMPWY",
        "YPAVAPY",
        "XSVEVSX",
        "YPAVAPY",
        "YWPMPWY",
        "ZYYXYYZ"
    ], {
        E: 'thermal:fluid_tank_augment',
        P: 'mekanism:pellet_antimatter',
        M: 'mekanism:ultimate_control_circuit',
        A: 'industrialforegoing:machine_frame_supreme',
        S: 'rebornstorage:super_advanced_processor',
        V: 'havenalchemy:void_matter',
        W: 'havenalchemy:research_tier_basic',
        X: 'havenalchemy:research_tier_intermediate',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:fluid_tank_creative_augment')

    // RF Coil Creative Augment
    e.recipes.createMechanicalCrafting('thermal:rf_coil_creative_augment', [
        "ZYYXYYZ",
        "YWPMPWY",
        "YPAVAPY",
        "XSVEVSX",
        "YPAVAPY",
        "YWPMPWY",
        "ZYYXYYZ"
    ], {
        E: 'thermal:rf_coil',
        P: 'mekanism:pellet_antimatter',
        M: 'mekanism:ultimate_control_circuit',
        A: 'industrialforegoing:machine_frame_supreme',
        S: 'rebornstorage:super_advanced_processor',
        V: 'havenalchemy:void_matter',
        W: 'havenalchemy:research_tier_basic',
        X: 'havenalchemy:research_tier_intermediate',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:rf_coil_creative_augment')

    // Max Storage Upgrade
    e.recipes.createMechanicalCrafting('functionalstorage:max_storage_upgrade', [
        "ZYYXWXYYZ",
        "YBBBBBBBY",
        "YBAAHAABY",
        "XBAEVEABX",
        "WBHVGVHBW",
        "XBAEVEABX",
        "YBAAHAABY",
        "YBBBBBBBY",
        "ZYYXWXYYZ"
    ], {
        A: 'mekanism:pellet_antimatter',
        B: 'mekanism:ultimate_control_circuit',
        E: 'functionalstorage:netherite_upgrade',
        G: 'ad_astra:calorite_block',
        H: 'havenalchemy:neosphore_block',
        V: 'havenalchemy:void_matter',
        W: 'havenalchemy:research_tier_basic',
        X: 'havenalchemy:research_tier_intermediate',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:max_storage_upgrade')
    
    // Creative Activation Crystal
    e.recipes.createMechanicalCrafting('bloodmagic:activationcrystalcreative', [
        "ZYXXWXXYZ",
        "YBBBBBBBY",
        "YBAFAFABY",
        "XBDDDDDBX",
        "WBDGEGDBW",
        "XBDDDDDBX",
        "YBAFAFABY",
        "YBBBBBBBY",
        "ZYXXWXXYZ"
    ], {
        A: 'mekanism:pellet_antimatter',
        B: 'mekanism:ultimate_control_circuit',
        D: 'bloodmagic:etherealslate',
        E: 'ad_astra:calorite_block',
        F: 'havenalchemy:neosphore_block',
        G: 'havenalchemy:void_matter',
        W: 'havenalchemy:research_tier_basic',
        X: 'havenalchemy:research_tier_intermediate',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:creative_activation_crystal')
    
    // Creative Blaze Cake
    e.recipes.createMechanicalCrafting('create:creative_blaze_cake', [
        " CCCCCCC ",
        "CZYXWXYZC",
        "CYAFPFAYC",
        "CXVSVSVXC",
        "CYAFPFAYC",
        "CZYXWXYZC",
        " CCCCCCC "
    ], {
        P: 'mekanism:pellet_antimatter',
        C: 'create:blaze_cake',
        A: 'industrialforegoing:machine_frame_supreme',
        S: 'rebornstorage:super_advanced_processor',
        V: 'havenalchemy:void_matter',
        F: 'ad_astra:calorite_block',
        W: 'havenalchemy:research_tier_basic',
        X: 'havenalchemy:research_tier_intermediate',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:creative_blaze_cake')

    // Creative Controller
    e.recipes.createMechanicalCrafting('refinedstorage:creative_controller', [
        "EEEEEEEEE",
        "PZYXWXYZM",
        "PMVVVMPMM",
        "PEAAASEMM",
        "PAVFEFVAM",
        "PEAAASEMM",
        "PMVVVMPMM",
        "PZYXWXYZM",
        "EEEEEEEEE"
    ], {
        P: 'mekanism:pellet_antimatter',
        M: 'mekanism:ultimate_control_circuit',
        E: 'refinedstorage:controller',
        A: 'industrialforegoing:machine_frame_supreme',
        S: 'rebornstorage:super_advanced_processor',
        V: 'havenalchemy:void_matter',
        F: 'ad_astra:calorite_block',
        W: 'havenalchemy:research_tier_basic',
        X: 'havenalchemy:research_tier_intermediate',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:creative_controller')

    // Creative Wireless Universal Grid
    e.recipes.createMechanicalCrafting('universalgrid:creative_wireless_universal_grid', [
        "       C ",
        "MMMMMMMMM",
        "MZYXSXYZM",
        "MYAPAPAPM",
        "MXFVFCFXM",
        "MXFCFVFXM",
        "MYAPAPAPM",
        "MZYXSXYZM",
        "MMMMMMMMM"
    ], {
        P: 'mekanism:pellet_antimatter',
        M: 'mekanism:ultimate_control_circuit',
        A: 'industrialforegoing:machine_frame_supreme',
        S: 'rebornstorage:super_advanced_processor',
        V: 'havenalchemy:void_matter',
        F: 'ad_astra:calorite_block',
        C: 'havenalchemy:eternium_spirit_block',
        X: 'havenalchemy:research_tier_intermediate',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:creative_wireless_universal_grid')

    // Creative Fluid Tank
    e.recipes.createMechanicalCrafting('mekanism:creative_fluid_tank', [
        "NNNNNNNNN",
        "NMPPPPPMN",
        "NMCCCCCMN",
        "NMCZYZCMN",
        "NMCFEFCMN",
        "NMCZYZCMN",
        "NMCCCCCMN",
        "NMPPPPPMN",
        "NNNNNNNNN"
    ], {
        P: 'mekanism:pellet_antimatter',
        M: 'mekanism:ultimate_control_circuit',
        E: 'mekanism:ultimate_fluid_tank',
        F: 'ad_astra:calorite_block',
        C: 'havenalchemy:eternium_spirit_block',
        N: 'havenalchemy:neosphore_block',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:creative_fluid_tank')

    // Creative Motor
    e.recipes.createMechanicalCrafting('create:creative_motor', [
        "NNNNNNNN",
        "NPMAAMPN",
        "NYYFFVVN",
        "NZEEESSS",
        "NYYFFVVN",
        "NPMAAMPN",
        "NNNNNNNN"
    ], {
        P: 'mekanism:pellet_antimatter',
        M: 'mekanism:ultimate_control_circuit',
        E: 'create:rotation_speed_controller',
        A: 'industrialforegoing:machine_frame_supreme',
        S: 'create:shaft',
        V: 'havenalchemy:void_matter',
        F: 'ad_astra:calorite_block',
        N: 'havenalchemy:neosphore_block',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:creative_motor')

    // Creative Solar Panel
    e.recipes.createMechanicalCrafting('solarpanels:creative_solar_panel', [
        "CEEEEEEEC",
        " CPPPPPC ",
        " CZYMYZC ",
        " CFSVSFC ",
        " CZYMYZC ",
        "CCCCCCCCC"
    ], {
        P: 'mekanism:pellet_antimatter',
        M: 'mekanism:ultimate_control_circuit',
        E: 'solarpanels:photonic_solar_panel',
        S: 'rebornstorage:super_advanced_processor',
        V: 'havenalchemy:void_matter',
        F: 'ad_astra:calorite_block',
        C: 'havenalchemy:basphalt_stone',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:creative_solar_panel')

    // Creative Chemical Tank
    e.recipes.createMechanicalCrafting('mekanism:creative_chemical_tank', [
        "NNNNNNNNN",
        "NMPPPPPMN",
        "NMCCCCCMN",
        "NMCZFZCMN",
        "NMCYEYCMN",
        "NMCZFZCMN",
        "NMCCCCCMN",
        "NMPPPPPMN",
        "NNNNNNNNN"
    ], {
        P: 'mekanism:pellet_antimatter',
        M: 'mekanism:ultimate_control_circuit',
        E: 'mekanism:ultimate_fluid_tank',
        F: 'ad_astra:calorite_block',
        C: 'havenalchemy:eternium_spirit_block',
        N: 'havenalchemy:neosphore_block',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:creative_chemical_tank')

    // Creative Energy Cube
    e.recipes.createMechanicalCrafting('mekanism:creative_energy_cube', [
        "MMMMMMMMM",
        "MZYEEEYZM",
        "MYEPPPEYM",
        "MEVSVSVEM",
        "MEFAFAFEM",
        "MEVSVSVEM",
        "MYEPPPEYM",
        "MZYEEEYZM",
        "MMMMMMMMM"
    ], {
        P: 'mekanism:pellet_antimatter',
        M: 'mekanism:ultimate_control_circuit',
        E: 'mekanism:ultimate_energy_cube',
        A: 'industrialforegoing:machine_frame_supreme',
        S: 'rebornstorage:super_advanced_processor',
        V: 'havenalchemy:void_matter',
        F: 'ad_astra:calorite_block',
        Y: 'havenalchemy:research_tier_elite',
        Z: 'havenalchemy:research_tier_ultimate'
    }).id('haven:creative_energy_cube')

    // Energizing Creative Energy Cube
    e.custom({
        type: 'powah:energizing',
        ingredients: [
          Ingredient.of('mekanism:creative_energy_cube',).toJson(),
          Ingredient.of('havenalchemy:research_tier_ultimate').toJson(),
        ],
        energy: '2147483647',
        result: Item.of('mekanism:creative_energy_cube', '{mekData:{EnergyContainers:[{Container:0b,stored:"18446744073709551614.9999"}]}}').toJson()
      }).id(`haven:energized_creative_energy_cube`)
})
