// priority: 100

//Block Eroder


function waterEroder(time, itemIn, itemOut){

onEvent('recipes', e => {
    e.recipes.custommachinery.custom_machine("caveopolis:block_eroder", time)
        .requireStructure([["aaa", "ama", "aaa"]], {"a": "minecraft:water[level=0]"})
        .requireItem(itemIn)
        .produceItem(itemOut)
    })
}

waterEroder(80, 'minecraft:stone', 'minecraft:cobblestone')
waterEroder(80, 'minecraft:smooth_stone', 'minecraft:gravel')
waterEroder(80, 'minecraft:gravel', 'minecraft:sand')

waterEroder(80, 'minecraft:green_wool', 'minecraft:string')
waterEroder(80, 'minecraft:lime_wool', 'minecraft:string')
waterEroder(80, 'minecraft:magenta_wool', 'minecraft:string')
waterEroder(80, 'minecraft:pink_wool', 'minecraft:string')
waterEroder(80, 'minecraft:light_gray_wool', 'minecraft:string')
waterEroder(80, 'minecraft:gray_wool', 'minecraft:string')
waterEroder(80, 'minecraft:light_blue_wool', 'minecraft:string')
waterEroder(80, 'minecraft:blue_wool', 'minecraft:string')
waterEroder(80, 'minecraft:cyan_wool', 'minecraft:string')
waterEroder(80, 'minecraft:white_wool', 'minecraft:string')
waterEroder(80, 'minecraft:black_wool', 'minecraft:string')
waterEroder(80, 'minecraft:yellow_wool', 'minecraft:string')
waterEroder(80, 'minecraft:orange_wool', 'minecraft:string')
waterEroder(80, 'minecraft:red_wool', 'minecraft:string')
waterEroder(80, 'minecraft:brown_wool', 'minecraft:string')
waterEroder(80, 'minecraft:purple_wool', 'minecraft:string')

waterEroder(80, 'minecraft:smooth_stone_slab', 'prettypipes:blank_module')
waterEroder(80, 'minecraft:dripstone_block', 'minecraft:pointed_dripstone')
waterEroder(80, 'minecraft:prismarine', 'minecraft:prismarine_shard')

waterEroder(80, 'minecraft:moss_block', '2x mekanism:bio_fuel')
waterEroder(80, 'quark:azalea_log', '2x minecraft:oak_planks')

waterEroder(160, 'thermal:oil_red_sand', 'thermal:bitumen')
waterEroder(160, 'thermal:oil_sand', 'thermal:bitumen')
waterEroder(160, 'minecraft:magma_cream', 'minecraft:slime_ball')
waterEroder(160, 'minecraft:blaze_powder', 'caveopolis:withering_dust')

waterEroder(160, 'caveopolis:toprock', 'minecraft:end_stone')
waterEroder(160, 'minecraft:bone_block', 'minecraft:bone')
waterEroder(160, 'minecraft:obsidian', '3x morevanillalib:obsidian_shard')

waterEroder(160, 'minecraft:leather_helmet', 'minecraft:leather')
waterEroder(160, 'minecraft:leather_chestplate', 'minecraft:leather')
waterEroder(160, 'minecraft:leather_leggings', 'minecraft:leather')
waterEroder(160, 'minecraft:leather_boots', 'minecraft:leather')


//water(40, 'minecraft:leaves', 25)

//with 50% chance

function ingotToDust(time, itemIn, itemOut){

onEvent('recipes', e => {
    e.recipes.custommachinery.custom_machine("caveopolis:block_eroder", time)
        .requireStructure([["aaa", "ama", "aaa"]], {"a": "minecraft:water[level=0]"})
        .requireItem(itemIn)
        .produceItem(itemOut)
        .resetOnError()
    })
}

ingotToDust(120, '2x minecraft:copper_ingot', 'thermal:copper_dust')
ingotToDust(120, '2x thermal:tin_ingot', 'thermal:tin_dust')
ingotToDust(120, '2x thermal:bronze_ingot', 'thermal:bronze_dust')
ingotToDust(120, '2x thermal:invar_ingot', 'thermal:invar_dust')
ingotToDust(120, '2x thermal:nickel_ingot', 'thermal:nickel_dust')
ingotToDust(120, '2x minecraft:iron_ingot', 'thermal:iron_dust')
ingotToDust(120, '2x minecraft:gold_ingot', 'thermal:gold_dust')
ingotToDust(120, '2x thermal:lead_ingot', 'thermal:lead_dust')
ingotToDust(120, '2x thermal:constantan_ingot', 'thermal:constantan_dust')

ingotToDust(120, 'caveopolis:mixed_stone_fragment', 'minecraft:clay_ball')

ingotToDust(160, '4x minecraft:nether_brick', 'minecraft:blaze_powder')





//Block Recipe

onEvent('recipes', e => {
e.shaped(Item.of('custommachinery:custom_machine_item', '{machine:"caveopolis:block_eroder"}'), ['PHP','PBP', 'PHP'], {H: 'woodenhopper:wooden_hopper', P: '#minecraft:planks', B: Item.of('woodenbucket:wooden_bucket', '{Fluid:{Amount:1000,FluidName:"minecraft:water"}}')}).id('caveopolis:block_eroder')
})