ServerEvents.tags('item', event => {
  event.add('matc:inferium', 'matc:supremium_crystal')
  event.add('matc:prudentium', 'matc:supremium_crystal')
  event.add('matc:tertium', 'matc:supremium_crystal')
  event.add('matc:imperium', 'matc:supremium_crystal')
})

ServerEvents.recipes(event => {
  function multi(item, count) {
    return Array(count).fill(item)
  }

  // Add a recipe for prosperity shards
  event.recipes.botania.mana_infusion("mysticalagriculture:prosperity_shard", "minecraft:amethyst_shard", 250)

  // Change Mystical Fertilizer recipes
  event.remove({output: 'mysticalagriculture:mystical_fertilizer'})
  event.shapeless('mysticalagriculture:mystical_fertilizer', ['minecraft:bone_meal', 'botania:fertilizer', 'mysticalagriculture:inferium_essence'])

  // Remove all vanilla Mystical Agriculture seeds recipes
  event.remove({type: 'mysticalagriculture:infusion', output: '#forge:seeds'})
  
  // Remove seed reprocessor and its recipes
  event.remove({id: 'mysticalagriculture:seed_reprocessor'})
  event.remove({type: 'mysticalagriculture:reprocessor'})

  // Remove harvester
  event.remove({id: 'mysticalagriculture:harvester'})

  //
  // Infusion Crystals
  //

  // Removes all vanilla Crystal Recipes
  event.remove({id: 'matc:crystals/inferium'})
  event.remove({id: 'matc:crystals/prudentium'})
  event.remove({id: 'matc:crystals/tertium'})
  event.remove({id: 'matc:crystals/imperium'})
  event.remove({id: 'matc:crystals/supremium'})
  event.remove({id: 'matc:crystals/master_infusion_crystal_superium'})

  // Adds new Crystal Recipes
  event.shaped(
    'matc:inferium_crystal',
    [
      'EEE',
      'EPE',
      'EEE'
    ],
    {
      E: 'mysticalagriculture:inferium_essence',
      P: 'botania:mana_pearl'
    }
  )
  event.recipes.botania.runic_altar('matc:prudentium_crystal', ['mysticalagriculture:coal_essence', 'mysticalagriculture:copper_essence', 'mysticalagriculture:iron_essence', 'mysticalagriculture:nether_essence', 'mysticalagriculture:dye_essence'].concat(multi('mysticalagriculture:prudentium_essence', 4)), 12500)
  event.recipes.botania.runic_altar('matc:tertium_crystal', ['mysticalagriculture:air_essence', 'mysticalagriculture:earth_essence', 'mysticalagriculture:fire_essence', 'mysticalagriculture:water_essence', 'mysticalagriculture:nether_quartz_essence', 'mysticalagriculture:experience_essence', 'mysticalagriculture:redstone_essence', 'mysticalagriculture:lapis_lazuli_essence', 'mysticalagriculture:spider_essence', 'mysticalagriculture:tin_essence'].concat(multi('mysticalagriculture:tertium_essence', 4)), 25000)
  event.recipes.botania.runic_altar('matc:imperium_crystal', ['mysticalagriculture:aluminum_essence', 'mysticalagriculture:diamond_essence', 'mysticalagriculture:emerald_essence', 'mysticalagriculture:end_essence', 'mysticalagriculture:gold_essence', 'mysticalagriculture:silver_essence', 'mysticalagriculture:blaze_essence', 'mysticalagriculture:creeper_essence', 'mysticalagriculture:enderman_essence'].concat(multi('mysticalagriculture:imperium_essence', 4)), 50000)
  event.recipes.botania.runic_altar('matc:supremium_crystal', ['matc:inferium_crystal', 'matc:prudentium_crystal', 'matc:tertium_crystal', 'matc:imperium_crystal', 'mysticalagriculture:osmium_essence', 'mysticalagriculture:certus_quartz_essence', 'mysticalagriculture:lead_essence', 'mysticalagriculture:nickel_essence'].concat(multi('mysticalagriculture:supremium_essence', 4)), 100000)

})