Minecraft:Commands/attribute: Difference between revisions
From SAS Gaming Wiki
More actions
→Examples: added another example |
Remove broken links to missing pages |
||
| Line 25: | Line 25: | ||
== Arguments == | == Arguments == | ||
{{argument|target|entity}} | {{argument|target|entity}} | ||
: The | : The entity that the [[Minecraft:attribute]] is applied to. Only players, armor stands, and [[Minecraft:mob]]s have attributes. | ||
: {{arg desc|je=entity|type=entities|amount=single}} | : {{arg desc|je=entity|type=entities|amount=single}} | ||
| Line 74: | Line 74: | ||
|{{HistoryLine|java}} | |{{HistoryLine|java}} | ||
|{{HistoryLine||1.16|dev=20w17a|Added {{cmd|attribute|link=none}}.}} | |{{HistoryLine||1.16|dev=20w17a|Added {{cmd|attribute|link=none}}.}} | ||
|{{HistoryLine||1.18.2|dev=1.18.2-pre3|Changed from {{cd|resource_location}} to {{cd|resource}} | |{{HistoryLine||1.18.2|dev=1.18.2-pre3|Changed from {{cd|resource_location}} to {{cd|resource}} 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.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|The <code>uuid</code> and <code>name</code> arguments have been replaced with a singular <code>id</code> argument.|dev=24w21b}} | ||
| Line 84: | Line 84: | ||
{{Navbox commands}} | {{Navbox commands}} | ||
de:Befehl/attribute | |||
es:Comandos/attribute | |||
ja:コマンド/attribute | |||
pt:Comandos/attribute | |||
zh:命令/attribute | |||
Revision as of 15:43, 9 April 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 entity that the Minecraft:attribute is applied to. Only players, 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
de:Befehl/attribute es:Comandos/attribute ja:コマンド/attribute pt:Comandos/attribute zh:命令/attribute