Skip to content
WikilyWIKILY
All games23 Wikis · pick your game
Commands and cheatsAll commands

Switch game

23 Wikis · pick your game
/attribute

Command

/attribute

Reads or changes an attribute of a living entity, such as its maximum health, movement speed, or size.

Syntax

/attribute <target> <attribute> base get [<scale>]
/attribute <target> <attribute> base reset
/attribute <target> <attribute> base set <value>
/attribute <target> <attribute> get [<scale>]
/attribute <target> <attribute> modifier add <id> <value> (add_multiplied_base|add_multiplied_total|add_value)
/attribute <target> <attribute> modifier remove <id>
/attribute <target> <attribute> modifier value get <id> [<scale>]

Arguments

ArgumentKind of valueWhat to type
<target>Target selectorThe entity to read or change. Must be exactly one entity. One entity only.
<attribute>Game idThe attribute id, for example minecraft:max_health, minecraft:movement_speed, minecraft:attack_damage, or minecraft:scale. The id of an attribute.
<scale>Decimal numberA number the value is multiplied by before it is returned as the number /execute store saves. Defaults to 1.
<value>Decimal numberFor base set, the new base value. For modifier add, the amount the modifier applies.
<id>IdThe namespaced id of the modifier, for example example:boost. You choose it when adding a modifier and use it again to read or remove it.

Details

Permission level2: operators, worlds with cheats on, command blocks and functions
Works inSingleplayer with cheats enabled and multiplayer servers. Needs permission level 2 (gamemasters): server operators, players with cheats, command blocks, and functions can all run it.
ResultGet commands report the value and return it multiplied by the scale, with the decimals cut off. Commands that set, reset, add, or remove report what changed and return 1.
getShows the final value of the attribute, with all modifiers applied.
base getShows the base value of the attribute, before any modifiers.
base setSets the base value of the attribute to the given number.
base resetPuts the base value back to the default for that kind of entity and reports the default.
modifier addAdds a permanent modifier with the given id, value, and operation. Fails if the attribute already has a modifier with that id.
modifier removeRemoves the modifier with the given id. Fails if the attribute has no such modifier.
modifier value getShows the value of one modifier. Fails if the attribute has no modifier with that id.
Operationsadd_value adds the value to the base. add_multiplied_base adds the base (after all add_value modifiers) multiplied by the value. add_multiplied_total multiplies the running total by 1 plus the value. They are applied in that order.
Target must be aliveThe target must be a single living entity such as a player or a mob. Other entities fail with "is not a valid entity for this command", and an entity that does not have the chosen attribute fails with "has no attribute".
ScaleThe scale defaults to 1. Use a larger scale to keep decimals in the number /execute store saves, for example 100 turns 0.1 into 10.

Examples

/attribute @s minecraft:max_health get

Shows your maximum health.

/attribute @s minecraft:max_health base set 40

Sets your base maximum health to 40, which is 20 hearts.

/attribute @s minecraft:scale base set 2

Makes you twice as large.

/attribute @s minecraft:movement_speed modifier add example:sprint_boost 0.5 add_multiplied_base

Adds a modifier that makes you move 50 percent faster.

/attribute @s minecraft:movement_speed modifier remove example:sprint_boost

Removes that speed modifier again.

/attribute @s minecraft:scale base reset

Returns you to your normal size.

Join the creator communityThe people who build the Minecraft Java Edition wiki are on our Discord. Ask questions or suggest pages.Join Discord (opens Discord in a new tab)