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)
Remove broken links to missing pages
SyncBot (talk | contribs)
Fix template calls: add MC/ prefix
 
Line 1: Line 1:
{{exclusive|java}}
{{MC/Exclusive|java}}
{{Infobox command
{{Infobox command
|name=attribute
|name=attribute
Line 24: Line 24:


== Arguments ==
== Arguments ==
{{argument|target|entity}}
{{MC/Argument|target|entity}}
: The entity that the [[Minecraft:attribute]] is applied to. Only players, armor stands, 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}}
: {{MC/Arg desc|je=entity|type=entities|amount=single}}


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


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


{{argument|id|resource_location}}
{{MC/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}}
: {{MC/Arg desc|je=resource_location}}


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


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


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


== Examples ==
== Examples ==
Line 72: Line 72:
== History ==
== History ==
{{HistoryTable
{{HistoryTable
|{{HistoryLine|java}}
|{{MC/HistoryLine|java}}
|{{HistoryLine||1.16|dev=20w17a|Added {{cmd|attribute|link=none}}.}}
|{{HistoryLine||1.16|dev=20w17a|Added {{MC/Cmd|attribute|link=none}}.}}
|{{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.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.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.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}}
|{{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.4|dev=24w44a|Added {{cmd|attribute <target> <attribute> base reset|link=none}}.
|{{HistoryLine||1.21.4|dev=24w44a|Added {{MC/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}}
{{MC/Navbox commands}}


de:Befehl/attribute
de:Befehl/attribute

Latest revision as of 20:08, 9 April 2026

Script error: No such module "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

<target>: entity

The entity that the Minecraft:attribute is applied to. Only players, armor stands, and Minecraft:mobs have attributes.
{{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|entity}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

<attribute>: resource

Specifies the attribute.
{{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|resource}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

<scale>: double

The number the value is multiplied with before being stored with
  1. REDIRECT Template:Command

Template:Redr command.

{{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|double}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

<id>: resource_location

Specifies the id of a modifier.
{{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|resource_location}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

<value>: double

Specifies the value to use.
{{#vardefine:onlyje|}}{{#vardefine:onlybe| Template:IN,}}{{#vardefine:je-arg|double}}{{#vardefine:be-arg|}}Template:Error{{#vardefine:onlyje|}}{{#vardefine:onlybe|}}{{#vardefine:je-arg|}}{{#vardefine:be-arg|}}

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

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On fail}}{{#vardefine:output1-{{#var:output-table-lines}}|0}}{{#vardefine:output2-{{#var:output-table-lines}}|0}}{{#vardefine:output3-{{#var:output-table-lines}}|0}}{{#vardefine:command-row-{{#var:commands-num}}|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-editions-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-edition-{{#var:output-editions-num}}|je}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|1}} Template:Output table Template:Output table Template:Output table {{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:situation-{{#var:output-table-lines}}|On success}}{{#vardefine:output1-{{#var:output-table-lines}}|1}}{{#vardefine:output2-{{#var:output-table-lines}}|1}}{{#vardefine:output3-{{#var:output-table-lines}}|1}}{{#vardefine:commands-num|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:command-{{#var:commands-num}}|/... base set ...
/... modifier add ...
/... modifier remove ...
}}{{#vardefine:command-row-{{#var:commands-num}}|1}}{{#vardefine:output-edition-row-{{#var:output-editions-num}}|Expression error: Unrecognized punctuation character "{".}}

{{#vardefine:output-table-lines|Expression error: Unrecognized punctuation character "{".}}{{#vardefine:output-table-lines|-2}}{{#vardefine:output-table-lines-now|}}{{#vardefine:command-num-now|}}{{#vardefine:command-line-now|}}{{#vardefine:commands-num|}}{{#vardefine:output-edition-num-now|}}{{#vardefine:output-edition-line-now|}}{{#vardefine:output-editions-num|}}{{#vardefine:je-outputs-dis|}}

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

All editions
Removed
Template:El only
Debug
Removed
Template:Els only
Template:El only
Removed
Template:El only
Removed
Template:Els only
Removed
Joke
Related

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