Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Commands/attribute: Difference between revisions

From SAS Gaming Wiki
Examples: added another example
 
SyncBot (talk | contribs)
Remove broken links to missing pages
Line 25: Line 25:
== Arguments ==
== Arguments ==
{{argument|target|entity}}
{{argument|target|entity}}
: The [[Minecraft:entity]] that the [[Minecraft:attribute]] is applied to. Only [[Minecraft:player]]s, [[Minecraft:armor stand]]s, and [[Minecraft:mob]]s have attributes.
: 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}} [[Minecraft:argument type]] for the attribute argument.}}
|{{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> &rarr; <code>add_value</code>, <code>multiply_base</code> &rarr; <code>add_multiplied_base</code>, <code>multiply</code> &rarr; <code>add_multiplied_total</code>.}}
|{{HistoryLine||1.20.5|dev=24w09a|Modifier operations have been renamed: <code>add</code> &rarr; <code>add_value</code>, <code>multiply_base</code> &rarr; <code>add_multiplied_base</code>, <code>multiply</code> &rarr; <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}}


[[Minecraft:de:Befehl/attribute]]
de:Befehl/attribute
[[Minecraft:es:Comandos/attribute]]
es:Comandos/attribute
[[Minecraft:ja:コマンド/attribute]]
ja:コマンド/attribute
[[Minecraft:pt:Comandos/attribute]]
pt:Comandos/attribute
[[Minecraft:zh:命令/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

Template:Argument

The entity that the Minecraft:attribute is applied to. Only players, armor stands, and Minecraft:mobs have attributes.
Template:Arg desc

Template:Argument

Specifies the attribute.
Template:Arg desc

Template:Argument

The number the value is multiplied with before being stored with Template:Cmd command.
Template:Arg desc

Template:Argument

Specifies the id of a modifier.
Template:Arg desc

Template:Argument

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

Template:HistoryTable

Navigation

Template:Navbox commands

de:Befehl/attribute es:Comandos/attribute ja:コマンド/attribute pt:Comandos/attribute zh:命令/attribute