Attributes are a system of buffs/debuffs that are properties on mobs and players. Attributes also have modifiers that adjust the strength of their effect.
Applying attributes[]
When applied to an item, a modifier adjusts the corresponding attribute if the item is held or worn.[1][2] Attributes/modifiers can be added to items or mobs without the use of third-party NBT editing software by adding data tags to the give and summon commands. The UUIDs for these modifiers should be randomly chosen, to prevent accidentally using the same UUID as another modifier.
The following command gives the player a netherite sword that deals 20 × 10 extra damage. If the player changes the operation from 0 to 1 it multiplies the attack damage instead:
/give @s netherite_sword{AttributeModifiers:[{AttributeName:"generic.attack_damage", Name:"generic.attack_damage", Amount:20.0, Operation:0, UUID:[I; 42853, 1689024593, -201178, -1559272105]}]} 1
The following command summons a zombie that follows players when they are 100 blocks or less from it instead of the usual 40:
/summon zombie ~ ~ ~ {Attributes:[{Name:"generic.follow_range", Base:100.0}]}
The player can also specify what slot has certain attributes:
/give @p diamond_axe{AttributeModifiers:[{Slot:"mainhand", AttributeName:"generic.attack_damage", Name:"generic.attack_damage", Amount:20.0, Operation:0, UUID:[I; -192596, -61963, -161679, -10288428]}]} 1
The slot can be mainhand, offhand, head, chest, legs or feet.
Also, in case the player wants the attack speed of 1.8 with the style of 1.9, try this:
/give @s shield{Unbreakable:1,AttributeModifiers:[{Slot:"offhand", AttributeName:"generic.attack_speed", Name:"generic.attack_speed", Amount:1000.0, Operation:0, UUID:[I; -110663, 103297, -1423577, 206238]}]} 1
As of 1.16, the player can also use the /attribute command to apply attributes. This command example makes the Luck attribute high enough to fish treasures nearly every time:
/attribute @p minecraft:generic.luck base set 1024
Attributes[]
An individual attribute controls some property, described by its name. An attribute always has a base value, and may have any number of modifiers. Attributes also have a default value (used when spawning a mob with an undefined attribute base), and hard-coded minimum and maximum values. Modifiers act on an attribute's base, but the calculated value is always capped by the minimum and maximum.
Minimum and maximum are inclusive unless specified otherwise or they are equal to 1.7×10308.
Note that attribute modifiers that have the same UUID and affect the same attribute do not stack; only the one that most recently affected a player or mob has an effect, overriding the previously affecting modifier(s).
Attributes available on all living entities[]
These attributes are found on all living entities, including players.
Attribute Name | Description | Default Base | Minimum | Maximum | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
generic.max_health | The maximum health of this mob (in half-hearts); determines the highest health they may be healed to. If the player is using this to summon a mob with high health, use this and the Health tag {Health:200.0f} for example. (Disabled in 1.17)
|
20.0 | 0.0 | 1024.0 | ||||||||||||||||||||||||||||||||||
generic.max_absorption | The maximum absorption of this mob (in half-hearts); determines the highest health they may gain by the Absorption effect. | - | - | - | ||||||||||||||||||||||||||||||||||
generic.follow_range | The range in blocks within which a mob with this attribute targets players or other mobs to track. Exiting this range causes the mob to cease following the player/mob. Actual value used by most mobs is 16; for zombies it is 40. | 32.0 | 0.0 | 2048.0 | ||||||||||||||||||||||||||||||||||
generic.knockback_resistance | The scale of horizontal knockback resisted from attacks and projectiles. Vertical knockback is not affected. Does not affect explosions.[3] 1.0 is 100% knockback resistance. 0.4 means 60% of knockback is applied. | 0.0 | 0.0 | 1.0 | ||||||||||||||||||||||||||||||||||
generic.movement_speed | Speed of movement in some unknown metric. The mob's actual speed in blocks/second is a bit over 20 times this value, but is affected by various conditions, such as the behavior it's following (e.g. idling, attacking or fleeing), being ridden (if a horse), sprinting, being led by a leash, and being under the effect of a Speed or Slowness potion. Baby mobs also have an additional speed multiplier on top of the base value.
|
0.7 | 0.0 | 1024.0 | ||||||||||||||||||||||||||||||||||
generic.attack_damage | Damage dealt by attacks, in half-hearts. This attribute is not found on passive mobs and golems. | 2.0 | 0.0 | 2048.0 | ||||||||||||||||||||||||||||||||||
generic.armor | Armor defense points. | 0.0 | 0.0 | 30.0 | ||||||||||||||||||||||||||||||||||
generic.armor_toughness | Armor toughness. | 0.0 | 0.0 | 20.0 | ||||||||||||||||||||||||||||||||||
generic.attack_knockback | Knockback applied to attacks. Applies only to mobs with physical attacks.[4] Ravager and Warden: 1.5 Hoglin and Zoglin: 1.0 |
0.0 | 0.0 | 5.0 |
Attributes for players[]
These attributes apply to players.
Attribute Name | Description | Default Base | Minimum | Maximum |
---|---|---|---|---|
generic.attack_speed | Determines recharging rate of attack strength. Value is the number of full-strength attacks per second. | 4.0 | 0.0 | 1024.0 |
generic.luck | Affects the results of loot tables using the quality or bonus_rolls tag (e.g. when opening chests or chest minecarts, fishing, and killing mobs).
|
0.0 | -1024.0 | 1024.0 |
Attributes for horses[]
These attributes apply to horses.
Attribute Name | Description | Default Base | Minimum | Maximum |
---|---|---|---|---|
horse.jump_strength | Horse jump strength in some unknown metric. | 0.7 | 0.0 | 2.0 |
Attributes for bees and parrots[]
These attributes apply to bees and parrots.
Attribute Name | Description | Default Base | Minimum | Maximum |
---|---|---|---|---|
generic.flying_speed | Flight speed modifier in some unknown metric. Set to 0.6 for bees and 0.4 for parrots. | 0.4 | 0.0 | 1024.0 |
Attributes for zombies[]
These attributes apply to zombies.
Attribute Name | Description | Default Base | Minimum | Maximum |
---|---|---|---|---|
zombie.spawn_reinforcements | Chance for a zombie to spawn another zombie when attacked. | 0.0 | 0.0 | 1.0 |
Properties of unknown attributes[]
When the game finds an attribute with an unrecognized name, it applies these properties to it.
Attribute Name | Description | Default Base | Minimum | Maximum |
---|---|---|---|---|
Any non-Vanilla Attribute name | Unknown | 0.0 | -1.8×10308 (Negative Double.MAX_VALUE )
|
1.8×10308 (Double.MAX_VALUE )
|
Modifiers[]
Modifiers act upon the base value of an attribute, increasing or decreasing it. Note that the resulting value after modification is capped by the attribute's minimum and maximum. Like attributes, modifiers have a name, however, this name does not define the modifier's behavior. Instead, a modifier's behavior is determined by its operation. Modifiers also carry an amount to their modification, and a UUID to uniquely identify the modifier.
Operations[]
A modifier's operation dictates how it modifies an attribute's base value. Three operations exist:
add (amount +/-): Saved as operation 0. Adds all of the modifiers' amounts to the current value of the attribute. For example, modifying an attribute with {Amount:2,Operation:0} and {Amount:4,Operation:0} with a Base of 3 results in 9 (3 + 2 + 4 = 9).
multiply_base (amount % +/-, additive): Saved as operation 1. Multiplies the current value of the attribute by (1 + x), where x is the sum of the modifiers' amounts. For example, modifying an attribute with {Amount:2,Operation:1} and {Amount:4,Operation:1} with a Base of 3 results in 21 (3 * (1 + 2 + 4) = 21).
multiply (amount % +/-, multiplicative): Saved as operation 2. For every modifier, multiplies the current value of the attribute by (1 + x), where x is the amount of the particular modifier. Functions the same as Operation 1 if there is only a single modifier with operation 1 or 2. However, for multiple modifiers it multiplies the modifiers rather than adding them. For example, modifying an attribute with {Amount:2,Operation:2} and {Amount:4,Operation:2} with a Base of 3 results in 45 (3 * (1 + 2) * (1 + 4) = 45).[5]
The mathematical behavior is as follows:
- add: Increment X by Amount
- multiply_base: Increment Y by X * Amount
- multiply: Y = Y * (1 + Amount) (equivalent to Increment Y by Y * Amount).
The game first sets X = Base, then executes all Operation add, then sets Y = X, then executes all multiply_base modifiers, and finally executes all multiply modifiers.
Vanilla modifiers[]
As stated before, a modifier's name can be anything, and this does not affect its behavior. The following are known modifier names and values used in vanilla Minecraft. Note that some UUIDs are generated on-the-fly, while others are represented as fixed strings in the code - these have been listed as well. Do not add UUIDs to this table for modifiers where they are not listed - if a UUID is not listed, this means that it is different every time the modifier is created.
Modifier Name | Description and Known Values | Known Attributes Modified |
---|---|---|
Random spawn bonus | Generated upon spawning; a random number from a Gaussian distribution ranging from 0.0 to 0.05. For Zombie Knockback Resistance, another value between 0.0 and 0.05 is also generated. | generic.follow_range (Operation 1; all mobs), Knockback Resistance (Operation 0; Villagers and Zombies only) |
Tool modifier | Value varies based on tool and tier. | generic.attack_damage (Operation 0; tridents, shovels, pickaxes, axes, hoes; UUID CB3F55D3-645C-4F38-A497-9C13A33DB5CF), generic.attack_speed (Operation 0; tridents, shovels, pickaxes, axes, hoes; UUID FA233E1C-4180-4865-B01B-BCCE9785ACA3) |
Weapon modifier | Value varies based on weapon tier. | generic.attack_damage (Operation 0; swords; UUID CB3F55D3-645C-4F38-A497-9C13A33DB5CF), generic.attack_speed (Operation 0; swords; UUID FA233E1C-4180-4865-B01B-BCCE9785ACA3) (same UUIDs as Tool modifier) |
Armor modifier | Value varies based on slot and tier. | generic.armor (Operation 0; boots - UUID 845DB27C-C624-495F-8C9F-6020A9A58B6B, leggings - UUID D8499B04-0E66-4726-AB29-64469D734E0D, chestplate - UUID 9F3D476D-C118-4544-8365-64846904B48E, helmet - UUID 2AD3F246-FEE1-4E67-B886-69FD380BB150) |
Armor toughness | Value varies based on tier. | generic.armor_toughness (Operation 0; boots - UUID 845DB27C-C624-495F-8C9F-6020A9A58B6B, leggings - UUID D8499B04-0E66-4726-AB29-64469D734E0D, chestplate - UUID 9F3D476D-C118-4544-8365-64846904B48E, helmet - UUID 2AD3F246-FEE1-4E67-B886-69FD380BB150) |
Knockback resistance | Applies knockback resistance similarily to netherite armor. A piece of netherite armor is equivalent to operation 0 with amount 0.1. | generic.knockback_resistance (UUID 0-1-438d-0-28d34) |
Sprinting speed boost | Fixed value of 0.3 used by all mobs (including players) when sprinting. | generic.movement_speed (Operation 2; all living entities; UUID 662A6B8D-DA3E-4C1C-8813-96EA6097278D) |
Fleeing speed boost | Fixed value of 2 used by all passive mobs when fleeing. | generic.movement_speed (Operation 2; all passive mobs; UUID E199AD21-BA8A-4C53-8D13-6182D5C69D3A) |
Attacking speed boost | Fixed value of 6.2 for Endermen and 0.45 for Zombie Pigmen; exists only when attacking. | generic.movement_speed (Operation 0; Endermen - UUID 020E0DFB-87AE-4653-9556-831010E291A0, Zombified Piglins - UUID 49455A49-7EC5-45BA-B886-3B90B23A1718) |
Covered armor bonus | Fixed value of 20.0 for Shulker exists only when fully closed. | generic.armor (Operation 0; Shulker; UUID 7E0292F2-9434-48D5-A29F-9583AF7DF27F) |
Horse armor bonus | Value varies based on the armor of the horse (None = 0; Iron = 5; Gold = 7;Diamond = 11) | generic.armor (Operation 0; EntityHorse; 556E1665-8B10-40C8-8F9D-CF9B1667F295) |
Baby speed boost | Fixed value of 0.5; exists only for baby Zombies and baby Zombie Villagers. | generic.movement_speed (Operation 1; Baby Zombies; UUID B9766B59-9566-4402-BC1F-2EE2A276D836) |
Drinking speed penalty | Fixed value of -0.25 for Witches when drinking a potion. | generic.movement_speed (Operation 0; Witches; UUID 5CD17E52-A79A-43D3-A529-90FDE04B181E) |
Random zombie-spawn bonus | Generated upon spawning; a random number between 0.0 and 1.5. | generic.follow_range (Operation 2; Zombies) |
Leader zombie bonus | Has a (small) random chance of being generated on a zombie when spawned. For Spawn Reinforcements Chance, random number between 0.5 and 0.75. For generic.max_health, random number between 1.0 and 4.0. | zombie.spawn_reinforcements (Operation 0; Zombies), generic.maxHealth (Operation 2; Zombies) |
Zombie reinforcement caller charge | Fixed value of -0.05 created each time a zombie spawns another zombie as reinforcement. | zombie.spawn_reinforcements (Operation 0; Zombies) |
Zombie reinforcement callee charge | Fixed value of -0.05 created for each zombie spawned as a reinforcement. | zombie.spawn_reinforcements (Operation 0; Zombies) |
effect.moveSpeed or effect.moveSpeed # (where # is the potion's amplifier) | Fixed value of 0.2 when under the Speed effect, multiplied by the effect's level (amplifier + 1). | generic.movement_speed (Operation 2; All living entities; UUID 91AEAA56-376B-4498-935B-2F7F68070635) |
effect.moveSlowdown or effect.moveSlowdown # (where # is the potion's amplifier) | Fixed value of -0.15 when under the Slowness effect, multiplied by the effect's level. | generic.movement_speed (Operation 2; All living entities; UUID 7107DE5E-7CE8-4030-940E-514C1F160890) |
effect.digSpeed or effect.digSpeed# (where # is the potion's amplifier) | Fixed value of 0.1 when under the Haste effect, multiplied by the effect's level. | generic.attack_speed (Operation 2; All living entities; UUID AF8B6E3F-3328-4C0A-AA36-5BA2BB9DBEF3) |
effect.digSlowDown or effect.digSlowDown# (where # is the potion's amplifier) | Fixed value of -0.1 when under the Mining fatigue effect, multiplied by the effect's level. | generic.attack_speed (Operation 2; All living entities; UUID 55FCED67-E92A-486E-9800-B47F202C4386) |
effect.damageBoost or effect.damageBoost # (where # is the potion's amplifier) | Fixed value of 3 when under the Strength effect, multiplied by the effect's level. | generic.attack_damage (Operation 0; All living entities; UUID 648D7064-6A60-4F59-8ABE-C2C23A6DD7A9) |
effect.weakness or effect.weakness # (where # is the potion's amplifier) | Fixed value of -4 when under the Weakness effect, multiplied by the effect's level. | generic.attack_damage (Operation 0; All living entities; UUID 22653B89-116E-49DC-9B6B-9971489B5BE5) |
effect.healthBoost # (where # is the potion's amplifier. May be 0.) | Fixed value of 4 when under the Health Boost effect, multiplied by the effect's level. | generic.max_health (Operation 0; All living entities; UUID 5D6F0BA2-1186-46AC-B896-C61C5CEE99CC) |
effect.luck or effect.luck# (where # is the potion's amplifier) | Fixed value of 1 when under the Luck effect, multiplied by the effect's level. | generic.luck(Operation 0; All living entities; UUID 03C3C89D-7037-4B42-869F-B146BCB64D2E) |
effect.unluck or effect.unluck # (where # is the potion's amplifier) | Fixed value of -1 when under the Unluck effect, multiplied by the effect's level. | generic.luck(Operation 0; All living entities; UUID CC5AF142-2BD2-4215-B636-2605AED11727) |
Unknown synced attribute modifier | Unknown; created when client reads attribute data sent by server. | varies |
History[]
Java Edition | |||||
---|---|---|---|---|---|
1.6.1 | 13w16a | Added attributes and modifiers. | |||
The following attributes existed: "Max Health", "Follow Range", "Knockback Resistance"; furthermore, "Jump Strength" and "Speed" existed as horse-specific attributes. | |||||
The only modifiers were both "Random spawn bonus", one used on Zombies to knockback resistance with operation 0, and the other on all mobs to follow range with operation 1. | |||||
13w17a | Added "Spawn Reinforcements Chance" attribute for Zombies. | ||||
Added "Zombie reinforcement charge" (to spawn reinforcements charge), "Random zombie-spawn bonus" (to follow range), and "Leader zombie bonus" (to both reinforcements charge and max health). | |||||
13w18a | Replaced "Zombie reinforcement charge" with "Zombie reinforcement caller charge" | ||||
13w21a | Attributes now can be specified in NBT. | ||||
Attributes now have IDs and corresponding translation keys. | |||||
Modifiers now display on items. | |||||
Added "Attack Damage" and made "Speed" generic. | |||||
Added "potion.moveSpeed", "potion.moveSlowdown", "potion.damageBoost", and "potion.weakness" modifiers. | |||||
Added "Sprinting speed boost", "Fleeing speed bonus", "Attacking speed boost" (for both pigmen and endermen), "Drinking speed penalty", and "Baby speed boost". | |||||
Added "Tool modifier" and "Weapon modifier". | |||||
13w23b | Added "potion.healthBoost" modifier. | ||||
1.7.2 | 13w36a | Attributes/modifiers can be added to items or mobs without the use of third-party NBT editing software by adding data tags to the /give and /summon commands. | |||
1.9 | 15w34b | Added attack speed attribute. | |||
15w36d | Added armor attribute. | ||||
15w44b | Added luck attribute. | ||||
1.9.1 | pre1 | Added armorToughness attribute. | |||
1.14 | 18w43a | Added attackKnockback attribute. | |||
1.16 | 20w06a | Knockback resistance is now a scale rather than probability. | |||
20w14a | Items and entities no longer keep unknown attributes. | ||||
Names of some attributes have been renamed to meet resource location requirements (i.e., lowercase separated by underscores instead of camel case). | |||||
Renamed generic.maxHealth to generic.max_health . | |||||
Renamed zombie.spawnReinforcements to zombie.spawn_reinforcements . | |||||
Renamed horse.jumpStrength to horse.jump_strength . | |||||
Renamed generic.followRange to generic.follow_range . | |||||
Renamed generic.knockbackResistance to generic.knockback_resistance . | |||||
Renamed generic.movementSpeed to generic.movement_speed . | |||||
Renamed generic.flyingSpeed to generic.flying_speed . | |||||
Renamed generic.attackDamage to generic.attack_damage | |||||
Renamed generic.attackKnockback to generic.attack_knockback | |||||
Renamed generic.attackSpeed to generic.attack_speed | |||||
Renamed generic.armorToughness to generic.armor_toughness . | |||||
20w17a | Added the /attribute command, which can query and change attributes. | ||||
1.18.2 | 22w03a | Knockback resistance no longer gives a 50% chance to ignore all knockback. | |||
1.20.2 | 23w31a | Added the generic.max_absorption attribute. | |||
Upcoming Java Edition | |||||
Combat Tests | 1.14.3 - Combat Test | Added attackReach attribute. | |||
Pocket Edition Alpha | |||||
v0.12.1 | build 1 | Added attributes. |
References[]
- ↑ "Good news for mapmakers: Items can have attribute modifiers. It's possible to make a bow that slows the holder, helm that buffs health, etc" – @Dinnerbone (Nathan Adams) on X, May 23, 2013
- ↑ "Equipped as armour or held in hand." – @Dinnerbone (Nathan Adams) on X, May 23, 2013
- ↑ MC-32578
- ↑ MC-138868
- ↑ "Attribute modifiers can be: +- amount, +- amount % (additive), +- amount % (multiplicative)." – @Dinnerbone (Nathan Adams) on X, May 23, 2013