Minecraft:Commands/attribute: Difference between revisions
From SAS Gaming Wiki
More actions
Fix template calls: add MC/ prefix |
Sync: updated from Minecraft |
||
| Line 1: | Line 1: | ||
{{ | {{exclusive|java}} | ||
{{Infobox command | {{Infobox command | ||
|name=attribute | |name=attribute | ||
| Line 24: | Line 24: | ||
== Arguments == | == Arguments == | ||
{{ | {{argument|target|entity}} | ||
: The entity that the [[Minecraft:attribute]] is applied to. Only | : The [[Minecraft:entity]] that the [[Minecraft:attribute]] is applied to. Only [[Minecraft:player]]s, [[Minecraft:armor stand]]s, and [[Minecraft:mob]]s have attributes. | ||
: {{ | : {{arg desc|je=entity|type=entities|amount=single}} | ||
{{ | {{argument|attribute|resource}} | ||
: Specifies the [[Minecraft:Attribute#Attributes|attribute]]. | : Specifies the [[Minecraft:Attribute#Attributes|attribute]]. | ||
: {{ | : {{arg desc|je=resource|registry=minecraft:attribute}} | ||
{{ | {{argument|scale|double}} | ||
: The number the value is multiplied with before being stored with {{ | : The number the value is multiplied with before being stored with {{cmd|execute}} command. | ||
: {{ | : {{arg desc|je=double}} | ||
{{ | {{argument|id|resource_location}} | ||
: Specifies the id of a [[Minecraft:Attribute#Modifiers|modifier]]. | : Specifies the id of a [[Minecraft:Attribute#Modifiers|modifier]]. | ||
: {{ | : {{arg desc|je=resource_location}} | ||
{{ | {{argument|value|double}} | ||
: Specifies the value to use. | : Specifies the value to use. | ||
: {{ | : {{arg desc|je=double}} | ||
== Result == | == Result == | ||
| Line 55: | Line 55: | ||
== Output == | == Output == | ||
{{ | {{Output table}} | ||
{{ | {{Output table|edition=je|On fail|0|0|0}} | ||
{{Output table|cmd=/... get [<scale>]|On success|1|1|The attribute value (multiplied by {{ | {{Output table|cmd=/... get [<scale>]|On success|1|1|The attribute value (multiplied by {{cd|<scale>}}, then cast to int)}} | ||
{{Output table|cmd=/... base get [<scale>]|On success|1|1|The attribute base value (multiplied by {{ | {{Output table|cmd=/... base get [<scale>]|On success|1|1|The attribute base value (multiplied by {{cd|<scale>}}, then cast to int)}} | ||
{{Output table|cmd=/... modifier value get <id> [<scale>]|On success|1|1|The modifier value (multiplied by {{ | {{Output table|cmd=/... modifier value get <id> [<scale>]|On success|1|1|The modifier value (multiplied by {{cd|<scale>}}, then cast to int)}} | ||
{{ | {{Output table|cmd=/... base set ...<br>/... modifier add ...<br>/... modifier remove ...|On success|1|1|1}} | ||
{{ | {{Output table}} | ||
== Examples == | == Examples == | ||
| Line 72: | Line 72: | ||
== History == | == History == | ||
{{HistoryTable | {{HistoryTable | ||
|{{ | |{{HistoryLine|java}} | ||
|{{HistoryLine||1.16|dev=20w17a|Added {{ | |{{HistoryLine||1.16|dev=20w17a|Added {{cmd|attribute|link=none}}.}} | ||
|{{HistoryLine||1.18.2|dev=1.18.2-pre3|Changed from {{ | |{{HistoryLine||1.18.2|dev=1.18.2-pre3|Changed from {{cd|resource_location}} to {{cd|resource}} [[Minecraft:argument type]] for the attribute argument.}} | ||
|{{ | |{{HistoryLine||1.20.5|dev=24w09a|Modifier operations have been renamed: <code>add</code> → <code>add_value</code>, <code>multiply_base</code> → <code>add_multiplied_base</code>, <code>multiply</code> → <code>add_multiplied_total</code>.}} | ||
|{{ | |{{HistoryLine||1.21|The <code>uuid</code> and <code>name</code> arguments have been replaced with a singular <code>id</code> argument.|dev=24w21b}} | ||
|{{HistoryLine||1.21.4|dev=24w44a|Added {{ | |{{HistoryLine||1.21.4|dev=24w44a|Added {{cmd|attribute <target> <attribute> base reset|link=none}}. | ||
|Suggestions will now be shown for attribute modifier IDs existing on the target.}} | |Suggestions will now be shown for attribute modifier IDs existing on the target.}} | ||
}} | }} | ||
== Navigation == | == Navigation == | ||
{{ | {{Navbox commands}} | ||
de:Befehl/attribute | [[Minecraft:de:Befehl/attribute]] | ||
es:Comandos/attribute | [[Minecraft:es:Comandos/attribute]] | ||
ja:コマンド/attribute | [[Minecraft:fr:Commandes/attribute]] | ||
pt:Comandos/attribute | [[Minecraft:ja:コマンド/attribute]] | ||
zh:命令/attribute | [[Minecraft:pt:Comandos/attribute]] | ||
[[Minecraft:zh:命令/attribute]] | |||
Latest revision as of 11:06, 18 June 2026
Template:Exclusive Template:Infobox command
Used to change or read Minecraft: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> base reset- Resets the base value of the specified attribute to its default value.
attribute <target> <attribute> modifier add <id> <value> (add_value|add_multiplied_base|add_multiplied_total)- Adds an attribute modifier with the specified properties if no modifier with the same ID already existed.
attribute <target> <attribute> modifier remove <id>- Removes the attribute modifier with the specified ID.
attribute <target> <attribute> modifier value get <id> [<scale>]- Returns the value of the modifier with the specified ID.
Arguments
- The Minecraft:entity that the Minecraft:attribute is applied to. Only Minecraft:players, Minecraft:armor stands, and Minecraft:mobs have attributes.
- Template:Arg desc
- Specifies the attribute.
- Template:Arg desc
- The number the value is multiplied with before being stored with Template:Cmd command.
- Template:Arg desc
- Specifies the id of a modifier.
- Template:Arg desc
- Specifies the value to use.
- Template:Arg desc
Result
Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table Template:Result table
Output
Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table Template:Output table
Examples
- To set the minimum armor value of the current entity to 5:
/attribute @s minecraft:armor base set 5- To set the minimum scale value of the current entity to .5:
/attribute @s minecraft:armor base set .5
History
Minecraft:de:Befehl/attribute Minecraft:es:Comandos/attribute Minecraft:fr:Commandes/attribute Minecraft:ja:コマンド/attribute Minecraft:pt:Comandos/attribute Minecraft:zh:命令/attribute