Target Selectors

Target selectors allow you to choose specific entities.

There are 6 selectors:

  • A player name.

  • @s: Self (the player or command block running the command)

  • @a: All players

  • @e: All entities

  • @r: Random player

  • @p: Nearest player

@r and @p can also select multiple players or other entities if using the type or limit/c arguments (explained below).

Selector Arguments

Selectors support various arguments, which allow you to select more specific entities. To add arguments to a selector, put them in [square brackets] like this:

@e[type=mobs_mc:zombie,name=Bob]

You can include spaces if you want (although this many spaces seems a bit excessive):

@e [  type =  mobs_mc:zombie  ,  name = Bob ]

This selector selects all MCLA/VL zombies named Bob.

All arguments must be satisfied for an entity to be selected.

@s and player names do not support arguments.

Excluding with !

Some arguments (such as name and type) allow you to prefix the value with !. This means that it will match anything except the entered value. For example, since @e[type=player] matches all players, @e[type=!player] matches all entities that are not players. Arguments testing for equality cannot be duplicated, while arguments testing for inequality can. In other words, you can have as many type=!<something> as you want but only one type=<something>.

Current argument list

History

Version
Action

v1.0

Added target selectors

v2.0

Added level, lm/l, and gamemode/m selector arguments

Last updated