
ServerEvents.recipes(event => {
    // Gate create behind finding tin and basic ore crushing hammers
    event.remove({output: 'create:andesite_alloy'});
    event.shapeless('2x create:andesite_alloy', [
        '2x minecraft:andesite',
        global.dustItem('tin', 2),
    ]);

    event.recipes.thermal.smelter(
        '6x create:andesite_alloy',
        ['2x minecraft:andesite', '#forge:dusts/tin']
    );

    event.shapeless('2x create:cogwheel', [
        'thermal:tin_gear',
        '#minecraft:planks',
    ]);

    // Cart assembler is gated behind mid-game grist
    event.replaceInput({output: 'create:cart_assembler'},
        '#forge:dusts/redstone',
        '#kubejs:grist/build/improved'
    );

    // Gate wireless stuff behind intelligent grist
    event.replaceInput({output: 'create:transmitter'},
        '#forge:dusts/redstone',
        '#kubejs:grist/intelligent/basic'
    );

    // Gate the mixer behind aluminum
    event.replaceInput({output: 'create:whisk'},
        '#forge:plates/iron',
        '#forge:plates/aluminum'
    );

    event.replaceInput({output: 'create:propeller'},
        '#forge:plates/iron',
        '#forge:plates/invar'
    );

    // Allow certus quartz to be used for rose quartz
    event.replaceInput({output: 'create:rose_quartz'},
        'minecraft:quartz',
        '#forge:gems/quartz',
    );
    event.shapeless('create:rose_quartz', [
        'ae2:certus_quartz_crystal',
        '8x minecraft:redstone',
    ]);
    
    // Crushing wheels can either come from finding diamonds (expensive) or build grist (cheap, eventually)
    event.shaped('create:crushing_wheel', [
        'CBC',
        'BAB',
        'CBC'
    ], {
        'A': '#kubejs:grist/build/basic',
        'B': 'thermal:tin_gear',
        'C': 'create:andesite_alloy',
    });

    event.shaped('create:crushing_wheel', [
        'CBC',
        'BAB',
        'CBC'
    ], {
        'A': 'minecraft:diamond',
        'B': 'thermal:tin_gear',
        'C': 'create:andesite_alloy',
    });

    // Melt down XP nuggets and blocks into raw XP
    // 1 nugget == 60mb cognitium
    event.recipes.createMixing(Fluid.of('experienceobelisk:cognitium', 60), 'create:experience_nugget').heated();
    event.recipes.createMixing(Fluid.of('experienceobelisk:cognitium', 60 * 9), 'create:experience_block').heated();

    // Precision mechanisms should require intelligent grist
    event.recipes.createSequencedAssembly([
        Item.of('create:precision_mechanism'),
    ], '#forge:ingots/brass', [
        event.recipes.createDeploying('create:incomplete_precision_mechanism', ['create:incomplete_precision_mechanism', '#kubejs:grist/intelligent/basic']),
        event.recipes.createDeploying('create:incomplete_precision_mechanism', ['create:incomplete_precision_mechanism', 'create:cogwheel']),
        event.recipes.createDeploying('create:incomplete_precision_mechanism', ['create:incomplete_precision_mechanism', '#forge:gears/copper'])
    ]).transitionalItem('create:incomplete_precision_mechanism').loops(3);
});