ServerEvents.recipes(event => {
    function addTechSieve(inputBlock, outputItem, baseChance) {
        event.custom({
            type: "exdeorum:sieve",
            ingredient: {
                item: inputBlock
            },
            mesh: {
                item: "kubejs:industrial_mesh" 
            },
            result: {
                count: 1,
                id: outputItem
            },
            result_amount: {
                type: "minecraft:binomial",
                n: 1.0,
                p: baseChance 
            }
        })
    }

    // --- ДОБАВЛЯЕМ ИСКЛЮЧИТЕЛЬНО РЕСУРСЫ INDUSTRIAL UPGRADE ---
    // Дроп из ГРАВИЯ
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_aluminium', 0.10) // Рудный алюминий
    addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_titanium', 0.06) // Титан
    addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_vanadium', 0.06) // Ванадий
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_cobalt', 0.06)    // Рудный кобальт
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_magnesium', 0.06) // Рудный магний
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_manganese', 0.06) // Рудный марганец
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_cadmium', 0.06)   // Рудный кадмий
    addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_chromium', 0.04)   // Хром
    addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_mikhail', 0.04) // Рудный михал
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_spinel', 0.04)    // Рудная шпинель
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_germanium', 0.04) // Рудный германий
    addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_molybdenum', 0.06) // Рудный молибден
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_neodymium', 0.06) // Рудный неодим
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_niobium', 0.06) //  Рудный ниобий
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_palladium', 0.06) // Рудный палладий
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_polonium', 0.06) // Рудный полоний
	addTechSieve('minecraft:gravel', 'industrialupgrade:raw_metals/raw_strontium', 0.06) // Рудный стронций
	
	addTechSieve('exdeorum:crushed_end_stone', 'powah:uraninite', 0.06)
	addTechSieve('exdeorum:crushed_end_stone', 'allthemodium:allthemodium_nugget', 0.03)
	addTechSieve('exdeorum:crushed_end_stone', 'allthemodium:vibranium_nugget', 0.01)
	addTechSieve('exdeorum:crushed_end_stone', 'allthemodium:unobtainium_nugget', 0.01)
	addTechSieve('exdeorum:crushed_end_stone', 'actuallyadditions:black_quartz', 0.07)
	addTechSieve('exdeorum:crushed_end_stone', 'alltheores:fluorite', 0.06)
	addTechSieve('exdeorum:crushed_end_stone', 'forbidden_arcanus:arcane_crystal', 0.06)
	addTechSieve('exdeorum:crushed_end_stone', 'alltheores:sulfur', 0.12)
	addTechSieve('exdeorum:crushed_end_stone', 'mysticalagriculture:prosperity_shard', 0.12)
	addTechSieve('exdeorum:crushed_end_stone', 'mysticalagriculture:soulium_dust', 0.3)
	addTechSieve('exdeorum:crushed_end_stone', 'draconicevolution:draconium_dust', 0.9)
	addTechSieve('exdeorum:crushed_end_stone', 'create:ochrum', 0.7)
	addTechSieve('exdeorum:crushed_end_stone', 'create:asurine', 0.7)
	addTechSieve('exdeorum:crushed_end_stone', 'create:crimsite', 0.7)
	addTechSieve('exdeorum:crushed_end_stone', 'create:veridium', 0.7)
	addTechSieve('exdeorum:crushed_end_stone', 'xycraft_world:kivi', 0.08)
	addTechSieve('exdeorum:crushed_end_stone', 'xycraft_world:xychorium_gem_blue', 0.08)
	addTechSieve('exdeorum:crushed_end_stone', 'xycraft_world:xychorium_gem_green', 0.08)
	addTechSieve('exdeorum:crushed_end_stone', 'xycraft_world:xychorium_gem_red', 0.08)
	addTechSieve('exdeorum:crushed_end_stone', 'xycraft_world:xychorium_gem_dark', 0.08)
	addTechSieve('exdeorum:crushed_end_stone', 'xycraft_world:xychorium_gem_light', 0.08)
	addTechSieve('exdeorum:crushed_end_stone', 'alltheores:salt', 0.10)
	addTechSieve('exdeorum:crushed_end_stone', 'dragonsurvival:elder_dragon_dust', 0.03)
	addTechSieve('exdeorum:crushed_end_stone', 'moremekanismprocessing:gem_apatite', 0.03)
	
	// --- ИЗМЕЛЬЧЁННЫЙ АДСКИЙ КАМЕНЬ (Адская ветка) ---
    addTechSieve('exdeorum:crushed_netherrack', 'industrialupgrade:raw_metals/raw_barium', 0.06) // Барий
	addTechSieve('exdeorum:crushed_netherrack', 'industrialupgrade:raw_metals/raw_bismuth', 0.06) // Рудный висмут
	addTechSieve('exdeorum:crushed_netherrack', 'industrialupgrade:raw_metals/raw_gadolinium', 0.06) // Рудный гадолиний
	addTechSieve('exdeorum:crushed_netherrack', 'industrialupgrade:raw_metals/raw_yttrium', 0.06) // Рудный иттрий
	addTechSieve('exdeorum:crushed_netherrack', 'industrialupgrade:raw_metals/raw_thallium', 0.06) // Рудный таллий
	addTechSieve('exdeorum:crushed_netherrack', 'industrialupgrade:raw_metals/raw_zirconium', 0.06) // Рудный цирконий
    addTechSieve('exdeorum:crushed_netherrack', 'modern_industrialization:raw_tungsten', 0.05) // Вольфрам
	addTechSieve('exdeorum:crushed_netherrack', 'industrialupgrade:raw_metals/raw_tantalum', 0.04) // Тантал
	addTechSieve('exdeorum:crushed_netherrack', 'industrialupgrade:raw_metals/raw_arsenic', 0.04) // Мышьяк
	addTechSieve('exdeorum:crushed_netherrack', 'industrialupgrade:raw_metals/raw_gallium', 0.04) // Добавлен Галлий
	addTechSieve('exdeorum:crushed_netherrack', 'industrialupgrade:raw_metals/raw_hafnium', 0.04) // Рудный гафний
	addTechSieve('exdeorum:crushed_netherrack', 'evilcraft:dark_gem', 0.04)
	addTechSieve('exdeorum:crushed_netherrack', 'evilcraft:dark_power_gem', 0.02)
	addTechSieve('exdeorum:crushed_netherrack', 'forbidden_arcanus:stella_arcanum', 0.01)
    addTechSieve('exdeorum:crushed_netherrack', 'forbidden_arcanus:arcane_crystal_ore', 0.01)
	addTechSieve('exdeorum:crushed_netherrack', 'forbidden_arcanus:runic_stone', 0.01)
	
function addSieve(input, output, mesh, chance) {
        event.custom({
            type: "exdeorum:sieve",
            ingredient: { item: input },
            mesh: { item: mesh },
            result: { count: 1, id: output },
            result_amount: { type: "minecraft:binomial", n: 1.0, p: chance }
        })
    }
    function addCompressedSieve(inputTag, output, mesh, chance, nValue) {
        event.custom({
            type: "exdeorum:compressed_sieve",
            ingredient: { tag: inputTag },
            mesh: { item: mesh },
            result: { count: 1, id: output },
            result_amount: { type: "minecraft:binomial", n: nValue, p: chance }
        })
    }

    const infusedStones = [
        'thavma:ignis_infused_stone',
        'thavma:aer_infused_stone',
        'thavma:terra_infused_stone',
        'thavma:aqua_infused_stone',
        'thavma:aether_infused_stone'
    ];

    // Добавляем рецепты
    infusedStones.forEach(stone => {
        // Обычная просейка
        addSieve('exdeorum:crushed_end_stone', stone, 'exdeorum:netherite_mesh', 0.01);
        
        addCompressedSieve('exdeorum:compressed/crushed_end_stone', stone, 'exdeorum:netherite_mesh', 0.01, 9.0);
    });
	
function addCompressedTechSieve(inputTag, outputItem, baseChance) { 
        event.custom({
            type: "exdeorum:compressed_sieve",
            ingredient: {
                tag: inputTag.replace('#', '')
            },
            mesh: {
                item: "kubejs:industrial_mesh" 
            },
            result: {
                count: 1, 
                id: outputItem
            },
            result_amount: {
                type: "minecraft:binomial",
                n: 9.0, 
                p: baseChance 
            }
        })
    }
    
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_aluminium', 0.10) // Рудный алюминий
    addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_titanium', 0.06) // Титан
    addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_vanadium', 0.06) // Ванадий
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_cobalt', 0.06)    // Рудный кобальт
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_magnesium', 0.06) // Рудный магний
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_manganese', 0.06) // Рудный марганец
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_cadmium', 0.06)   // Рудный кадмий
    addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_chromium', 0.04)   // Хром
    addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_mikhail', 0.04) // Рудный михал
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_spinel', 0.04)    // Рудная шпинель
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_germanium', 0.04) // Рудный германий
    addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_molybdenum', 0.06) // Рудный молибден
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_neodymium', 0.06) // Рудный неодим
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_niobium', 0.06) //  Рудный ниобий
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_palladium', 0.06) // Рудный палладий
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_polonium', 0.06) // Рудный полоний
	addCompressedTechSieve('#exdeorum:compressed/gravel', 'industrialupgrade:raw_metals/raw_strontium', 0.06) // Рудный стронций
	
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'powah:uraninite', 0.06)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'allthemodium:allthemodium_nugget', 0.03)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'allthemodium:vibranium_nugget', 0.01)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'allthemodium:unobtainium_nugget', 0.01)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'actuallyadditions:black_quartz', 0.07)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'alltheores:fluorite', 0.06)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'forbidden_arcanus:arcane_crystal', 0.06)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'alltheores:sulfur', 0.12)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'mysticalagriculture:prosperity_shard', 0.12)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'mysticalagriculture:soulium_dust', 0.3)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'draconicevolution:draconium_dust', 0.9)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'create:ochrum', 0.7)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'create:asurine', 0.7)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'create:crimsite', 0.7)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'create:veridium', 0.7)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'xycraft_world:kivi', 0.08)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'xycraft_world:xychorium_gem_blue', 0.08)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'xycraft_world:xychorium_gem_green', 0.08)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'xycraft_world:xychorium_gem_red', 0.08)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'xycraft_world:xychorium_gem_dark', 0.08)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'xycraft_world:xychorium_gem_light', 0.08)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'alltheores:salt', 0.10)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'dragonsurvival:elder_dragon_dust', 0.03)
	addCompressedTechSieve('#exdeorum:compressed/crushed_end_stone', 'moremekanismprocessing:gem_apatite', 0.03)
	
	// --- ИЗМЕЛЬЧЁННЫЙ АДСКИЙ КАМЕНЬ (Адская ветка) ---
    addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'industrialupgrade:raw_metals/raw_barium', 0.06) // Барий
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'industrialupgrade:raw_metals/raw_bismuth', 0.06) // Рудный висмут
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'industrialupgrade:raw_metals/raw_gadolinium', 0.06) // Рудный гадолиний
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'industrialupgrade:raw_metals/raw_yttrium', 0.06) // Рудный иттрий
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'industrialupgrade:raw_metals/raw_thallium', 0.06) // Рудный таллий
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'industrialupgrade:raw_metals/raw_zirconium', 0.06) // Рудный цирконий
    addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'modern_industrialization:raw_tungsten', 0.05) // Вольфрам
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'industrialupgrade:raw_metals/raw_tantalum', 0.04) // Тантал
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'industrialupgrade:raw_metals/raw_arsenic', 0.04) // Мышьяк
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'industrialupgrade:raw_metals/raw_gallium', 0.04) // Добавлен Галлий
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'industrialupgrade:raw_metals/raw_hafnium', 0.04) // Рудный гафний
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'evilcraft:dark_gem', 0.04)
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'evilcraft:dark_power_gem', 0.02)
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'forbidden_arcanus:stella_arcanum', 0.01)
    addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'forbidden_arcanus:arcane_crystal_ore', 0.01)
	addCompressedTechSieve('#exdeorum:compressed/crushed_netherrack', 'forbidden_arcanus:runic_stone', 0.01)
})