EntityEvents.spawned("minecraft:vex", event => {
    const { entity, server } = event

    var x = entity.getX()
    var y = entity.getY()
    var z = entity.getZ()
    var age = entity.age

    server.scheduleInTicks(1, () => {
        if (age <= -1) {
            server.runCommandSilent(`summon species:spectre ${x} ${y} ${z} {Age:-24000}`)
        } else {
            server.runCommandSilent(`summon species:spectre ${x} ${y} ${z}`)
        }
    })
    event.cancel()
})