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
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
SyncBot (talk | contribs)
Sync: updated from Minecraft
 
Line 1: Line 1:
{{MC/Exclusive|java}}
{{exclusive|java}}
{{Infobox command
{{Infobox command
|name=attribute
|name=attribute
Line 24: Line 24:


== Arguments ==
== Arguments ==
{{MC/Argument|target|entity}}
{{argument|target|entity}}
: The entity that the [[Minecraft:attribute]] is applied to. Only players, armor stands, and [[Minecraft:mob]]s have attributes.
: The [[Minecraft:entity]] that the [[Minecraft:attribute]] is applied to. Only [[Minecraft:player]]s, [[Minecraft:armor stand]]s, and [[Minecraft:mob]]s have attributes.
: {{MC/Arg desc|je=entity|type=entities|amount=single}}
: {{arg desc|je=entity|type=entities|amount=single}}


{{MC/Argument|attribute|resource}}
{{argument|attribute|resource}}
: Specifies the [[Minecraft:Attribute#Attributes|attribute]].
: Specifies the [[Minecraft:Attribute#Attributes|attribute]].
: {{MC/Arg desc|je=resource|registry=minecraft:attribute}}
: {{arg desc|je=resource|registry=minecraft:attribute}}


{{MC/Argument|scale|double}}
{{argument|scale|double}}
: The number the value is multiplied with before being stored with {{MC/Cmd|execute}} command.
: The number the value is multiplied with before being stored with {{cmd|execute}} command.
: {{MC/Arg desc|je=double}}
: {{arg desc|je=double}}


{{MC/Argument|id|resource_location}}
{{argument|id|resource_location}}
: Specifies the id of a [[Minecraft:Attribute#Modifiers|modifier]].
: Specifies the id of a [[Minecraft:Attribute#Modifiers|modifier]].
: {{MC/Arg desc|je=resource_location}}
: {{arg desc|je=resource_location}}


{{MC/Argument|value|double}}
{{argument|value|double}}
: Specifies the value to use.
: Specifies the value to use.
: {{MC/Arg desc|je=double}}
: {{arg desc|je=double}}


== Result ==
== Result ==
Line 55: Line 55:


== Output ==
== Output ==
{{MC/Output table}}
{{Output table}}
{{MC/Output table|edition=je|On fail|0|0|0}}
{{Output table|edition=je|On fail|0|0|0}}
{{Output table|cmd=/... get [<scale>]|On success|1|1|The attribute value (multiplied by {{MC/Cd|<scale>}}, then cast to int)}}
{{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 {{MC/Cd|<scale>}}, then cast to int)}}
{{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 {{MC/Cd|<scale>}}, then cast to int)}}
{{Output table|cmd=/... modifier value get <id> [<scale>]|On success|1|1|The modifier value (multiplied by {{cd|<scale>}}, then cast to int)}}
{{MC/Output table|cmd=/... base set ...<br>/... modifier add ...<br>/... modifier remove ...|On success|1|1|1}}
{{Output table|cmd=/... base set ...<br>/... modifier add ...<br>/... modifier remove ...|On success|1|1|1}}
{{MC/Output table}}
{{Output table}}


== Examples ==
== Examples ==
Line 72: Line 72:
== History ==
== History ==
{{HistoryTable
{{HistoryTable
|{{MC/HistoryLine|java}}
|{{HistoryLine|java}}
|{{HistoryLine||1.16|dev=20w17a|Added {{MC/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 {{MC/Cd|resource_location}} to {{MC/Cd|resource}} argument type for the attribute argument.}}
|{{HistoryLine||1.18.2|dev=1.18.2-pre3|Changed from {{cd|resource_location}} to {{cd|resource}} [[Minecraft:argument type]] for the attribute argument.}}
|{{MC/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>.}}
|{{MC/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}}
|{{HistoryLine||1.21.4|dev=24w44a|Added {{MC/Cmd|attribute <target> <attribute> base reset|link=none}}.
|{{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 ==
{{MC/Navbox commands}}
{{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

Template:Argument

The Minecraft:entity that the Minecraft:attribute is applied to. Only Minecraft:players, Minecraft: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

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