mojira.dev
MC-93023

@r works only for players if it doesn't have type=

The command
/kill @r
only kills a player (in singleplayer me), it can't target a random entity.
The command
/kill @r[type=ArmorStand]
actually kills a random armor stand. But if I want to kill a random entity in the world (or a random one that fits a certain condition), it isn't possible (except, of course, I summon an armor stand with a name at every entity and execute at a random armor stand and and and...).
I think this is a bug, since with @e it always works.

Linked issues

Comments 11

What exactly are you trying to do, what did you expect to happen and what did actually happen? Why is this a bug?

If you use @e[type=...], it targets all entities of one type.
If you use @e, it targets all entities.
If you use @r[type=...], it targets a random one of a type of entities.
If you use @r, it targets a random player.
What I expected was to target a random entity, I don't see where the limit to players suddenly comes from.

@r came before @e, back when we only had @p and @a. Changing it would break existing builds.

Did it come before or after 1.0?

How about @r[type=!Player]?

1 more comments

Since Mojang broke all relative teleports when target and source are not identical, they apparently don't worry too much about breaking existing command block contraptions. Could this bug report then please be re-opened?
Confirmed for 1.9.4 and 16w21b.

It's still a feature request.

Ok, it's in small suggestions now.

For now if you want to target any random entity regardless of type, use @r[type=!LightningBolt]. "LightningBolt" is not a valid savegame ID, and lightning bolts cannot be targeted anyway.

Great idea, thank you!

FaRo1

(Unassigned)

Unconfirmed

Minecraft 15w47b

Retrieved