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

    const id_prefix = 'masterfulmachinery:kubejs/mechanical_artifact_assembler';
    const recipes = [
        {
            outputs: 'atum:scarab',
            inputs: [
                'kubejs:scarab_body',
                '4* kubejs:scarab_leg',
                '4* kubejs:scarab_wing',
            ],
            ticks: 200,
            id: 'scarab'
        },
        {
            outputs: 'bloodmagic:sacrificialdagger',
            inputs: [
                'integrateddynamics:logic_director',
                '2* emendatusenigmatica:brass_rod',
                '2* bloodmagic:reagentbinding',
                'naturesaura:token_grief'
            ],
            ticks: 200,
            id: 'sacrificialdagger'
        },
        {
            outputs: 'bloodmagic:ritualdiviner',
            inputs: [
                '2* naturesaura:ancient_stick',
                '3* emendatusenigmatica:diamond_crystal',
                'bloodmagic:airscribetool',
                'bloodmagic:firescribetool',
                'bloodmagic:waterscribetool',
                'bloodmagic:earthscribetool'
            ],
            ticks: 250,
            id: 'ritualdiviner'
        },
        {
            outputs: 'bloodmagic:soulsword',
            inputs: [
                'atum:limestone_sword',
                '4* bloodmagic:ingot_hellforged',
                'create:shadow_steel'
            ],
            ticks: 250,
            id: 'soul_sword'
        },
        {
            outputs: 'bloodmagic:soulscythe',
            inputs: [
                'atum:limestone_hoe',
                '4* bloodmagic:ingot_hellforged',
                'create:shadow_steel'
            ],
            ticks: 250,
            id: 'soul_scythe'
        },
        {
            outputs: 'bloodmagic:soulaxe',
            inputs: [
                'atum:limestone_axe',
                '4* bloodmagic:ingot_hellforged',
                'create:shadow_steel'
            ],
            ticks: 250,
            id: 'soul_axe'
        },
        {
            outputs: 'bloodmagic:soulpickaxe',
            inputs: [
                'atum:limestone_pickaxe',
                '4* bloodmagic:ingot_hellforged',
                'create:shadow_steel'
            ],
            ticks: 250,
            id: 'soul_pickaxe'
        },
        {
            outputs: 'bloodmagic:soulshovel',
            inputs: [
                'atum:limestone_shovel',
                '4* bloodmagic:ingot_hellforged',
                'create:shadow_steel'
            ],
            ticks: 250,
            id: 'soul_shovel'
        },
        {
            outputs: 'createaddition:diamond_grit_sandpaper',
            inputs: [
                'minecraft:paper',
                '4* emendatusenigmatica:diamond_dust',
                'bloodmagic:bow_power_anointment_l'
            ],
            ticks: 200,
            id: 'diamond_grit_sandpaper'
        },
        {
            outputs: 'createaddition:overcharged_hammer',
            inputs: [
                '2* emendatusenigmatica:cast_iron_rod',
                'jaept:dark_dough',
                '2* createaddition:overcharged_casing'
            ],
            ticks: 200,
            id: 'overcharged_hammer'
        },
        {
            outputs: 'atum:godforged_block',
            inputs: [
                '4* atum:nebu_ingot',
                '3* #atum:godshards',
                '6* kubejs:holy_nugget',
            ],
            ticks: 200,
            id: 'godforged_block'
        },
        {
            outputs: 'bloodmagic:inputroutingnode',
            inputs: [
                'bloodmagic:itemroutingnode',
                '4* atum:nebu_drop',
                'integrateddynamics:variable_transformer_input',
            ],
            ticks: 200,
            id: 'input_routing_node'
        },
        {
            outputs: 'bloodmagic:outputroutingnode',
            inputs: [
                'bloodmagic:itemroutingnode',
                '4* emendatusenigmatica:enderium_nugget',
                'integrateddynamics:variable_transformer_output',
            ],
            ticks: 200,
            id: 'output_routing_node'
        },
        {
            outputs: 'astralsorcery:wand',
            inputs: [
                '2* emendatusenigmatica:aluminum_rod',
                'farmersdelight:rope',
                'astralsorcery:aquamarine',
                'astralsorcery:shifting_star',
            ],
            ticks: 400,
            id: 'wand'
        },
        {
            outputs: 'occultism:lens_frame',
            inputs: [
                '2* occultism:otherstone_frame',
                '3* emendatusenigmatica:silver_crystal'
            ],
            ticks: 200,
            id: 'lens_frame'
        },
        {
            outputs: 'occultism:storage_remote_inert',
            inputs: [
                'occultism:otherstone_tablet',
                'atum:relic_gold_ring',
                '9* immersiveengineering:component_steel'
            ],
            ticks: 200,
            id: 'storage_remote_inert'
        }
    ];

    recipes.forEach((recipe) => {
        
        var buildRecipe = {
            type: 'masterfulmachinery:machine_process',
            structureId: 'mechanical_artifact_assembler_structure',
            controllerId: 'mechanical_artifact_assembler'
        };
        buildRecipe.outputs = [{ type: 'masterfulmachinery:items', data: { item: recipe.outputs.includes('*')? recipe.outputs.substring(3):recipe.outputs, count: 1 } }];
        buildRecipe.inputs = [];
        recipe.inputs.forEach((input) => {
            if(typeof input == 'string'){
                cnt = input.includes('*')? parseInt(input.charAt(0)):1;
                if(input.includes('#')){
                    jsonInput = { type: 'masterfulmachinery:items', data: { tag: input.includes('*')? input.substring(4):input.substring(1), count: cnt } };
                }else{
                    jsonInput = { type: 'masterfulmachinery:items', data: { item: input.includes('*')? input.substring(3):input, count: cnt } };
                }
            }else{
                jsonInput = { type: 'masterfulmachinery:items', data: input};
            }
            buildRecipe.inputs.push(jsonInput);
        });
        buildRecipe.ticks = recipe.ticks;
        event.custom(buildRecipe).id(`${id_prefix}/${recipe.id}`);

    });
});
