var mega_crusher_structure = [["abbba","bcccb","bcccb","bcccb","abbba"],["a   a"," ddd "," ddd "," ddd ","a   a"],["e   e","  f  "," fff ","  f  ","e   e"],["     ","     ","  f  ","  m  ","     "],["g   g","  f  "," fff ","  f  ","g   g"],["a   a"," ddd "," ddd "," ddd ","a   a"],["abbba","bhhhb","bhhhb","bhhhb","abbba"]]
var mega_crusher_structure_dictionary = {"a":"astralsorcery:marble_bricks","b":"kubejs:mega_crusher_casing","c":"minecraft:piston[extended=false,facing=up]","d":"astralsorcery:starmetal","e":"astralsorcery:marble_slab[type=bottom,waterlogged=false]","f":"extendedcrafting:nether_star_block","g":"astralsorcery:marble_slab[type=top,waterlogged=false]","h":"minecraft:piston[extended=false,facing=down]"}

onEvent('recipes', event => {

    //Ores

    //Iron Ore crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("kubejs:iron_dust", 64))
        .produceItem(Item.of("kubejs:iron_dust", 64))
        .produceItem(Item.of("kubejs:iron_dust", 64))
        .produceItem(Item.of("kubejs:gold_dust", 64))
        .requireItem(Item.of("minecraft:iron_ore", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Gold Ore crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("kubejs:gold_dust", 64))
        .produceItem(Item.of("kubejs:gold_dust", 64))
        .produceItem(Item.of("kubejs:gold_dust", 64))
        .produceItem(Item.of("kubejs:iron_dust", 64))
        .requireItem(Item.of("minecraft:gold_ore", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Coal Ore crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("kubejs:coal_dust", 64))
        .produceItem(Item.of("kubejs:coal_dust", 64))
        .produceItem(Item.of("kubejs:coal_dust", 64))
        .requireItem(Item.of("minecraft:coal_ore", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Diamond Ore crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("kubejs:diamond_dust", 64))
        .produceItem(Item.of("kubejs:diamond_dust", 64))
        .produceItem(Item.of("kubejs:diamond_dust", 64))
        .produceItem(Item.of("kubejs:emerald_dust", 64))
        .requireItem(Item.of("minecraft:diamond_ore", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Emerald Ore crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("kubejs:emerald_dust", 64))
        .produceItem(Item.of("kubejs:emerald_dust", 64))
        .produceItem(Item.of("kubejs:emerald_dust", 64))
        .produceItem(Item.of("kubejs:diamond_dust", 64))
        .requireItem(Item.of("minecraft:emerald_ore", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Redstone Ore crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("minecraft:redstone", 64))
        .produceItem(Item.of("minecraft:redstone", 64))
        .produceItem(Item.of("minecraft:redstone", 64))
        .produceItem(Item.of("minecraft:redstone", 64))
        .produceItem(Item.of("minecraft:redstone", 32))
        .produceItem(Item.of("kubejs:lapis_dust", 64))
        .requireItem(Item.of("minecraft:redstone_ore", 32))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Lapis Ore crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("kubejs:lapis_dust", 64))
        .produceItem(Item.of("kubejs:lapis_dust", 64))
        .produceItem(Item.of("kubejs:lapis_dust", 64))
        .produceItem(Item.of("kubejs:lapis_dust", 64))
        .produceItem(Item.of("kubejs:lapis_dust", 32))
        .produceItem(Item.of("minecraft:redstone", 64))
        .requireItem(Item.of("minecraft:lapis_ore", 32))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Nether Quartz Ore crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("kubejs:quartz_dust", 64))
        .produceItem(Item.of("kubejs:quartz_dust", 64))
        .produceItem(Item.of("kubejs:quartz_dust", 64))
        .requireItem(Item.of("minecraft:nether_quartz_ore", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Nether Gold Ore crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("kubejs:gold_dust", 64))
        .produceItem(Item.of("kubejs:gold_dust", 64))
        .produceItem(Item.of("kubejs:quartz_dust", 64))
        .requireItem(Item.of("minecraft:nether_gold_ore", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Ancient Debris crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("kubejs:ancient_debris_dust", 64))
        .produceItem(Item.of("kubejs:ancient_debris_dust", 64))
        .produceItem(Item.of("kubejs:ancient_debris_dust", 64))
        .produceItem(Item.of("kubejs:ancient_debris_dust", 64))
        .produceItem(Item.of("kubejs:ancient_debris_dust", 64))
        .produceItem(Item.of("kubejs:ancient_debris_dust", 64))
        .produceItem(Item.of("kubejs:quartz_dust", 64))
        .requireItem(Item.of("minecraft:ancient_debris", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Aquamarine Shale crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("kubejs:aquamarine_dust", 64))
        .produceItem(Item.of("kubejs:aquamarine_dust", 64))
        .produceItem(Item.of("kubejs:aquamarine_dust", 64))
        .requireItem(Item.of("astralsorcery:aquamarine_sand_ore", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Starmetal Ore crushing
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("astralsorcery:stardust", 64))
        .produceItem(Item.of("astralsorcery:stardust", 64))
        .produceItem(Item.of("astralsorcery:stardust", 64))
        .produceItem(Item.of("kubejs:aquamarine_dust", 64))
        .requireItem(Item.of("astralsorcery:starmetal_ore", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)
    


    //Materials

    //Iron Dust from Ingot
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("kubejs:iron_dust", 64))
        .requireItem(Item.of("minecraft:iron_ingot", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Gold Dust from Ingot
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("kubejs:gold_dust", 64))
        .requireItem(Item.of("minecraft:gold_ingot", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Coal Dust from Gem
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("kubejs:coal_dust", 64))
        .requireItem(Item.of("minecraft:coal", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Diamond Dust from Gem
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("kubejs:diamond_dust", 64))
        .requireItem(Item.of("minecraft:diamond", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Emerald Dust from Gem
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("kubejs:emerald_dust", 64))
        .requireItem(Item.of("minecraft:emerald", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Lapis Dust from Gem
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("kubejs:lapis_dust", 64))
        .requireItem(Item.of("minecraft:lapis_lazuli", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Quartz Dust from Gem
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("kubejs:quartz_dust", 64))
        .requireItem(Item.of("minecraft:quartz", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Netherite Dust from Scrap
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("kubejs:ancient_debris_dust", 64))
        .requireItem(Item.of("minecraft:netherite_scrap", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Aquamarine Dust from Gem
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("kubejs:aquamarine_dust", 64))
        .requireItem(Item.of("astralsorcery:aquamarine", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Stardust from Ingot
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("astralsorcery:stardust", 64))
        .requireItem(Item.of("astralsorcery:starmetal_ingot", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Rock Crystal Dust from Gem
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("kubejs:rock_crystal_dust"))
        .requireItem(Item.of("astralsorcery:rock_crystal"))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Glass Dust from Block
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 200)
        .produceItem(Item.of("kubejs:glass_dust", 64))
        .produceItem(Item.of("kubejs:glass_dust", 64))
        .produceItem(Item.of("kubejs:glass_dust", 64))
        .produceItem(Item.of("kubejs:glass_dust", 64))
        .requireItem(Item.of("minecraft:glass", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Obsidian Dust from Block
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 200)
        .produceItem(Item.of("kubejs:obsidian_dust", 64))
        .produceItem(Item.of("kubejs:obsidian_dust", 64))
        .produceItem(Item.of("kubejs:obsidian_dust", 64))
        .produceItem(Item.of("kubejs:obsidian_dust", 64))
        .produceItem(Item.of("kubejs:obsidian_dust", 64))
        .produceItem(Item.of("kubejs:obsidian_dust", 64))
        .produceItem(Item.of("kubejs:obsidian_dust", 64))
        .produceItem(Item.of("kubejs:obsidian_dust", 64))
        .requireItem(Item.of("minecraft:obsidian", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Ender Dust from Pearl
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 200)
        .produceItem(Item.of("kubejs:ender_dust", 64))
        .produceItem(Item.of("kubejs:ender_dust", 64))
        .produceItem(Item.of("kubejs:ender_dust", 64))
        .produceItem(Item.of("kubejs:ender_dust", 64))
        .produceItem(Item.of("kubejs:ender_dust", 64))
        .produceItem(Item.of("kubejs:ender_dust", 64))
        .produceItem(Item.of("kubejs:ender_dust", 64))
        .produceItem(Item.of("kubejs:ender_dust", 64))
        .requireItem(Item.of("minecraft:ender_pearl", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Prismarine Crystals from Shard
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 50)
        .produceItem(Item.of("minecraft:prismarine_crystals", 64))
        .requireItem(Item.of("minecraft:prismarine_shard", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)



    //Misc

    //Black Dye from Sooty Marble
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("minecraft:black_dye", 64))
        .produceItem(Item.of("minecraft:black_dye", 64))
        .produceItem(Item.of("minecraft:black_dye", 64))
        .produceItem(Item.of("minecraft:black_dye", 64))
        .produceItem(Item.of("minecraft:black_dye", 64))
        .produceItem(Item.of("minecraft:black_dye", 64))
        .produceItem(Item.of("minecraft:black_dye", 64))
        .produceItem(Item.of("minecraft:black_dye", 64))
        .requireItem(Item.of("astralsorcery:black_marble_raw", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)
    
    //Bone Meal
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("minecraft:bone_meal", 64))
        .produceItem(Item.of("minecraft:bone_meal", 64))
        .produceItem(Item.of("minecraft:bone_meal", 64))
        .produceItem(Item.of("minecraft:bone_meal", 64))
        .requireItem(Item.of("minecraft:bone", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)
    
    //String from Wool
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("minecraft:string", 64))
        .produceItem(Item.of("minecraft:string", 64))
        .produceItem(Item.of("minecraft:string", 64))
        .produceItem(Item.of("minecraft:string", 64))
        .requireItemTag("#minecraft:wool", 64)
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)
    
    //Bricks block decompression
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("minecraft:brick", 64))
        .produceItem(Item.of("minecraft:brick", 64))
        .produceItem(Item.of("minecraft:brick", 64))
        .produceItem(Item.of("minecraft:brick", 64))
        .requireItem(Item.of("minecraft:bricks", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)
    
    //Nether Bricks block decompression
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("minecraft:nether_brick", 64))
        .produceItem(Item.of("minecraft:nether_brick", 64))
        .produceItem(Item.of("minecraft:nether_brick", 64))
        .produceItem(Item.of("minecraft:nether_brick", 64))
        .requireItem(Item.of("minecraft:nether_bricks", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Nether Quartz block decompression
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("minecraft:quartz", 64))
        .produceItem(Item.of("minecraft:quartz", 64))
        .produceItem(Item.of("minecraft:quartz", 64))
        .produceItem(Item.of("minecraft:quartz", 64))
        .requireItem(Item.of("minecraft:quartz_block", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Glowstone block decompression
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("minecraft:glowstone_dust", 64))
        .produceItem(Item.of("minecraft:glowstone_dust", 64))
        .produceItem(Item.of("minecraft:glowstone_dust", 64))
        .produceItem(Item.of("minecraft:glowstone_dust", 64))
        .requireItem(Item.of("minecraft:glowstone", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Blaze Powder
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("minecraft:blaze_powder", 64))
        .produceItem(Item.of("minecraft:blaze_powder", 64))
        .produceItem(Item.of("minecraft:blaze_powder", 64))
        .requireItem(Item.of("minecraft:blaze_rod", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Flint
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("minecraft:flint", 64))
        .produceItem(Item.of("minecraft:flint", 64))
        .produceItem(Item.of("minecraft:flint", 64))
        .requireItem(Item.of("minecraft:gravel", 64))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

    //Clay block decompression
    event.recipes.custommachinery.custom_machine("modpack:mega_crusher", 100)
        .produceItem(Item.of("minecraft:clay_ball", 64))
        .produceItem(Item.of("minecraft:clay_ball", 64))
        .produceItem(Item.of("minecraft:clay_ball", 64))
        .produceItem(Item.of("minecraft:clay_ball", 64))
        .requireItem(Item.of("minecraft:clay"))
        .requireEnergyPerTick(50)
        .requireStructure(mega_crusher_structure, mega_crusher_structure_dictionary)

})