ServerEvents.recipes(event => {
  event.recipes.summoningrituals
    .altar('minecraft:gold_ingot')
    .id('kubejs:summoning/goblin')

    .input('4x minecraft:stick')
    .input('16x minecraft:cobblestone')
    .input('armageddon_mod:colossal_iron_ingot')

    .recipeTime(100)
    .dayTime('day')
})

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

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

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

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

  event.server.runCommandSilent(cmd)
})
