// priority: 10

ServerEvents.recipes(event => {


  //Normal Bucks
  catalogue(bucks, 1, "minecraft:stone", 8)
  catalogue(bucks, 1, "minecraft:cobblestone", 4)
  catalogue(bucks, 3, "minecraft:furnace", 1)
  catalogue(bucks, 2, "caveopolis:gray_apple", 8)
  catalogue(bucks, 3, "minecraft:fishing_rod", 1)
  catalogue(bucks, 8, "strainers:bamboo_mesh", 1)
  catalogue(bucks, 4, "strainers:leafy_mesh", 1)
  catalogue(bucks, 4, "strainers:string_mesh", 1)
  catalogue(bucks, 6, "strainers:flint_mesh", 1)
  catalogue(bucks, 5, "strainers:wooden_strainer", 1)
  catalogue(bucks, 8, "opolisutilities:catalogue_book", 1)

  catalogue(bucks, 3, 'functionalstorage:framed_1', 4)
  catalogue(bucks, 3, 'functionalstorage:framed_2', 4)
  catalogue(bucks, 3, 'functionalstorage:framed_4', 4)
  catalogue(bucks, 6, 'functionalstorage:compacting_framed_drawer', 1)
  catalogue(bucks, 5, 'functionalstorage:framed_simple_compacting_drawer', 1)
  catalogue(bucks, 8, 'opolisutilities:sapling_grower', 1)
  catalogue(bucks, 4, 'minecraft:carrot', 1)
  catalogue(bucks, 4, 'minecraft:potato', 1)
  catalogue(bucks, 4, 'minecraft:beetroot', 1)

  catalogue(bucks, 3, wooden_hopper, 2)

  //Void Bucks
  catalogue(bucks, 1, "minecraft:stone", 16)
  catalogue(bucks, 6, "ae2:sky_stone_block", 16)

  //Tables
  dryingTable("minecraft:dirt", 1, 200, "minecraft:coarse_dirt", 1, "stoneopolis:coarse_dirt")
  dryingTable("minecraft:coarse_dirt", 1, 200, "stoneopolis:sandy_dirt", 1, "stoneopolis:sandy_dirt")
  soakingTable("minecraft:coarse_dirt", 1, 200, "minecraft:mud", 1, "opolisutilities:soaking_table/mud")

  //Resource Generators

  event.recipes.opolisutilities.resource_generator("stoneopolis:void_chunk", "stoneopolis:void_chunk", 300).id("stoneopolis:void_chunk_resource_generator")
  event.recipes.opolisutilities.rg2_blocks("minecraft:terracotta").id("stoneopolis:terracotta_resource_generator")

  //Functions
  function catalogue(inItem, inPrice, outItem, outCount) {
    event.custom({
      type: "opolisutilities:catalogue",
      ingredient: {item: inItem},
      itemInCount: inPrice,
      result: outItem,
      itemOutCount: outCount
    })
  }

  
  function dryingTable(inItem, inItemCount, duration, outItem, outItemCount, id) {
    event.custom({
      "type": "opolisutilities:drying_table",
      "ingredient":[
      {
        "item": inItem
      }
      ],
      "count": inItemCount,
      "duration": duration,
      "output": {
        "item": outItem,
        "count": outItemCount
      }
    }).id(id)
  }

  function soakingTable(inItem, inItemCount, duration, outItem, outItemCount, id) {
    event.custom({
      "type": "opolisutilities:soaking_table",
      "ingredient":[{"item": inItem}],
      "count": inItemCount,
      "duration": duration,
      "output": {"item": outItem,"count": outItemCount}
    }).id(id)
  }

  function resourceGenerator(inItem, outItem, duration, id) {
    event.custom({
      "type": "opolisutilities:resource_generator",
      "ingredients": [{"item": inItem}],
      "duration": duration,
      "output": {"item": outItem}}).id(id)
  }

  event.remove({type: "opolisutilities:catalogue"})  


})
