// priority: 100

//Organic Producer


function organicLava (time, lava_amount, item1, item2, outputItem){

    onEvent('recipes', e => {
        e.recipes.custommachinery.custom_machine("caveopolis:organic_producer", time)
            .requireFluid(Fluid.of("minecraft:lava", lava_amount))
            .requireItem(Item.of(item1, 1), "input1")
            .requireItem(Item.of(item2, 1), "input2")
            .produceItem(Item.of(outputItem, 1))
            .resetOnError()
        })
    }

    organicLava(100, 1000, 'minecraft:brown_mushroom', 'minecraft:brown_mushroom', 'minecraft:warped_fungus')
    organicLava(100, 1000, 'minecraft:red_mushroom', 'minecraft:red_mushroom', 'minecraft:crimson_fungus')
    organicLava(100, 1000, 'minecraft:red_mushroom', 'minecraft:brown_mushroom', 'minecraft:nether_wart')

function organicMisc (time, water_amount, item1, item2, outputItem){

    onEvent('recipes', e => {
        e.recipes.custommachinery.custom_machine("caveopolis:organic_producer", time)
            .requireFluid(Fluid.of("minecraft:water", water_amount))
            .requireItem(Item.of(item1, 8), "input1")
            .requireItem(Item.of(item2, 1), "input2")
            .produceItem(Item.of(outputItem, 1))
            .resetOnError()
        })
    }

    organicMisc(100, 1000, 'minecraft:flint', 'minecraft:green_wool', 'minecraft:cactus')
    organicMisc(100, 1000, 'minecraft:dirt', 'minecraft:green_wool', 'minecraft:grass_block')
    organicMisc(100, 1000, 'minecraft:flowering_azalea', 'minecraft:stick', 'minecraft:sugar_cane')
    organicMisc(100, 1000, 'minecraft:sugar_cane', 'minecraft:stick', 'minecraft:bamboo')
    organicMisc(100, 1000, 'minecraft:bamboo', 'caveopolis:moss_ball', 'minecraft:lily_pad')




function organicSaplings (time, water_amount, item1, item2, outputItem){

    onEvent('recipes', e => {
        e.recipes.custommachinery.custom_machine("caveopolis:organic_producer", time)
            .requireFluid(Fluid.of("minecraft:water", water_amount))
            .requireItem(Item.of(item1, 8), "input1")
            .requireItem(Item.of(item2, 1), "input2")
            .produceItem(Item.of(outputItem, 1))
            .resetOnError()
        })
    }

    organicSaplings(100, 1000, 'caveopolis:moss_ball', 'minecraft:flowering_azalea', 'minecraft:oak_sapling')
    organicSaplings(100, 1000, 'caveopolis:moss_ball', 'minecraft:azalea', 'minecraft:birch_sapling')

    organicSaplings(100, 1000, 'caveopolis:moss_ball', 'minecraft:oak_sapling', 'minecraft:dark_oak_sapling')
    organicSaplings(100, 1000, 'caveopolis:moss_ball', 'minecraft:birch_sapling', 'minecraft:jungle_sapling')

    organicSaplings(100, 1000, 'caveopolis:moss_ball', 'minecraft:dark_oak_sapling', 'minecraft:spruce_sapling')
    organicSaplings(100, 1000, 'caveopolis:moss_ball', 'minecraft:jungle_sapling', 'minecraft:acacia_sapling')


    organicSaplings(100, 1000, 'minecraft:moss_block', 'caveopolis:moss_ball', 'minecraft:dirt')
    organicSaplings(100, 1000, 'minecraft:seagrass', 'minecraft:seagrass', 'minecraft:kelp')



function organicSeeds (time, water_amount, item1, item2, outputItem){

    onEvent('recipes', e => {
        e.recipes.custommachinery.custom_machine("caveopolis:organic_producer", time)
            .requireFluid(Fluid.of("minecraft:water", water_amount))
            .requireItem(Item.of(item1, 8), "input1")
            .requireItem(Item.of(item2, 1), "input2")
            .produceItem(Item.of(outputItem, 1))
            .resetOnError()
        })
    }

    organicSeeds(100, 1000, 'minecraft:wheat_seeds', 'minecraft:wheat_seeds', 'minecraft:beetroot_seeds')

    organicSeeds(100, 1000, 'minecraft:wheat_seeds', 'minecraft:red_dye', 'minecraft:melon_seeds')
    organicSeeds(100, 1000, 'minecraft:wheat_seeds', 'minecraft:orange_dye', 'minecraft:pumpkin_seeds')

    organicSeeds(100, 1000, 'minecraft:wheat_seeds', 'minecraft:melon', 'minecraft:potato')
    organicSeeds(100, 1000, 'minecraft:wheat_seeds', 'minecraft:pumpkin', 'minecraft:carrot')

    organicSeeds(100, 1000, 'minecraft:potato', 'minecraft:beetroot', 'minecraft:glow_berries')
    organicSeeds(100, 1000, 'minecraft:carrot', 'minecraft:beetroot', 'minecraft:sweet_berries')
  

function organicFlowers (time, water_amount, item1, item2, outputItem){

    onEvent('recipes', e => {
        e.recipes.custommachinery.custom_machine("caveopolis:organic_producer", time)
            .requireFluid(Fluid.of("minecraft:water", water_amount))
            .requireItem(Item.of(item1, 1), "input1")
            .requireItem(Item.of(item2, 1), "input2")
            .produceItem(Item.of(outputItem, 1))
            .resetOnError()
        })
    }

    organicFlowers(100, 1000, 'minecraft:poppy', 'caveopolis:moss_ball', 'minecraft:red_mushroom')
    organicFlowers(100, 1000, 'minecraft:dandelion', 'caveopolis:moss_ball', 'minecraft:brown_mushroom')

    organicFlowers(100, 1000, 'minecraft:poppy', 'minecraft:blue_dye', 'minecraft:cornflower')
    organicFlowers(100, 1000, 'minecraft:poppy', 'minecraft:white_dye', 'minecraft:oxeye_daisy')
    organicFlowers(100, 1000, 'minecraft:poppy', 'minecraft:light_gray_dye', 'minecraft:azure_bluet')
    organicFlowers(100, 1000, 'minecraft:poppy', 'minecraft:red_dye', 'minecraft:red_tulip')
    organicFlowers(100, 1000, 'minecraft:poppy', 'minecraft:orange_dye', 'minecraft:orange_tulip')
    organicFlowers(100, 1000, 'minecraft:poppy', 'minecraft:bone_meal', 'minecraft:white_tulip')
    organicFlowers(100, 1000, 'minecraft:poppy', 'minecraft:pink_dye', 'minecraft:pink_tulip')
    organicFlowers(100, 1000, 'minecraft:poppy', 'minecraft:purple_dye', 'minecraft:allium')
    organicFlowers(100, 1000, 'minecraft:poppy', 'minecraft:light_blue_dye', 'minecraft:blue_orchid')
    organicFlowers(100, 1000, 'minecraft:poppy', 'minecraft:gray_dye', 'minecraft:lily_of_the_valley')

    organicFlowers(100, 1000, 'minecraft:dandelion', 'minecraft:white_dye', 'minecraft:oxeye_daisy')
    organicFlowers(100, 1000, 'minecraft:dandelion', 'minecraft:light_gray_dye', 'minecraft:azure_bluet')
    organicFlowers(100, 1000, 'minecraft:dandelion', 'minecraft:red_dye', 'minecraft:red_tulip')
    organicFlowers(100, 1000, 'minecraft:dandelion', 'minecraft:orange_dye', 'minecraft:orange_tulip')
    organicFlowers(100, 1000, 'minecraft:dandelion', 'minecraft:bone_meal', 'minecraft:white_tulip')
    organicFlowers(100, 1000, 'minecraft:dandelion', 'minecraft:pink_dye', 'minecraft:pink_tulip')
    organicFlowers(100, 1000, 'minecraft:dandelion', 'minecraft:purple_dye', 'minecraft:allium')
    organicFlowers(100, 1000, 'minecraft:dandelion', 'minecraft:light_blue_dye', 'minecraft:blue_orchid')
    organicFlowers(100, 1000, 'minecraft:dandelion', 'minecraft:gray_dye', 'minecraft:lily_of_the_valley')

    organicFlowers(100, 1000, 'minecraft:dandelion', 'minecraft:dandelion', 'minecraft:sunflower')
    organicFlowers(100, 1000, 'minecraft:pink_tulip', 'minecraft:pink_tulip', 'minecraft:lilac')
    organicFlowers(100, 1000, 'minecraft:poppy', 'minecraft:poppy', 'minecraft:rose_bush')
    organicFlowers(100, 1000, 'minecraft:allium', 'minecraft:allium', 'minecraft:peony')

    //Block Recipe
    
    onEvent('recipes', e => {
    e.shaped(Item.of('custommachinery:custom_machine_item', '{machine:"caveopolis:organic_producer"}'), ['WSW','BAB', 'WSW'], {W: 'minecraft:wheat', B: 'thermal:bronze_ingot', S: 'caveopolis:mixed_stone_ingot', A: Item.of('custommachinery:custom_machine_item', '{machine:"caveopolis:alloy_mixer"}')}).id('caveopolis:organic_producer')
    })