onEvent('recipes', event => {

    const id_prefix = 'bloodmagic:kubejs/arc';

    const recipes = [
        {
            input: '#bloodmagic:gravels/nebu',
            tool: '#bloodmagic:arc/cuttingfluid',
            result: '3x atum:nebu_drop',
            id: 'nebu_drop_from_gravel'
        }
    ];

    recipes.forEach(recipe => {
        event.recipes.bloodmagic
                .arc(recipe.result, recipe.input, recipe.tool)
                .id(`${id_prefix}/${recipe.id}`);
    });

    ores.forEach((ore) => {

        var oreId = `#forge:ores/${ore}`;
        var fragment = itemOf(`#bloodmagic:fragments/${ore}`);
        var gravel =  itemOf(`#bloodmagic:gravels/${ore}`);
        var gem = itemOf(`#forge:gems/${ore}`);
        var dust = itemOf(`#forge:dusts/${ore}`);

        if(Item.exists(fragment) && Item.exists(gravel)){
            event.recipes.bloodmagic
                .arc(Item.of(fragment,3), oreId, '#bloodmagic:arc/explosive')
                .id(`${id_prefix}/${ore}_fragment`);
            event.recipes.bloodmagic
                .arc(gravel, fragment, '#bloodmagic:arc/resonator', [Item.of('bloodmagic:corrupted_tinydust').chance(0.05), Item.of('bloodmagic:corrupted_tinydust').chance(0.005)])
                .id(`${id_prefix}/${ore}_gravel`);
            
        };

        var output,
            count = 1;

        if(gravel!=null && ore!='nebu'){
            if(gem!=null){
                if(cgems.includes(ore)){
                    count = 2;
                }
                output = gem;
            }else if(dust!=null){
                output = dust;
            }
            event.recipes.bloodmagic
                .arc(Item.of(output,count), gravel, '#bloodmagic:arc/cuttingfluid')
                .id(`${id_prefix}/${ore}_from_gravel`);
            event.recipes.bloodmagic
                .arc(Item.of(output,count*2), oreId, '#bloodmagic:arc/cuttingfluid')
                .id(`${id_prefix}/${ore}`);
        }

        var crystal = itemOf(`#mekanism:crystals/${ore}`);
        if(Item.exists(crystal)){
            event.recipes.bloodmagic
                .arc(Item.of(crystal,3), oreId, '#bloodmagic:arc/resonator', [Item.of('bloodmagic:corrupted_tinydust').chance(0.2)])
                .id(`${id_prefix}/${ore}_crystal`);
        }
        
    });

})