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

    const id_prefix = 'botania:kubejs/mana_infusion';

    const recipes = [
        {
            input: '#forge:ingots/iesnium',
            output: 'botania:manasteel_ingot',
            count: 1,
            mana: 3000,
            id: 'manasteel_from_iesnium'
        },
        {
            input: '#forge:storage_blocks/iesnium',
            output: 'botania:manasteel_block',
            count: 1,
            mana: 27000,
            id: 'manasteel_block_from_iesnium'
        },
        {
            input: '#forge:ingots/starmetal',
            output: 'botania:manasteel_ingot',
            count: 2,
            mana: 3000,
            id: 'manasteel_from_starmetal'
        },
        {
            input: '#forge:storage_blocks/starmetal',
            output: 'botania:manasteel_block',
            count: 2,
            mana: 27000,
            id: 'manasteel_block_from_starmetal'
        },
        {
            input: 'jaept:scarlet_rope',
            output: 'botania:mana_string',
            count: 1,
            mana: 1000,
            id: 'mana_string'
        },
        /*
        {
            input: 'immersiveengineering:hemp_fabric',
            output: 'botania:manaweave_cloth',
            count: 1,
            mana: 4000,
            id: 'manaweave_cloth'
        },
        */
        {
            input: 'integratedterminals:menril_glass',
            output: 'botania:mana_glass',
            count: 1,
            mana: 1000,
            id: 'mana_glass'
        },
        {
            input: 'astralsorcery:stardust',
            output: 'botania:mana_powder',
            count: 1,
            mana: 2000,
            id: 'mana_powder'
        },
        {
            input: 'botania:quartz_dark',
            output: 'botania:quartz_mana',
            count: 1,
            mana: 2000,
            id: 'mana_quartz'
        },
        {
            input: 'rftoolsbase:infused_enderpearl',
            output: 'botania:mana_pearl',
            count: 1,
            mana: 6000,
            id: 'mana_pearl'
        },
        {
            input: 'kubejs:vibrant_gem',
            output: 'botania:mana_diamond',
            count: 1,
            mana: 8000,
            id: 'mana_diamond'
        },
        {
            input: 'twilightforest:tower_wood',
            output: 'twilightforest:tower_wood_infested',
            catalyst: 'botania:mutated_grass',
            count: 1,
            mana: 2000,
            id: 'tower_wood_infested'
        },
        {
            input: 'emendatusenigmatica:quartz_crystal',
            output: 'appliedenergistics2:nether_quartz_seed',
            catalyst: 'botania:vivid_grass',
            count: 1,
            mana: 1000,
            id: 'nether_quartz_seed'
        },
        {
            input: 'emendatusenigmatica:certus_quartz_crystal',
            output: 'appliedenergistics2:certus_crystal_seed',
            catalyst: 'botania:vivid_grass',
            count: 1,
            mana: 1500,
            id: 'certus_quartz_seed'
        },
        {
            input: 'rftoolsbase:dimensionalshard',
            output: 'kubejs:temporal_shard',
            catalyst: 'botania:alchemy_catalyst',
            count: 1,
            mana: 4000,
            id: 'temporal_shard'
        }
    ];

    const grassTypes = ['dry', 'golden', 'vivid', 'scorched', 'infused', 'mutated'];

    grassTypes.forEach((type) => {
        let constructed_recipe = {
            type: 'botania:mana_infusion',
            input: Ingredient.of('botania:grass_seeds').toJson(),
            output: Item.of(`botania:${type}_seeds`).toResultJson(),
            catalyst: { type: 'block', block: `botania:${type}_grass` },
            mana: 4000
        };
        event.custom(constructed_recipe).id(`${id_prefix}/${type}_seeds`);
    })

    const itemsConvertions = [
        { 
            tag: '#bloodmagic:crystals/demon',
            mana: 2000
        },
        {
            tag: '#atum:godshards',
            mana: 1000
        }
    ];

    itemsConvertions.forEach((itemsConvertion) => {
        var items = utils.listOf(Ingredient.of(itemsConvertion.tag).stacks).toArray();
        var len = items.length;
        for(i=0;i<len;i++){
            var result = items[(i+1)%len];
            let constructed_recipe = {
                type: 'botania:mana_infusion',
                input: items[i].toJson(),
                output: result.toResultJson(),
                catalyst: { type: 'block', block: 'botania:alchemy_catalyst' },
                mana: itemsConvertion.mana
            };
            event.custom(constructed_recipe).id(`${id_prefix}/${result.id.substring(result.id.indexOf(':')+1)}`);
        }
    })

    recipes.forEach((recipe) => {
        let constructed_recipe = {
            type: 'botania:mana_infusion',
            input: Ingredient.of(recipe.input).toJson(),
            output: { item: recipe.output, count: recipe.count },
            mana: recipe.mana
        };

        if (recipe.catalyst) {
            constructed_recipe.catalyst = {
                type: 'block',
                block: recipe.catalyst
            };
        }

        event.custom(constructed_recipe).id(`${id_prefix}/${recipe.id}`);
    });
});
