/*
██╗  ██╗ █████╗ ██╗   ██╗███████╗███╗   ██╗    ███╗   ███╗ ██████╗ ██████╗ ██████╗  █████╗  ██████╗██╗  ██╗███████╗
██║  ██║██╔══██╗██║   ██║██╔════╝████╗  ██║    ████╗ ████║██╔═══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║ ██╔╝██╔════╝
███████║███████║██║   ██║█████╗  ██╔██╗ ██║    ██╔████╔██║██║   ██║██║  ██║██████╔╝███████║██║     █████╔╝ ███████╗
██╔══██║██╔══██║╚██╗ ██╔╝██╔══╝  ██║╚██╗██║    ██║╚██╔╝██║██║   ██║██║  ██║██╔═══╝ ██╔══██║██║     ██╔═██╗ ╚════██║
██║  ██║██║  ██║ ╚████╔╝ ███████╗██║ ╚████║    ██║ ╚═╝ ██║╚██████╔╝██████╔╝██║     ██║  ██║╚██████╗██║  ██╗███████║
╚═╝  ╚═╝╚═╝  ╚═╝  ╚═══╝  ╚══════╝╚═╝  ╚═══╝    ╚═╝     ╚═╝ ╚═════╝ ╚═════╝ ╚═╝     ╚═╝  ╚═╝ ╚═════╝╚═╝  ╚═╝╚══════╝
*/
ServerEvents.recipes(e => 
    {
        /**************************** VANILLA CROPS ****************************/
        e.remove({ id: 'immersiveengineering:cloche/wheat' })
        clochevanilla('minecraft:wheat', 1, 'minecraft:wheat_seeds', 'minecraft:dirt', 'crop', 'minecraft:wheat')
        clochevanilla('minecraft:wheat', 8, 'minecraft:wheat_seeds', 'kubejs:haven_soil', 'crop', 'minecraft:wheat')
        
        e.remove({ id: 'immersiveengineering:cloche/sweet_berries' })
        clochevanilla('minecraft:sweet_berries', 1, 'minecraft:sweet_berries', 'minecraft:dirt', 'crop', 'minecraft:sweet_berry_bush')
        clochevanilla('minecraft:sweet_berries', 8, 'minecraft:sweet_berries', 'kubejs:haven_soil', 'crop', 'minecraft:sweet_berry_bush')
        
        e.remove({ id: 'immersiveengineering:cloche/sugar_cane' })
        clochevanilla('minecraft:sugar_cane', 1, 'minecraft:sugar_cane', 'minecraft:sand', 'stacking', 'minecraft:sugar_cane')
        clochevanilla('minecraft:sugar_cane', 8, 'minecraft:sugar_cane', 'kubejs:haven_soil', 'stacking', 'minecraft:sugar_cane')
        
        e.remove({ id: 'immersiveengineering:cloche/cactus' })
        clochevanilla('minecraft:cactus', 1, 'minecraft:cactus', 'minecraft:sand', 'stacking', 'minecraft:cactus')
        clochevanilla('minecraft:cactus', 8, 'minecraft:cactus', 'kubejs:haven_soil', 'stacking', 'minecraft:cactus')
        
        e.remove({ id: 'immersiveengineering:cloche/bamboo' })
        clochevanilla('minecraft:bamboo', 1, 'minecraft:bamboo', 'minecraft:dirt', 'stacking', 'minecraft:bamboo')
        clochevanilla('minecraft:bamboo', 8, 'minecraft:bamboo', 'kubejs:haven_soil', 'stacking', 'minecraft:bamboo')
        
        e.remove({ id: 'immersiveengineering:cloche/beetroot' })
        clochevanilla('minecraft:beetroot', 1, 'minecraft:beetroot_seeds', 'minecraft:dirt', 'crop', 'minecraft:beetroots')
        clochevanilla('minecraft:beetroot', 8, 'minecraft:beetroot_seeds', 'kubejs:haven_soil', 'crop', 'minecraft:beetroots')
        
        e.remove({ id: 'immersiveengineering:cloche/brown_mushroom' })
        clochevanilla('minecraft:brown_mushroom', 1, 'minecraft:brown_mushroom', 'minecraft:dirt', 'generic', 'minecraft:brown_mushroom')
        clochevanilla('minecraft:brown_mushroom', 8, 'minecraft:brown_mushroom', 'kubejs:haven_soil', 'generic', 'minecraft:brown_mushroom')
        
        e.remove({ id: 'immersiveengineering:cloche/red_mushroom' })
        clochevanilla('minecraft:red_mushroom', 1, 'minecraft:red_mushroom', 'minecraft:dirt', 'generic', 'minecraft:red_mushroom')
        clochevanilla('minecraft:red_mushroom', 8, 'minecraft:red_mushroom', 'kubejs:haven_soil', 'generic', 'minecraft:red_mushroom')
        
        e.remove({ id: 'immersiveengineering:cloche/carrot' })
        clochevanilla('minecraft:carrot', 1, 'minecraft:carrot', 'minecraft:dirt', 'crop', 'minecraft:carrots')
        clochevanilla('minecraft:carrot', 8, 'minecraft:carrot', 'kubejs:haven_soil', 'crop', 'minecraft:carrots')
        
        e.remove({ id: 'immersiveengineering:cloche/potato' })
        clochevanilla('minecraft:potato', 1, 'minecraft:potato', 'minecraft:dirt', 'crop', 'minecraft:potatoes')
        clochevanilla('minecraft:potato', 8, 'minecraft:potato', 'kubejs:haven_soil', 'crop', 'minecraft:potatoes')
        
        e.remove({ id: 'immersiveengineering:cloche/pumpkin' })
        clochevanilla('minecraft:pumpkin', 1, 'minecraft:pumpkin_seeds', 'minecraft:dirt', 'stem', 'minecraft:pumpkin')
        clochevanilla('minecraft:pumpkin', 8, 'minecraft:pumpkin_seeds', 'kubejs:haven_soil', 'stem', 'minecraft:pumpkin')
        
        e.remove({ id: 'immersiveengineering:cloche/melon' })
        clochevanilla('minecraft:melon', 1, 'minecraft:melon_seeds', 'minecraft:dirt', 'stem', 'minecraft:melon')
        clochevanilla('minecraft:melon', 8, 'minecraft:melon_seeds', 'kubejs:haven_soil', 'stem', 'minecraft:melon')
        
        e.remove({ id: 'immersiveengineering:cloche/chorus_fruit' })
        clochevanilla('minecraft:chorus_fruit', 1, 'minecraft:chorus_flower', 'minecraft:end_stone', 'chorus', 'minecraft:chorus_flower')
        clochevanilla('minecraft:chorus_fruit', 8, 'minecraft:chorus_flower', 'compressium:endstone_7', 'chorus', 'minecraft:chorus_flower')
        
        e.remove({ id: 'immersiveengineering:cloche/hemp' })
        clochevanilla('immersiveengineering:hemp_fiber', 1, 'immersiveengineering:seed', 'minecraft:dirt', 'hemp', 'immersiveengineering:hemp')
        clochevanilla('immersiveengineering:hemp_fiber', 8, 'immersiveengineering:seed', 'kubejs:haven_soil', 'hemp', 'immersiveengineering:hemp')
        
        e.remove({ id: 'immersiveengineering:cloche/nether_warp' })
        clochevanilla('minecraft:nether_wart', 1, 'minecraft:nether_wart', 'minecraft:soul_sand', 'crop', 'minecraft:nether_wart')
        clochevanilla('minecraft:nether_wart', 8, 'minecraft:nether_wart', 'compressium:soulsand_7', 'crop', 'minecraft:nether_wart')
        
        function clochevanilla(result, qte, input, soil, type, block){e.custom({"type":"immersiveengineering:cloche", "results":[{"item":result,"count":qte}],"input":{"item":input},"soil":{"item" : soil},"time":50,"render":{"type":type,"block": block}})}

        /**************************** HAVEN ALCHEMY CROPS ****************************/
        function alchemycloche(crop, soil, qte){e.custom({"type": "immersiveengineering:cloche", "input": { "item": "havenalchemy:"+crop+"_seeds" }, "soil": { "item": soil }, "time": 180, "render": { "type": "crop", "block": "havenalchemy:"+crop+"_crop" }, "results": [{ "item": "havenalchemy:"+crop+"_spirit", "count": qte }]})}
        var crop = ["air", "earth", "water", "fire", "stone", "dirt", "wood", "ice", "nature", "dye", "nether", "coal", "coral", "honey", "rubber", "silicon", "sulfur", "aluminum", "copper", "basalt", "iron", "nether_quartz", "glowstone", "redstone", "obsidian", "prismarine", "tin", "bronze", "zinc", "brass", "silver", "lead", "gold", "lapis_lazuli", "end", "experience", "steel", "nickel", "uranium", "osmium", "diamond", "emerald", "netherite", "uraninite", "amethyst"]

        crop.forEach(C => { alchemycloche(C, "minecraft:dirt", 1) })
        crop.forEach(C => { alchemycloche(C, "kubejs:haven_soil", 8) })
    })