onEvent('recipes', event => {

    const id_prefix = 'create:kubejs/crushing';

    const recipes = [
        {
            result: ['3x emendatusenigmatica:wood_dust', Item.of('emendatusenigmatica:wood_dust').withChance(0.5)], 
            ingredient: '#minecraft:logs', 
            id: 'wood_dust'
        },
        {
            result: ['3x eidolon:enchanted_ash', Item.of('eidolon:enchanted_ash').withChance(0.5)],
            ingredient: '#quark:crystal', 
            id: 'enchanted_ash'
        },
        {
            result: ['emendatusenigmatica:obsidian_dust', Item.of('minecraft:obsidian').withChance(0.5)], 
            ingredient: 'minecraft:obsidian', 
            id: 'obsidian_dust'
        },
        {
            result: ['3x byg:brim_powder', Item.of('byg:brim_powder').withChance(0.5)], 
            ingredient: 'byg:brimstone', 
            id: 'brim_powder'
        },
        {
            result: ['emendatusenigmatica:ender_dust'], 
            ingredient: 'minecraft:ender_pearl', 
            id: 'ender_dust'
        },
        {
            result: ['emendatusenigmatica:nebu_dust'], 
            ingredient: 'atum:nebu_ingot', 
            id: 'nebu_dust'
        },
        {
            result: ['kubejs:coral_dust', Item.of('kubejs:coral_dust').withChance(0.5)], 
            ingredient: '#forge:coral_blocks', 
            id: 'coral_dust_from_blocks'
        },
        {
            result: ['3x kubejs:blazing_powder'], 
            ingredient: 'rftoolspower:blazing_rod', 
            id: 'blazing_powder'
        },
        {
            result: ['3x minecraft:redstone', Item.of('minecraft:redstone',2).withChance(0.5)], 
            ingredient: 'emendatusenigmatica:redstone_chunk', 
            id: 'redstone'
        }
    ];

    // metals.forEach((metal) => {
    //     const ingot = itemOf(`#forge:ingots/${metal}`);
    //     const dust = itemOf(`#forge:dusts/${metal}`);
    //     if(dust!=null){
    //         event.recipes.createCrushing(dust, ingot).id(`${id_prefix}/${metal}_dust`);
    //     }
    // });

    metals.concat(gems).concat(cgems).forEach((metal) => {
        if(metal=='netherite') return;
        const ingot = itemOf(`#forge:ingots/${metal}`);
        const gem = itemOf(`#forge:gems/${metal}`);
        const dust = itemOf(`#forge:dusts/${metal}`);
        if(dust!=null){
            let input = ingot!=null? ingot:gem;
            event.recipes.createCrushing(dust, input).id(`${id_prefix}/${metal}_dust`);
        }
    });

    ores.forEach((type) => {
        if(type=='redstone') return;
        const ore = `#forge:ores/${type}`;
        const crushed = itemOf(`#create:crushed_ores/${type}`);
        const gem = itemOf(`#forge:gems/${type}`);
        var outputs = [],
            id = type;
        if(gem!=null){
            outputs = gems.includes(type)? [Item.of(gem,2)]:[Item.of(gem,3),Item.of(gem,2).withChance(0.5)];
        }else{
            outputs = [crushed,Item.of(crushed).withChance(0.5)];
            id = 'crushed_'+type
        }
        if(outputs.length!=0){
            event.recipes.createCrushing(
                outputs, ore
            ).id(`${id_prefix}/${id}`);
        }
    });

    quartz.forEach((type) => {
        const gem = itemOf(`#forge:gems/${type}`);
        const block = itemOf(`#forge:storage_blocks/${type}`);
        if(block!=null){
            event.recipes.createCrushing(Item.of(gem,4), block).id(`${id_prefix}/${type}_from_block`);
        }
    });

    bbbb.forEach(type => {
        const rod = itemOf(`#forge:rods/${type}`);
        const dust = itemOf(`#forge:dusts/${type}`);
        event.recipes.createCrushing(Item.of(dust,3), rod).id(`${id_prefix}/${type}_powder`);
    });

    recipes.forEach((recipe) => {
        event.recipes.createCrushing(recipe.result, recipe.ingredient).id(`${id_prefix}/${recipe.id}`);
    });

})