Commands/tag

From Minecraft Wiki
Jump to: navigation, search

Controls scoreboard tags on individual entities. In Java Edition, the number of tags owned by an entity cannot exceed 1024.

Java Edition note: this is distinct from entity type tags, which are applied to entity types and cannot be changed by commands.

Syntax[edit]

  • Java Edition
tag <targets> add <name>
Adds a tag to the targets.
tag <targets> list
Lists all tags on the targets.
tag <targets> remove <name>
Removes a tag from the targets.
  • Bedrock Edition
tag <entity: targets> add <name: string>
Adds a tag to the targets.
tag <entity: targets> remove <name: string>
Removes a tag from the targets.
tag <entity: targets> list
Lists all tags on the targets.

Arguments[edit]

JE<targets>: entity
BE: entity: target: WildcardCommandSelector<Actor>

In Java Edition, must be a player name, a target selector or a UUID
In Bedrock Edition, must be either a target selector, a player name, or * for all score holders.
Specifies the command's target.

JE<name>: string
BE: name: string

Must be a string. In Java Edition, it must be in a single word (no spaces). In Bedrock Edition, it must be a single word (no spaces) or a quoted string.
Specifies the name of the tag to be added into or removed from the targets.
In Java Edition, valid characters are uppercase and lowercase letters, numbers, hyphen, underscore, plus sign and period. In Bedrock Edition, it can include any characters.

Result[edit]

CommandTriggerJava EditionBedrock Edition
anythe arguments are not specified correctly Unparseable Failed
if <targets> or player: target fails to resolve to one or more entities (named players must be online) Failed
/tag ... add ...if no entity does not yet have the specified tag
if every specified entity already has 1024 tags Successful
/tag ... remove ...if no entity's tag is removed Failed
/tag ... list ...if no entity has any tag Successful
anyOn successAdds, lists, or removes the tag(s).

Output[edit]

CommandEditionSituationSuccess Count/execute store succeess .../execute store result ...
anyJava EditionOn fail000
/tag ... add ...On success11the number of entities who get a new tag
/tag ... remove ...On success11the number of entities whose tags are remove
/tag ... listOn success11the number of all tags the specified entities have
anyBedrock EditionOn fail0N/AN/A
On success1N/AN/A

History[edit]

Java Edition
1.1317w45aAdded /tag.
Bedrock Edition
1.9beta 1.9.0.2Added /tag.

See also[edit]