
ServerEvents.recipes(event => {
    const dirt = 'minecraft:dirt';
    const gravel = '#forge:gravel';
    const cdirt = 'minecraft:coarse_dirt';
    const sand = '#minecraft:sand';
    const dust = 'exnihilosequentia:dust';
    const black = 'exnihilosequentia:crushed_blackstone'
    const netherrack = 'exnihilosequentia:crushed_netherrack'
    const endstone = 'exnihilo:crushed_end_stone'

    function sieve(mesh, chance, input, result, wlog) {
        event.custom({
            "type": `exnihilosequentia:sieve`,
            "input": input,
            "result": result,
            "rolls": [{
                chance: chance,
                mesh: mesh
            }],
            "waterlogged": wlog
        })
    }

    function hammer(input, result) {
        event.custom({
            "type": `exnihilosequentia:hammer`,
            "input": input,
            "results": [result]
        })
    }

    function heat(block, heat) {
        event.custom({
            "type": `exnihilosequentia:heat`,
            "block": block,
            "amount": heat
        })
    }

    sieve('string', 0.05, dirt, 'minecraft:cactus', false);
    sieve('string', 0.05, dirt, 'minecraft:sunflower', false);
    sieve('string', 0.05, dirt, 'minecraft:sugar_cane', false);
    sieve('string', 0.03, dirt, 'minecraft:cocoa_beans', false);
    sieve('string', 0.1, dirt, 'thermal:slime_mushroom_spores', false);
    sieve('string', 0.05, sand, 'exnihilosequentia:brain_coral_larva', true);
    sieve('string', 0.05, sand, 'exnihilosequentia:tube_coral_larva', true);
    sieve('string', 0.05, sand, 'exnihilosequentia:bubble_coral_larva', true);
    sieve('string', 0.05, sand, 'exnihilosequentia:horn_coral_larva', true);
    sieve('string', 0.05, sand, 'exnihilosequentia:fire_coral_larva', true);
    sieve('string', 0.05, sand, 'minecraft:sea_pickle', true);
    sieve('string', 0.05, sand, 'kelp', true);
    sieve('string', 0.05, sand, 'minecraft:seagrass', true);

    // gravel
    sieve('string', 0.45, gravel, 'minecraft:raw_iron', false);

    sieve('string', 0.35, gravel, 'minecraft:raw_copper', false);
    sieve('string', 0.3, gravel, 'thermal:raw_tin', false);
    sieve('string', 0.25, gravel, 'gtceu:raw_sphalerite', false);
    sieve('string', 0.1, gravel, 'minecraft:raw_gold', false);

    sieve('flint', 0.2, gravel, 'thermal:raw_tin', false);
    sieve('flint', 0.2, gravel, 'gtceu:raw_pentlandite', false);
    sieve('flint', 0.25, gravel, 'gtceu:raw_chalcopyrite', false);
    sieve('flint', 0.25, gravel, 'gtceu:raw_bornite', false);
    sieve('flint', 0.25, gravel, 'gtceu:raw_cassiterite', false);
    sieve('iron', 0.12, gravel, 'gtceu:raw_pyrolusite', false);
    sieve('iron', 0.05, gravel, 'gtceu:raw_lepidolite', false);
    sieve('iron', 0.1, gravel, 'gtceu:raw_cobaltite', false);
    sieve('iron', 0.16, gravel, 'gtceu:raw_beryllium', false);
    sieve('iron', 0.21, gravel, 'gtceu:raw_chromite', false);
    sieve('iron', 0.05, gravel, 'gtceu:raw_pyrochlore', false);

    sieve('diamond', 0.12, gravel, 'gtceu:raw_molybdenite', false);
    sieve('diamond', 0.02, gravel, 'gtceu:raw_pitchblende', false);
    sieve('diamond', 0.05, gravel, 'gtceu:raw_tantalite', false);
    sieve('diamond', 0.075, gravel, 'gtceu:raw_ilmenite', false);
    sieve('diamond', 0.18, gravel, 'gtceu:raw_bauxite', false);
    sieve('diamond', 0.02, gravel, 'gtceu:raw_pollucite', false);

    sieve('emerald', 0.15, gravel, 'gtceu:raw_tungstate', false);
    sieve('emerald', 0.125, gravel, 'gtceu:raw_scheelite', false);
    sieve('emerald', 0.35, gravel, 'gtceu:raw_bastnasite', false);
    sieve('emerald', 0.25, gravel, 'gtceu:raw_cooperite', false);
    sieve('emerald', 0.12, gravel, 'gtceu:raw_barite', false);

    sieve('netherite', 0.01, gravel, 'gtceu:raw_naquadah', false);

    // sand
    sieve('string', 0.075, sand, 'minecraft:diamond', false);
    sieve('string', 0.08, sand, 'minecraft:lapis_lazuli', false);
    sieve('string', 0.1, sand, 'minecraft:amethyst_shard', false);
    sieve('string', 0.05, sand, 'minecraft:emerald', false);
    sieve('string', 0.2, sand, 'gtceu:raw_nether_quartz', false);

    sieve('flint', 0.1, sand, 'gtceu:raw_green_sapphire', false);
    sieve('flint', 0.1, sand, 'gtceu:raw_sapphire', false);
    sieve('flint', 0.1, sand, 'gtceu:raw_ruby', false);
    sieve('flint', 0.1, sand, 'gtceu:raw_opal', false);
    sieve('flint', 0.1, sand, 'gtceu:raw_coal', false);
    sieve('flint', 0.1, sand, 'gtceu:raw_quartzite', false);
    sieve('flint', 0.1, sand, 'gtceu:raw_certus_quartz', false);
    sieve('flint', 0.1, sand, 'gtceu:raw_salt', false);
    sieve('flint', 0.1, sand, 'gtceu:raw_rock_salt', false);
    sieve('flint', 0.1, sand, 'gtceu:raw_saltpeter', false);
    sieve('flint', 0.1, sand, 'gtceu:raw_realgar', false);

    sieve('iron', 0.14, sand, 'gtceu:raw_blue_topaz', false);
    sieve('iron', 0.14, sand, 'gtceu:raw_topaz', false);
    sieve('iron', 0.08, sand, 'gtceu:raw_yellow_garnet', false);
    sieve('iron', 0.08, sand, 'gtceu:raw_red_garnet', false);
    sieve('iron', 0.1, sand, 'gtceu:raw_garnet_sand', false);
    sieve('iron', 0.2, sand, 'gtceu:raw_apatite', false);
    sieve('iron', 0.15, sand, 'gtceu:raw_monazite', false);

    sieve('diamond', 0.01, sand, 'mmt:moonstone', false);
    sieve('diamond', 0.01, sand, 'mmt:sunstone', false);

    // dust
    sieve('string', 0.4, dust, 'gtceu:raw_redstone', false);
    sieve('string', 0.4, dust, 'minecraft:glowstone_dust', false);
    sieve('string', 0.3, dust, 'thermal:sulfur_dust', false);
    sieve('string', 0.05, dust, 'minecraft:ender_pearl', false);
    sieve('string', 0.1, dust, 'minecraft:echo_shard', false);

    sieve('flint', 0.25, dust, 'ae2:sky_dust', false);

    // blackstone
    sieve('string', 0.4, black, 'gtceu:raw_galena', false);
    sieve('string', 0.3, black, 'gtceu:raw_stibnite', false);  
});

