EntityEvents.spawned(event => {
    const entity = event.entity
    const level = entity.level

    if (entity.type !== 'minecraft:enderman') return
    if (level.dimension !== 'minecraft:the_end') return

    if (Math.random() < 0.5) {
        const x = entity.x
        const y = entity.y
        const z = entity.z
    
        level.runCommandSilent(`summon enlightened_end:ringling ${x} ${y} ${z}`)

        event.cancel()
    }
})