ServerEvents.recipes(event => {

    // Sawdust for energy, of course.
	event.recipes.thermal.stirling_fuel('thermal:sawdust').energy(500)
	
    /*event.recipes.botanypots.fertilizer(
        "thermal:phytogrow", // fertilizer item
        30,
        40
    );*/

    // Shortcut for crafting fluxducts, which you will certainly need tons of
	event.recipes.thermal.smelter('6x thermal:fluxduct', ['3x minecraft:redstone', global.nuggetItem('lead', 2)]);

    // Use energetic grist as generator fuel
    event.recipes.thermal.stirling_fuel('kubejs:grist_energetic_basic').energy(8000)
    event.recipes.thermal.stirling_fuel('kubejs:grist_energetic_improved').energy(12000)
    event.recipes.thermal.stirling_fuel('kubejs:grist_energetic_radiant').energy(20000)

    // Agricultural grist in the insolator
    event.recipes.thermal.insolator_catalyst('kubejs:grist_agricultural_basic').primaryMod(1.5).secondaryMod(2.0).energyMod(0.5).useChance(0.4);
    event.recipes.thermal.insolator_catalyst('kubejs:grist_agricultural_improved').primaryMod(2.0).secondaryMod(4.0).energyMod(0.3).useChance(0.25);
    event.recipes.thermal.insolator_catalyst('kubejs:grist_agricultural_radiant').primaryMod(3.0).secondaryMod(6.0).energyMod(1.1).useChance(0.1);

    // Build grist in smelters/pulverizers for ore processing
	event.recipes.thermal.smelter_catalyst('kubejs:grist_build_basic').primaryMod(2.5).secondaryMod(2.0).energyMod(0.5).useChance(0.4);
	event.recipes.thermal.pulverizer_catalyst('kubejs:grist_build_basic').primaryMod(2.5).secondaryMod(2.0).energyMod(0.9).useChance(0.4);

	event.recipes.thermal.smelter_catalyst('kubejs:grist_build_improved').primaryMod(4.0).secondaryMod(4.0).energyMod(0.3).useChance(0.25);
	event.recipes.thermal.pulverizer_catalyst('kubejs:grist_build_improved').primaryMod(4.0).secondaryMod(4.0).energyMod(0.8).useChance(0.25);

	event.recipes.thermal.smelter_catalyst('kubejs:grist_build_radiant').primaryMod(5.0).secondaryMod(6.0).energyMod(0.8).useChance(0.1);
	event.recipes.thermal.pulverizer_catalyst('kubejs:grist_build_radiant').primaryMod(5.0).secondaryMod(6.0).energyMod(1.1).useChance(0.1);

    // Steel is used mostly for early solar, it shouldn't be so hard to make
    /*event.recipes.thermal.smelter('4x thermal:steel_ingot', ["minecraft:charcoal", global.ingotItem('iron', 4)]);
    event.recipes.thermal.smelter('4x thermal:steel_ingot', ["minecraft:charcoal", '4x #forge:dusts/iron']);
    event.recipes.thermal.smelter('thermal:steel_ingot', ["#minecraft:logs_that_burn", global.ingotItem('iron')]);
    event.recipes.thermal.smelter('thermal:steel_ingot', ["#minecraft:logs_that_burn", '#forge:dusts/iron']);
    event.recipes.thermal.smelter('thermal:steel_block', ['thermal:charcoal_block', global.ingotItem('iron', 9)]);
    event.recipes.thermal.smelter('thermal:steel_block', ['thermal:charcoal_block', '9x #forge:dusts/iron']);*/

    // The flux tools can be very easily OP after upgrades and enchants, make them mid-game
    event.replaceInput(
        {output: 'thermal:flux_dril'},
        'thermal:rf_coil',
        '#kubejs:grist/energetic/improved'
    )
    
    event.replaceInput(
        {output: 'thermal:flux_dril'},
        'minecraft:iron_ingot',
        '#kubejs:grist/build/improved'
    )
    
    event.replaceInput(
        {output: 'thermal:drill_head'},
        'minecraft:copper_ingot',
        '#kubejs:grist/build/basic'
    )

    event.replaceInput(
        {output: 'thermal:saw_blade'},
        'minecraft:copper_ingot',
        '#kubejs:grist/build/basic'
    )

    // For any thermal machines, you need basic energetic grist
    event.replaceInput(
        {output: 'thermal:rf_coil'},
        'minecraft:gold_ingot',
        '#kubejs:grist/energetic/basic'
    );
    event.replaceInput(
        {output: 'thermal:rf_coil'},
        'minecraft:redstone',
        global.nuggetItem('gold')
    );

    event.recipes.thermal.smelter(
        '4x thermal:cured_rubber',
        ['#forge:dusts/sulfur', '2x industrialforegoing:dryrubber'],
        3200
    );

    // Encourage machine crafting of gears by making manual crafting more expensive
    event.replaceInput(
        {mod: 'thermal'},
        'minecraft:iron_nugget',
        '#kubejs:grist/build/basic'
    )

    event.replaceInput(
        {mod: 'alltheores'},
        'minecraft:iron_nugget',
        '#kubejs:grist/build/basic'
    )

    // Require agricultural progression for insolator
    event.replaceInput(
        {id: 'thermal:machine_insolator'},
        'minecraft:dirt',
        '#kubejs:grist/agricultural/improved'
    )
    
    event.replaceInput(
        {id: 'thermal:augments/area_radius_augment'},
        'thermal:redstone_servo',
        '#kubejs:grist/build/improved'
    );

    event.replaceInput(
        {id: 'thermal:item_buffer'},
        'minecraft:quartz',
        '#kubejs:grist/intelligent/basic'
    );

    event.replaceInput(
        {id: 'thermal:redstone_servo'},
        'minecraft:iron_ingot',
        '#kubejs:grist/agricultural/basic'
    );

    event.replaceInput(
        {id: 'thermal:fluid_cell'},
        'thermal:redstone_servo',
        '#kubejs:grist/build/basic'
    );
    event.shapeless('minecraft:gravel', ['#forge:cobblestone', '#alltheores:ore_hammers']);
    event.shapeless('minecraft:sand', ['3x #forge:gravel', '#alltheores:ore_hammers']);

    event.replaceInput(
        {id: 'thermal:device_fisher'},
        '#forge:gears/copper',
        '#kubejs:grist/agricultural/basic'
    );

    event.remove({input: 'thermal:earth_charge'});

    // Pulverizer is gated behind brass, which requires create
    /*event.replaceInput(
        {id: 'thermal:machine_pulverizer'},
        '#forge:gears/brass',
        '#kubejs:grist/agricultural/basic'
    );*/

    // Centrifuge comes already gated behind constantan
});