ServerEvents.recipes(event => {
    /*
    Intelligent grist
    none -> basic: dig up lapis, hunt down zombies, build an ars infuser, infuse some primordeal grist -> unlock rf grid + external storage, basic pipes
        intelligent grist comes from infusing primordeal grist block with intelligent grist
        to make the infuser, you need intelligent grist
        your first intelligent grist can come from smelting insightful tincture
        insightful tincture comes from cooking insightful blend via farmersdelight with a bucket of liquid primordeal grist and zombie flesh
        insightful blend comes from combining sacred flesh, lapis, basic grist with an ore hammer
        sacred flesh comes from primordeal grist, rotten flesh, gold dust
    */
    //event.smelting('kubejs:grist_intelligent_basic', 'kubejs:insightful_tincture');
    event.shapeless('kubejs:insightful_blend', [
        '2x minecraft:rotten_flesh',
        global.dustItem('lapis', 2),
        'kubejs:grist_primordeal_basic',
        '#alltheores:ore_hammers'
    ]);

    event.custom({
        type: "apotheosis:enchanting",
        input: {
            item: "kubejs:insightful_tincture"
        },
        requirements: {
            eterna: 10,
            quanta: 0,
            arcana: 0
        },
        max_requirements: {
            eterna: -1,
            quanta: 25,
            arcana: -1
        },
        result: Item.of('kubejs:grist_intelligent_basic_block', 2).toJson()
    });

    event.shaped('kubejs:sacred_flesh', [
        'CAC',
        'ABA',
        'CAC'
    ], {
        'A': 'kubejs:grist_primordeal_basic',
        'B': 'minecraft:rotten_flesh',
        'C': global.dustItem('gold')
    });
    /*event.custom({
        type: 'farmersdelight:cooking',
        cookingtime: 400,
        experience: 5.0,
        ingredients: [
            {item: 'kubejs:grist_primordeal_basic_block'},
            {item: 'kubejs:sacred_flesh'},
            {item: 'kubejs:sacred_flesh'},
            {item: 'kubejs:insightful_blend'},
            {item: 'kubejs:insightful_blend'},
            {item: 'kubejs:insightful_blend'}
        ],
        result: {item: 'kubejs:insightful_tincture', count: 2}
    });*/
    event.shapeless('2x kubejs:insightful_tincture', [
        'kubejs:grist_primordeal_basic_block',
        '2x kubejs:sacred_flesh',
        '2x kubejs:insightful_blend'
    ]);
    event.shapeless('2x kubejs:insightful_tincture', [
        'kubejs:grist_primordeal_basic_block',
        '#kubejs:grist/intelligent/basic',
        '#alltheores:ore_hammers'
    ]);

    event.recipes.ars_nouveau.imbuement(
        'kubejs:grist_primordeal_basic_block',
        'kubejs:grist_intelligent_basic_block',
        900,
        ['kubejs:grist_intelligent_basic']
    );
    
    /*event.custom({
        type: "thermal:press",
        ingredients: [
            { item: 'kubejs:grist_primordeal_basic_block' },
            { tag: "kubejs:grist/intelligent/basic" }
        ],
        result: [{item: 'kubejs:insightful_tincture', count: 2}]
    });*/

    /*event.recipes.ars_nouveau.imbuement(
        'kubejs:grist_intelligent_basic',
        'kubejs:insightful_blend',
        900,
        []
    );*/

    /*
    Improved grist should probably come from the enchanting apparatus
    Improve grist comes from infusing priordeal improved with intelligent improved
    first improved grist comes from a summoning ritual with sapient focus + each ars elemental lesser focus
    sapient focus comes from apotheosis infusion with intelligent focus
    intelligent focus comes from summoning ritual with imbued source gems with cognitive alloy
    imbued source gems come source gems imbued with 8 intelligent catalysts
    catalysts come from source gems crystalized with basic intelligent fluid and sacred flesh
    */
    event.recipes.summoningrituals.altar("kubejs:grist_primordeal_improved")
        .itemOutput(Item.of('kubejs:grist_intelligent_improved_block'))
        .input(Item.of('kubejs:grist_primordeal_improved_block', 2))
        .input(Item.of('kubejs:grist_intelligent_improved', 1))
        .blockBelow('ars_nouveau:arcane_core');
        
    event.recipes.summoningrituals.altar("kubejs:sapient_focus")
        .itemOutput(Item.of('kubejs:grist_intelligent_improved_block'))
        .input('ars_elemental:lesser_fire_focus')
        .input('ars_elemental:lesser_water_focus')
        .input('ars_elemental:lesser_air_focus')
        .input('ars_elemental:lesser_earth_focus')
        .sacrifice('pig', 3)
        .weather('rain')
        .dayTime('night')
        .blockBelow('ars_nouveau:arcane_core');

    event.custom({
        type: "apotheosis:enchanting",
        input: {
            item: "kubejs:intelligent_focus"
        },
        requirements: {
            eterna: 40,
            quanta: 15,
            arcana: 60
        },
        max_requirements: {
            eterna: -1,
            quanta: 25,
            arcana: -1
        },
        result: Item.of('kubejs:sapient_focus').toJson()
    });

    event.recipes.summoningrituals.altar('kubejs:grist_primordeal_improved')
        .itemOutput('kubejs:intelligent_focus')
        .input(Item.of('kubejs:imbued_source_gem', 8))
        .input(Item.of('experienceobelisk:cognitive_alloy_block', 3))
        .sacrifice('sheep', 6)
        .blockBelow('ars_nouveau:arcane_core');

    event.recipes.ars_nouveau.imbuement(
        'ars_nouveau:source_gem',
        'kubejs:imbued_source_gem',
        15000,
        [
            'kubejs:intelligent_catalyst',
            'kubejs:intelligent_catalyst',
            'kubejs:intelligent_catalyst',
            'kubejs:intelligent_catalyst',
            'kubejs:intelligent_catalyst',
            'kubejs:intelligent_catalyst',
            'kubejs:intelligent_catalyst',
            'kubejs:intelligent_catalyst',
        ]
    );

    event.recipes.thermal.crystallizer(
        'kubejs:intelligent_catalyst',
        ['4x ars_nouveau:source_gem', '16x kubejs:sacred_flesh', Fluid.of('kubejs:grist_intelligent_basic_fluid', 3000)]
    );

    /*
    Radiant comes from the intelligent processors..? elemental mark of mastery?
    */
});