ServerEvents.recipes(event => {
  event.recipes.summoningrituals
    .altar('armageddon_mod:voiderite')
    .id('kubejs:summoning/vaedric')

    .input('4x minecraft:ender_pearl')
    .input('4x minecraft:end_stone')
    .input('armageddon_mod:elvenite_ingot')

    .recipeTime(100)
})

SummoningRituals.complete(event => {
  const id = String(event.recipe.getId())

  if (id !== 'kubejs:summoning/vaedric') return

  let cmd = 'summon armageddon_mod:vaedricthe_fallen_wanderer ~ ~ ~'

  if (event.pos) {
    cmd = `summon armageddon_mod:vaedricthe_fallen_wanderer ${event.pos.x} ${event.pos.y + 1} ${event.pos.z}`
  } else if (event.block) {
    cmd = `summon armageddon_mod:vaedricthe_fallen_wanderer ${event.block.x} ${event.block.y + 1} ${event.block.z}`
  }

  event.server.runCommandSilent(cmd)
})
