onEvent('recipes', (event) => {

    // Altar's Max Fill rate is 300 aura per tick. If a recipe draws faster than this, it'll still work, but will slow the craft down to that rate if a large enough batch goes through.
    const id_prefix = 'naturesaura:kubejs/altar';

    const recipes = [
        {
            input: 'tconstruct:queens_slime_ingot',
            output: 'naturesaura:infused_iron',
            aura_type: 'naturesaura:overworld',
            aura: 15000,
            time: 80,
            id: 'naturesaura:altar/infused_iron'
        },
        {
            input: 'tconstruct:queens_slime_block',
            output: 'naturesaura:infused_iron_block',
            aura_type: 'naturesaura:overworld',
            aura: 135000,
            time: 720,
            id: 'naturesaura:altar/infused_iron_block'
        },
        {
            input: 'tconstruct:hepatizon_ingot',
            output: 'naturesaura:tainted_gold',
            aura_type: 'naturesaura:nether',
            aura: 15000,
            time: 80,
            id: 'naturesaura:altar/tainted_gold'
        },
        {
            input: 'tconstruct:hepatizon_block',
            output: 'naturesaura:tainted_gold_block',
            aura_type: 'naturesaura:nether',
            aura: 135000,
            time: 720,
            id: 'naturesaura:altar/tainted_gold_block'
        },
        {
            input: 'create:dolomite',
            output: 'naturesaura:infused_stone',
            aura_type: 'naturesaura:overworld',
            aura: 7500,
            time: 40,
            id: 'naturesaura:altar/infused_stone'
        },
        {
            input: 'minecraft:quartz',
            output: 'emendatusenigmatica:quartz_dust',
            catalyst: 'naturesaura:crushing_catalyst',
            aura_type: 'naturesaura:nether',
            aura: 7500,
            time: 80,
            id: `${id_prefix}/quartz_dust`
        },
        {
            input: 'minecraft:obsidian',
            output: 'emendatusenigmatica:obsidian_dust',
            catalyst: 'naturesaura:crushing_catalyst',
            aura_type: 'naturesaura:nether',
            aura: 6000,
            time: 60,
            id: `${id_prefix}/obsidian_dust`
        },
        {
            input: 'alexsmobs:cockroach_wing',
            output: 'kubejs:scarab_wing',
            catalyst: 'naturesaura:conversion_catalyst',
            aura_type: 'naturesaura:overworld',
            aura: 20000,
            time: 100,
            id: `${id_prefix}/scarab_wing`
        },
        {
            input: 'eidolon:pewter_inlay',
            output: 'kubejs:holy_symbol',
            catalyst: 'naturesaura:conversion_catalyst',
            aura_type: 'naturesaura:overworld',
            aura: 16000,
            time: 80,
            id: `${id_prefix}/holy_symbol`
        },
        {
            input: 'minecraft:ender_pearl',
            output: 'emendatusenigmatica:ender_dust',
            catalyst: 'naturesaura:crushing_catalyst',
            aura_type: 'naturesaura:overworld',
            aura: 6000,
            time: 60,
            id: `${id_prefix}/ender_dust`
        },
        {
            input: 'rftoolspower:blazing_rod',
            output: '3x kubejs:blazing_powder',
            catalyst: 'naturesaura:crushing_catalyst',
            aura_type: 'naturesaura:nether',
            aura: 6000,
            time: 60,
            id: `${id_prefix}/blazing_dust`
        }
    ];

    metals.forEach((metal) => {
        if(metal=='netherite') return;
        let ingot = itemOf(`#forge:ingots/${metal}`);
        let dust = itemOf(`#forge:dusts/${metal}`);
        if(dust!=null){
            recipes.push({
                input: ingot,
                output: dust,
                catalyst: 'naturesaura:crushing_catalyst',
                aura_type: 'naturesaura:overworld',
                aura: 6000,
                time: 60,
                id: `${id_prefix}/${metal}_dust`
            })
        }
    });

    gems.concat(cgems).forEach((gem) => {
        if(gem=='quartz') return;
        let ingot = itemOf(`#forge:gems/${gem}`);
        let dust = itemOf(`#forge:dusts/${gem}`);
        if(ingot!=null && dust!=null){
            recipes.push({
                input: ingot,
                output: dust,
                catalyst: 'naturesaura:crushing_catalyst',
                aura_type: 'naturesaura:overworld',
                aura: 6000,
                time: 60,
                id: `${id_prefix}/${gem}_dust`
            })
        }
    });

    quartz.forEach((type) => {
        let ingot = itemOf(`#forge:gems/${type}`);
        let block = itemOf(`#forge:storage_blocks/${type}`);
        if(ingot!=null && block!=null){
            recipes.push({
                input: block,
                output: Item.of(ingot,4),
                catalyst: 'naturesaura:crushing_catalyst',
                aura_type: 'naturesaura:overworld',
                aura: 4000,
                time: 40,
                id: `${id_prefix}/${type}`
            })
        }
    });

    bbbb.forEach(type => {
        const rod = itemOf(`#forge:rods/${type}`);
        const dust = itemOf(`#forge:dusts/${type}`);
        recipes.push({
            input: rod,
            output: Item.of(dust,3),
            catalyst: 'naturesaura:crushing_catalyst',
            aura_type: 'naturesaura:nether',
            aura: 4000,
            time: 60,
            id: `${id_prefix}/${type}_dust`
        })
    });

    recipes.forEach((recipe) => {
        recipe.type = 'naturesaura:altar';
        recipe.input = Ingredient.of(recipe.input).toJson();
        recipe.output = Item.of(recipe.output).toResultJson();
        if(recipe.catalyst){
            recipe.catalyst = Item.of(recipe.catalyst).toResultJson();
        }
        event.custom(recipe).id(recipe.id);
    });
});
