// priority: 100

//Dragon Infuser


function dragonInfuser(time, itemIn, itemOut, power){

    onEvent('recipes', e => {
       e.recipes.custommachinery.custom_machine("caveopolis:dragon_infuser", time)
            .requireItem(itemIn)
            .produceItem(itemOut)
            .requireEnergyPerTick(power)
            .requireStructure([["a   a","     ","  m  ","     ","a   a"],["a   a","     ","  b  ","     ","a   a"]], {"a":"minecraft:obsidian", "b":"minecraft:dragon_egg"})
            .requireEntities(4, 5, 'minecraft:end_crystal', true)
            .resetOnError()
        })
    }

    dragonInfuser(300, 'minecraft:wither_skeleton_skull', 'minecraft:dragon_head', 10000)


function dragonInfuser2(time, itemIn, itemOut, power){

    onEvent('recipes', e => {
       e.recipes.custommachinery.custom_machine("caveopolis:dragon_infuser", time)
            .requireItem(itemIn)
            .produceItem(itemOut)
            .requireEnergyPerTick(power)
            .requireStructure([["a   a","     ","  m  ","     ","a   a"],["a   a","     ","  b  ","     ","a   a"]], {"a":"minecraft:obsidian", "b":"minecraft:dragon_head"})
            .requireEntities(4, 5, 'minecraft:end_crystal', true)
            .resetOnError()
        })
    }

    dragonInfuser2(300, 'minecraft:glass_bottle', 'minecraft:dragon_breath', 10000)


//Block Recipe
    
onEvent('recipes', e => {
    e.shaped(Item.of('custommachinery:custom_machine_item', '{machine:"caveopolis:dragon_infuser"}'), ['DOD','OSO', 'DOD'], {O: 'minecraft:shulker_shell', S: Item.of('custommachinery:custom_machine_item', '{machine:"caveopolis:bedrock_infuser"}'), D: 'minecraft:chorus_fruit'}).id('caveopolis:dragon_infuser')
})


