EntityEvents.spawned(event => {
  const entity = event.entity
  if (!entity || !entity.type) return

  if (entity.type.toString() === 'progressivebosses:wither') {
    const pos = entity.blockPosition()
    entity.server.scheduleInTicks(1, () => {
      entity.kill()
      entity.server.runCommandSilent(`summon minecraft:wither ${pos.x} ${pos.y} ${pos.z}`)
    })
  }
})