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.
Grass Block JE6 BE5.png
This page describes content that may be included in a future update to Java Edition.
These features have appeared in Java Edition development versions, but the full update containing these features has not been released for Java Edition yet.

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]

Upcoming Java Edition
1.1620w17aAdded /attribute.