onEvent('recipes', event => {

    const id_prefix = 'bloodmagic:kubejs/alchemytable';

    const reagents = [
        {
            type: 'water',
            ingredients: [
                'minecraft:water_bucket',
                'minecraft:prismarine_shard',
                'thermal:blizz_powder',
                'byg:subzero_crystal_block'
            ],
            level: 2
        },
        {
            type: 'lava',
            ingredients: [
                'minecraft:lava_bucket',
                'tconstruct:ichor_slime_crystal',
                'eidolon:crimson_essence',
                'byg:embur_gel_block'
            ],
            level: 2
        },
        {
            type: 'air',
            ingredients: [
                'quark:bottled_cloud',
                'naturesaura:sky_ingot',
                'thermal:blitz_powder',
                'create:white_sail'
            ],
            level: 2
        },
        {
            type: 'growth',
            ingredients: [
                'mob_grinding_utils:solid_xp_baby',
                'create:tree_fertilizer',
                Item.of('naturesaura:effect_powder', '{effect:"naturesaura:plant_boost"}'),
                'supplementaries:fodder'
            ],
            level: 2
        },
        {
            type: 'holding',
            ingredients: [
                'minecraft:honey_bottle',
                'createaddition:capacitor',
                'byg:brim_powder',
                'create:adjustable_crate'
            ],
            level: 3
        },
        {
            type: 'void',
            ingredients: [
                'minecraft:dragon_breath',
                'tconstruct:hepatizon_ingot',
                'eidolon:death_essence',
                'appliedenergistics2:sky_stone_brick'
            ],
            level: 3
        },
        {
            type: 'fastminer',
            ingredients: [
                Item.of('minecraft:potion', '{Potion:"apotheosis:haste"}'),
                'minecraft:netherite_scrap',
                'thermal:basalz_powder',
                'tconstruct:efln_ball'
            ],
            level: 3
        },
        {
            type: 'sight',
            ingredients: [
                Item.of('naturesaura:aura_bottle', '{stored_type:"naturesaura:nether"}'),
                'bloodmagic:divinationsigil',
                'create:electron_tube',
                'integratedterminals:menril_glass'
            ],
            level: 3
        },
        {
            type: 'suppression',
            ingredients: [
                'bloodmagic:reagentvoid',
                'bloodmagic:tauoil',
                'atum:nepthys_godshard',
                'mob_grinding_utils:tank'
            ],
            level: 4
        },
        {
            type: 'teleposition',
            ingredients: [
                'bloodmagic:reagentsight',
                Item.of('tconstruct:copper_can', '{fluid:"tconstruct:molten_enderium"}'),
                'tconstruct:ender_slime_crystal',
                'bloodmagic:teleposer'
            ],
            level: 4
        },
        {
            type: 'bloodlight',
            ingredients: [
                'bloodmagic:reagentlava',
                Item.of('tconstruct:copper_can', '{fluid:"tconstruct:molten_lumium"}'),
                'atum:ptah_godshard',
                'minecraft:shroomlight'
            ],
            level: 4
        },
        {
            type: 'magnetism',
            ingredients: [
                'bloodmagic:reagentair',
                Item.of('tconstruct:copper_can', '{fluid:"tconstruct:molten_signalum"}'),
                Item.of('jaept:overcharged_alloy', '{Energy:100000}'),
                'minecraft:lodestone'
            ],
            level: 4
        }
    ]

    const recipes = [
        {
            result: '4x bloodmagic:slate_vial',
            ingredients: [
                'bloodmagic:reinforcedslate',
                'jaept:scarlet_rope',
                'tconstruct:clear_glass',
                'tconstruct:clear_glass',
                'tconstruct:clear_glass',
                'tconstruct:clear_glass'
            ],
            level: 2,
            syphon: 400,
            ticks: 100,
            id: 'slate_vial'
        },
        {
            result: '2x bloodmagic:simplecatalyst',
            ingredients: [
                'appliedenergistics2:purified_nether_quartz_crystal',
                'eidolon:enchanted_ash',
                'emendatusenigmatica:potassium_nitrate_dust',
                'emendatusenigmatica:silver_dust'
            ],
            level: 2,
            syphon: 200,
            ticks: 100,
            id: 'simple_catalyst'
        },
        {
            result: 'bloodmagic:itemrouterfilterexact',
            ingredients: [
                'bloodmagic:componentframeparts',
                'naturesaura:tainted_gold',
                'minecraft:redstone'
            ],
            level: 3,
            syphon: 500,
            ticks: 100,
            id: 'item_router_filter_exact'
        },
        {
            result: 'bloodmagic:itemrouterfilteroredict',
            ingredients: [
                'bloodmagic:componentframeparts',
                'naturesaura:infused_iron',
                'minecraft:redstone'
            ],
            level: 3,
            syphon: 500,
            ticks: 100,
            id: 'item_router_filter_ore_dict'
        },
        {
            result: Item.of('naturesaura:aura_bottle', '{stored_type:"naturesaura:end"}'),
            ingredients: [
                Item.of('naturesaura:aura_bottle', '{stored_type:"naturesaura:nether"}'),
                'jaept:dark_dough',
                'eidolon:ender_calx'
            ],
            level: 2,
            syphon: 400,
            ticks: 100,
            id: 'end_aura_bottle'
        },
        {
            result: 'bloodmagic:mundanelengtheningcatalyst',
            ingredients: [
                'bloodmagic:simplecatalyst',
                'bloodmagic:weak_tau',
                'minecraft:redstone',
                'minecraft:redstone'
            ],
            level: 3,
            syphon: 1500,
            ticks: 150,
            id: 'mundane_lengthening'
        },
        {
            result: '4x bloodmagic:largebloodstonebrick',
            ingredients: [
                'bloodmagic:weakbloodshard',
                'bloodmagic:dungeon_stone',
                'bloodmagic:dungeon_stone',
                'bloodmagic:dungeon_stone',
                'bloodmagic:dungeon_stone'
            ],
            level: 3,
            syphon: 4000,
            ticks: 200,
            id: 'large_bloodstone_brick'
        },
        {
            result: 'kubejs:limestone_brick_runed',
            ingredients: [
                'atum:limestone_brick_carved',
                'atum:khnumite',
                'atum:khnumite',
                'atum:emmer_flour',
                'atum:emmer_flour',
                Item.of('naturesaura:aura_bottle', '{stored_type:"naturesaura:other"}')
            ],
            level: 3,
            syphon: 2000,
            ticks: 200,
            id: 'limestone_brick_runed'
        },
        {
            result: '4x eidolon:death_essence',
            ingredients: [
                'eidolon:zombie_heart',
                'minecraft:rotten_flesh',
                'minecraft:bone_meal',
                'emendatusenigmatica:charcoal_dust'
            ],
            level: 4,
            syphon: 4000,
            ticks: 160,
            id: 'death_essence'
        },
        {
            result: '4x eidolon:crimson_essence',
            ingredients: [
                'minecraft:crimson_fungus',
                'minecraft:nether_wart',
                'emendatusenigmatica:sulfur_dust'
            ],
            level: 4,
            syphon: 4000,
            ticks: 160,
            id: 'crimson_essence'
        },
        {
            result: '4x eidolon:ender_calx',
            ingredients: [
                'emendatusenigmatica:ender_dust',
                'emendatusenigmatica:ender_dust',
                'eidolon:enchanted_ash'
            ],
            level: 4,
            syphon: 4000,
            ticks: 160,
            id: 'ender_calx'
        },
        {
            result: '2x eidolon:fungus_sprouts',
            ingredients: [
                '#forge:mushrooms',
                'minecraft:bone_meal',
                'minecraft:wheat_seeds'
            ],
            level: 4,
            syphon: 2000,
            ticks: 80,
            id: 'fungus_sprouts'
        },
        {
            result: '2x eidolon:warped_sprouts',
            ingredients: [
                'minecraft:warped_fungus',
                'eidolon:ender_calx',
                'minecraft:nether_wart'
            ],
            level: 4,
            syphon: 4000,
            ticks: 80,
            id: 'warped_sprouts'
        },
        {
            result: 'mob_grinding_utils:gm_chicken_feed_cursed',
            ingredients: [
                'supplementaries:fodder',
                'naturesaura:token_rage',
                'kubejs:scarlet_gem',
                'bloodmagic:vengefulcrystal',
                'atum:anubis_godshard',
                'mob_grinding_utils:fluid_xp_bucket'
            ],
            level: 4,
            syphon: 5000,
            ticks: 200,
            id: 'gm_chicken_feed_cursed'
        },
        {
            result: 'mob_grinding_utils:nutritious_chicken_feed',
            ingredients: [
                'supplementaries:fodder',
                'naturesaura:token_euphoria',
                'create:refined_radiance',
                'bloodmagic:steadfastcrystal',
                'atum:osiris_godshard',
                'mob_grinding_utils:fluid_xp_bucket'
            ],
            level: 4,
            syphon: 5000,
            ticks: 200,
            id: 'nutritious_chicken_feed'
        },
        {
            result: 'occultism:candle_white',
            ingredients: [
                'atum:linen_thread',
                'bloodmagic:simplecatalyst',
                'occultism:tallow',
                'occultism:tallow'
            ],
            level: 4,
            syphon: 4000,
            ticks: 100,
            id: 'candle_white'
        }
    ];

    // metals.forEach((metal) => {
    //     if(Item.exists(`emendatusenigmatica:${metal}_chunk`) && !Item.exists(`bloodmagic:${metal}sand`)){
    //         event.recipes.bloodmagic
    //             .alchemytable(`2x emendatusenigmatica:${metal}_dust`, [`#forge:ores/${metal}`, '#bloodmagic:arc/cuttingfluid'])
    //             .upgradeLevel(1)
    //             .syphon(400)
    //             .ticks(200)
    //             .id(`${id_prefix}/${metal}_dust`);
    //     }
    // })

    reagents.forEach((recipe) => {
        var result = `bloodmagic:reagent${recipe.type}`;
        var syphon = 250 * Math.pow(2,recipe.level);
        event.recipes.bloodmagic
            .alchemytable(result, recipe.ingredients)
            .upgradeLevel(recipe.level)
            .syphon(syphon)
            .ticks(80)
            .id(`${id_prefix}/reagent_${recipe.type}`);
    });

    recipes.forEach((recipe) => {
        event.recipes.bloodmagic
            .alchemytable(recipe.result, recipe.ingredients)
            .upgradeLevel(recipe.level)
            .syphon(recipe.syphon)
            .ticks(recipe.ticks)
            .id(`${id_prefix}/${recipe.id}`);
    });

    const will_types = ['raw', 'corrosive', 'destructive', 'steadfast', 'vengeful'];
    will_types.forEach((type) => {
        var id = type;
        if(type=="raw"){
            id = 'default';
        }
        event.recipes.bloodmagic
            .alchemytable(`2x bloodmagic:${type}catalyst`, [
                'bloodmagic:mundanepowercatalyst',
                `bloodmagic:${id}crystal`,
                `bloodmagic:${id}crystal`,
                Item.of('naturesaura:effect_powder', '{effect:"naturesaura:ore_spawn"}'),
                'bloodmagic:corrupted_dust',
                'atum:ectoplasm'
            ])
            .upgradeLevel(4)
            .syphon(4000)
            .ticks(160)
            .id(`${id_prefix}/${type}_catalyst`);
    })

})