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',
                'integrateddynamics:bucket_liquid_chorus',
                'tconstruct:ender_slime_crystal',
                'bloodmagic:teleposer'
            ],
            level: 4
        },
        {
            type: 'bloodlight',
            ingredients: [
                'bloodmagic:reagentlava',
                'kubejs:molten_glowstone_bucket',
                'atum:ptah_godshard',
                'minecraft:shroomlight'
            ],
            level: 4
        },
        {
            type: 'magnetism',
            ingredients: [
                'bloodmagic:reagentair',
                'emendatusenigmatica:molten_redstone_bucket',
                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: 'integrateddynamics:logic_director',
            ingredients: [
                'integrateddynamics:crystalized_chorus_chunk',
                'integrateddynamics:crystalized_chorus_chunk',
                'integrateddynamics:crystalized_menril_chunk',
                'bloodmagic:infusedslate'
            ],
            level: 3,
            syphon: 2000,
            ticks: 120,
            id: 'logic_director'
        },
        {
            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: 4,
            syphon: 800,
            ticks: 200,
            id: 'limestone_brick_runed'
        },
        {
            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: 1000,
            ticks: 200,
            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}`);
    });

})