Minecraft Wiki
Advertisement
Information icon.svg
This feature is exclusive to Java Edition. 

Used to change or read attributes.

Syntax[]

attribute <target> <attribute> get [<scale>]
Returns the total value of the specified attribute.
attribute <target> <attribute> base get [<scale>]
Returns the base value of the specified attribute.
attribute <target> <attribute> base set <value>
Overwrites the base value of the specified attribute with the given value.
attribute <target> <attribute> modifier add <uuid> <name> <value> (add|multiply|multiply_base)
Adds an attribute modifier with the specified properties if no modifier with the same UUID already existed.
attribute <target> <attribute> modifier remove <uuid>
Removes the attribute modifier with the specified UUID.
attribute <target> <attribute> modifier value get <uuid> [<scale>]
Returns the value of the modifier with the specified UUID.

Arguments[]

<target>: entity

The entity that the attribute is applied to. Only players, armor stands, and mobs have attributes.
Must be a player name, a target selector or a UUID. And the target selector must be of single type.

<attribute>: resource

Specifies the attribute.
Must be a resource location.

<scale>: double

The number the value is multiplied with before being stored with /execute command.
Must be a Double-precision floating-point format number.

<uuid>: uuid

Specifies the uuid of a modifier.
Must be a UUID in the hyphenated hexadecimal format. Allowed characters include:
  • -
  • A-F
  • a-f
  • 0-9

<name>: string

Specifies the name of a modifier.
Must be a string. And it must be a quotable phrase, which is either a single word (allowed characters: -, +, ., _, A-Z, a-z, and 0-9) or a double-quoted string.

<value>: double

Specifies the value to use.
Must be a Double-precision floating-point format number.

Result[]

CommandTriggerJava Edition
anythe arguments are not specified correctly Unparseable
<targets> fails to resolve to a player, an armor stand, or a mob Failed
the attribute doesn't exist (for example,a player entity has no minecraft:horse.jump_strength)
... modifier add ...a modifier with the specified uuid is already present
... modifier remove ...
modifier value get ...
the modifier with the specified uuid doesn't exist
anyOn successChanges or returns the attribute value.

Output[]

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
anyJava EditionOn fail000
... get [<scale>]On success11The attribute value (multiplied by <scale>, then cast to int)
... base get [<scale>]On success11The attribute base value (multiplied by <scale>, then cast to int)
... modifier value get <uuid> [<scale>]On success11The modifier value (multiplied by <scale>, then cast to int)
... base set ...
... modifier add ...
... modifier remove ...
On success111

Examples[]

  • To set the minimum armor value of yourself to 5:
    /attribute @s minecraft:generic.armor base set 5

History[]

Java Edition
1.1620w17aAdded /attribute.
1.18.21.18.2-pre3Changed from resource_location to resource argument type for the attribute argument.
Advertisement