The Gamepedia and Fandom account systems have now been merged. If your username is incorrect, you have accounts on both platforms that weren't merged, or you have trouble signing in, please submit a support ticket.

Commands/attribute

From Minecraft Wiki
Jump to: navigation, search
attribute
Restrictions

Operator

First introduced

Java Edition 1.16 (20w17a)

Information icon.svg
This feature is exclusive to Java Edition.

Used to change or read attributes.

Syntax[edit]

attribute <target> <attribute> [base] get [<scale>]
attribute <target> <attribute> base set <value>
attribute <target> <attribute> modifier add <uuid> <name> <value> (add|multiply|multiply_base)
attribute <target> <attribute> modifier remove <uuid>
attribute <target> <attribute> modifier value get <uuid> [<scale>]

Details[edit]

attribute <target> <attribute> ...
... get [<scale>]
Returns the total value of the specified attribute.
... base get [<scale>]
Returns the base value of the specified attribute.
... base set <value>
Overwrites the base value of the specified attribute with the given value.
... modifier (add|remove|value get)
... 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.
... remove <uuid>
Removes the attribute modifier with the specified UUID.
... value get <uuid> [<scale>]
Returns the value of the modifier with the specified UUID.

Arguments[edit]

<target>
The entity that the attribute is applied to. Only accepts a single target. Only players, armor stands, and mobs have attributes.
<attribute>
The namespaced ID of the specified attribute.
<scale>
The number the value is multiplied with before being returned.
<uuid>
Specifies the UUID of the modifier in the hyphenated hexadecimal format. Modifiers with the same UUID do not stack.

Result[edit]

When using set, fails if the modifier is already present.

When using get, fails if the value an invalid double (64-bit integer) value.

On success, changes or returns the attribute value.

Examples[edit]

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

History[edit]

Java Edition
1.1620w17aAdded /attribute.