onEvent('recipes', event => {

    const id_prefix = 'bloodmagic:kubejs/soulforge';

    const recipes = [
        {
            output: 'bloodmagic:soulgempetty',
            items: [
                'emendatusenigmatica:silver_crystal',
                'create:refined_radiance',
                '#quark:shards',
                'bloodmagic:reagentholding'
            ],
            minDrain: 1.0,
            drain: 1.0,
            id: 'pettytartaricgem'
        },
        {
            output: 'bloodmagic:soulgemlesser',
            items: [
                'bloodmagic:soulgempetty',
                'eidolon:lesser_soul_gem',
                'createaddition:overcharged_casing',
                'bloodmagic:dungeon_metal'
            ],
            minDrain: 60.0,
            drain: 20.0,
            id: 'lessertartaricgem'
        },
        {
            output: 'bloodmagic:soulgemcommon',
            items: [
                'bloodmagic:soulgemlesser',
                'bloodmagic:mundanelengtheningcatalyst',
                'emendatusenigmatica:nebu_dust',
                'bloodmagic:altarcapacityrune'
            ],
            minDrain: 200.0,
            drain: 80.0,
            id: 'commontartaricgem'
        },
        {
            output: 'bloodmagic:soulgemgreater',
            items: [
                'bloodmagic:soulgemcommon',
                '#bloodmagic:crystals/demon',
                'atum:godforged_block',
                'bloodmagic:bettercapacityrune'
            ],
            minDrain: 1000.0,
            drain: 200.0,
            id: 'greatertartaricgem'
        },
        {
            output: '3x bloodmagic:ingot_hellforged',
            items: [
                'naturesaura:sky_ingot',
                'naturesaura:sky_ingot',
                'emendatusenigmatica:aluminum_ingot',
                'integrateddynamics:crystalized_menril_chunk'
            ],
            minDrain: 4.0,
            drain: 4.0,
            id: 'hellforged_ingot'
        },
        {
            output: '2x bloodmagic:dungeon_stone',
            items: [
                'bloodmagic:stonetilepath',
                'bloodmagic:stonetilepath',
                'alexsmobs:soul_heart',
                'emendatusenigmatica:enderium_dust'
            ],
            minDrain: 60.0,
            drain: 16.0,
            id: 'demon_stone'
        },
        {
            output: 'bloodmagic:airscribetool',
            items: [
                'kubejs:inscription_bottle',
                'bloodmagic:reagentair',
                'bloodmagic:reagentair',
                'bloodmagic:reagentair'
            ],
            minDrain: 40.0,
            drain: 20.0,
            id: 'air_tool'
        },
        {
            output: 'bloodmagic:firescribetool',
            items: [
                'kubejs:inscription_bottle',
                'bloodmagic:reagentlava',
                'bloodmagic:reagentlava',
                'bloodmagic:reagentlava'
            ],
            minDrain: 40.0,
            drain: 20.0,
            id: 'fire_tool'
        },
        {
            output: 'bloodmagic:waterscribetool',
            items: [
                'kubejs:inscription_bottle',
                'bloodmagic:reagentwater',
                'bloodmagic:reagentwater',
                'bloodmagic:reagentwater'
            ],
            minDrain: 40.0,
            drain: 20.0,
            id: 'water_tool'
        },
        {
            output: 'bloodmagic:earthscribetool',
            items: [
                'kubejs:inscription_bottle',
                'bloodmagic:reagentgrowth',
                'bloodmagic:reagentgrowth',
                'bloodmagic:reagentgrowth'
            ],
            minDrain: 40.0,
            drain: 20.0,
            id: 'earth_tool'
        },
        {
            output: 'bloodmagic:duskscribetool',
            items: [
                'kubejs:inscription_bottle',
                'bloodmagic:reagentvoid',
                'bloodmagic:reagentvoid',
                'bloodmagic:reagentvoid'
            ],
            minDrain: 500.0,
            drain: 100.0,
            id: 'dusk_tool'
        },
        {
            output: 'bloodmagic:masterritualstone',
            items: [
                'bloodmagic:ritualstone',
                'bloodmagic:ritualstone',
                'integrateddynamics:logic_director',
                'naturesaura:token_terror'
            ],
            minDrain: 200.0,
            drain: 40.0,
            id: 'master_ritual_stone'
        },
        {
            output: 'bloodmagic:simplekey',
            items: [
                'emendatusenigmatica:redstone_crystal',
                'emendatusenigmatica:aluminum_rod',
                '#bloodmagic:fragments',
                'bloodmagic:infusedslate'
            ],
            minDrain: 200.0,
            drain: 50.0,
            id: 'simple_key'
        },
        {
            output: 'bloodmagic:primitive_explosive_cell',
            items: [
                'bloodmagic:explosivepowder',
                'appliedenergistics2:sky_stone_block',
                'bloodmagic:reinforcedslate',
                'emendatusenigmatica:cast_iron_ingot'
            ],
            minDrain: 200.0,
            drain: 50.0,
            id: 'primitive_explosive_cell'
        },
        {
            output: 'bloodmagic:noderouter',
            items: [
                'bloodmagic:infusedslate',
                'integrateddynamics:logic_director',
                'emendatusenigmatica:cast_iron_rod',
                'emendatusenigmatica:aluminum_crystal'
            ],
            minDrain: 200.0,
            drain: 40.0,
            id: 'node_router'
        },
        {
            output: 'bloodmagic:sanguinereverter',
            items: [
                'minecraft:shears', 
                'bloodmagic:dungeon_stone',
                'bloodmagic:infusedslate',
                'bloodmagic:ingot_hellforged'
            ],
            minDrain: 500.0,
            drain: 100.0,
            id: 'sanguine_reverter'
        },
        {
            output: 'bloodmagic:demonwillgauge',
            items: [
                'naturesaura:eye_improved', 
                'bloodmagic:reagentsight',
                'bloodmagic:ingot_hellforged',
                '#bloodmagic:crystals/demon'
            ],
            minDrain: 500.0,
            drain: 100.0,
            id: 'demon_will_gauge'
        },
        {
            output: 'bloodmagic:primitive_crystalline_resonator',
            items: [
                'appliedenergistics2:sky_stone_block', 
                '#bloodmagic:crystals/demon',
                '#forge:rods/all_metal',
                '#forge:rods/all_metal'
            ],
            minDrain: 1500.0,
            drain: 200.0,
            id: 'primitive_crystalline_resonator'
        },
        {
            output: 'integratedterminals:terminal_storage_portable',
            items: [
                'integratedterminals:part_terminal_storage',
                Item.of('integrateddynamics:part_connector_omni_directional').ignoreNBT(),
                Item.of('tconstruct:tool_handle', '{Material:"tconstruct:cobalt"}'),
                Item.of('tconstruct:tool_handle', '{Material:"tconstruct:cobalt"}')
            ],
            minDrain: 2000.0,
            drain: 500.0,
            id: 'terminal_storage_portable' 
        },
        {
            output: '2x eidolon:arcane_gold_ingot',
            items: [
                'minecraft:gold_ingot',
                'minecraft:gold_ingot',
                'minecraft:redstone',
                'eidolon:soul_shard'
            ],
            minDrain: 2000.0,
            drain: 100.0,
            id: 'arcane_gold_ingot'
        },
        {
            output: 'eidolon:lesser_soul_gem',
            items: [
                'minecraft:quartz',
                'eidolon:soul_shard',
                'minecraft:redstone',
                'emendatusenigmatica:lapis_dust'
            ],
            minDrain: 2000.0,
            drain: 150.0,
            id: 'lesser_soul_gem'
        },
        {
            output: 'eidolon:shadow_gem',
            items: [
                'minecraft:diamond',
                'eidolon:soul_shard',
                'minecraft:ghast_tear',
                'eidolon:death_essence'
            ],
            minDrain: 2000.0,
            drain: 200.0,
            id: 'shadow_gem'
        },
        {
            output: '4x kubejs:holy_ingot',
            items: [
                'emendatusenigmatica:silver_ingot',
                'emendatusenigmatica:silver_ingot',
                'kubejs:holy_symbol'
            ],
            minDrain: 2000.0,
            drain: 400.0,
            id: 'holy_ingot'
        },
        {
            output: '2x emendatusenigmatica:electrum_ingot',
            items: [
                'eidolon:arcane_gold_ingot',
                'kubejs:holy_ingot',
                'emendatusenigmatica:signalum_ingot',
                'naturesaura:tainted_gold'
            ],
            minDrain: 3000.0,
            drain: 500.0,
            id: 'electrum_ingot'
        },
        {
            output: 'occultism:chalk_white_impure',
            items: [
                'astralsorcery:rock_crystal', 
                'occultism:otherworld_ashes',
                'occultism:burnt_otherstone',
                'emendatusenigmatica:coke_dust'
            ],
            minDrain: 4000.0,
            drain: 500.0,
            id: 'chalk_white_impure'
        },
        {
            output: 'occultism:chalk_purple_impure',
            items: [
                {
                    item: 'astralsorcery:attuned_rock_crystal',
                    type: 'nbt_ingredient_predicate:nbt_includes',
                    nbt: {
                        astralsorcery: {
                            crystalProperties: {
                                attributes: [
                                    { property:"astralsorcery:size", pLevel:3, discovered:true },
                                    { property:"astralsorcery:purity", pLevel:2, discovered:true },
                                    { property:"astralsorcery:shape", pLevel:2, discovered:true },
                                ]
                            }
                        }
                    }
                },
                'occultism:otherworld_ashes',
                'occultism:burnt_otherstone',
                'occultism:spirit_attuned_gem'
            ],
            minDrain: 4000.0,
            drain: 1000.0,
            id: 'chalk_purple_impure'
        }
    ]

    recipes.forEach((recipe) => {
        event.recipes.bloodmagic
            .soulforge(recipe.output, recipe.items)
            .minimumDrain(recipe.minDrain)
            .drain(recipe.drain)
            .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
            .soulforge(`bloodmagic:${type}catalyst`, [
                'bloodmagic:simplecatalyst',
                `bloodmagic:${id}crystal`,
                'atum:ectoplasm',
                'integrateddynamics:crystalized_chorus_chunk'
            ]).minimumDrain(500).drain(40).id(`${id_prefix}/${type}_catalyst`);
    })

})