Share

Share

Attribute

From Minecraft Wiki
Jump to: navigation, search

Attributes are a system of buffs/debuffs which are properties on mobs and players. Attributes also have modifiers which adjust the strength of their effect.

Applying attributes[edit | edit source]

When applied to an item, a modifier will adjust 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 following command will give the closest player a diamond sword which does 20 (Heart.svg × 10) extra damage. If you change the operation from 0 to 1 it will MULTIPLY the attack damage instead.

/give @p diamond_sword 1 0 {AttributeModifiers:[{AttributeName:"generic.attackDamage",Name:"generic.attackDamage",Amount:20,Operation:0,UUIDLeast:894654,UUIDMost:2872}]}

The following command will summon a zombie that will follow players when they are 100 blocks or less from it instead of the usual 16.

/summon Zombie ~ ~ ~ {Attributes:[{Name:"generic.followRange",Base:100.0}]}

In snapshot 15w35b you can now specify what slot has certain attributes.

/give @p diamond_axe 1 0 {AttributeModifiers:[{Slot:"mainhand",AttributeName:"generic.attackDamage",Name:"generic.attackDamage",Amount:20,Operation:0,UUIDLeast:1,UUIDMost:1}]}

The slot can be mainhand, offhand, head, torso, legs or feet (may be more).

Attributes[edit | edit source]

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.7x10308.

Attributes available on all living entities[edit | edit source]

These Attributes are found on all mobs, including players.

Attribute Name Description Default Base Minimum Maximum
generic.maxHealth The maximum health of this mob (in half-hearts); determines the highest health they may be healed to. 20.0 0.0 1.7x10308
generic.followRange The range in blocks within which a mob with this attribute will target players or other mobs to track. Exiting this range will cause 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.knockbackResistance The chance to resist knockback from attacks, explosions, and projectiles. 1.0 is 100% chance for resistance. 0.0 0.0 1.0
generic.movementSpeed Speed of movement in some unknown metric. The mob's maximum speed in blocks/second is a bit over 43 times this value, but can be affected by various conditions. 0.7* 0.0 1.7x10308
generic.attackDamage Damage dealt by attacks, in half-hearts. 2.0 0.0 1.7x10308
generic.armor (1.9[upcoming]) Armor defense points. 0.0 0.0 30.0

Attributes for players[edit | edit source]

These attributes are only used by players.

Attribute Name Description Default Base Minimum Maximum
generic.attackSpeed (1.9[upcoming]) Determines speed at which attack strength recharges. Value is the number of full-strength attacks per second. 4.0 0.0 1024.0

Attributes for horses[edit | edit source]

These Attributes are only used by Horses.

Attribute Name Description Default Base Minimum Maximum
horse.jumpStrength Horse jump strength in some unknown metric. 0.7* 0.0 2

Attributes for zombies[edit | edit source]

These Attributes are only used by zombies.

Attribute Name Description Default Base Minimum Maximum
zombie.spawnReinforcements Chance that a zombie will spawn another zombie when attacked. 0.0 0.0 1.0

Properties of unknown attributes[edit | edit source]

When the game finds an attribute with an unrecognized name, it applies these properties to it. (WARNING! The line of code that does this causes minecraft to crash)

Attribute Name Description Default Base Minimum Maximum
Any non-Vanilla Attribute name Unknown. 0.0 0 1.7x10308

Modifiers[edit | edit source]

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 (Universally Unique IDentifier).

Operations[edit | edit source]

A modifier's operation dictates how it modifies an attribute's base value. Three operations exist, "+- amount", "+- amount % (additive)", and "+- amount % (multiplicative)".[3] For convenience, these will be referred to as Operations 0, 1, and 2, as they are in the code and NBT format.

The mathematical behavior is as follows: Operation 0: Increment X by Amount, Operation 1: Increment Y by X * Amount, Operation 2: Y = Y * (1 + Amount) (equivalent to Increment Y by Y * Amount). The game first sets X = Base, then executes all Operation 0 modifiers, then sets Y = X, then executes all Operation 1 modifiers, and finally executes all Operation 2 modifiers.

Vanilla modifiers[edit | edit source]

As stated before, a modifier's name can be anything, and this will not affect its behavior. The following are only known modifier names and values used in vanilla minecraft (do not add modifiers to this table if you find them in custom maps, as map makers may create their own custom modifiers). 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.followRange (Operation 1; all mobs), Knockback Resistance (Operation 0; Villagers and Zombies only)
Tool modifier Value varies based on tool. generic.attackDamage (Operation 0; all tools; UUID CB3F55D3-645C-4F38-A497-9C13A33DB5CF)
Weapon modifier Value varies based on weapon. generic.attackDamage (Operation 0; all tools; UUID CB3F55D3-645C-4F38-A497-9C13A33DB5CF (same UUID as Tool modifier))
Sprinting speed boost Fixed value of 0.3* used by all mobs (including players) when sprinting. generic.movementSpeed (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.movementSpeed (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.movementSpeed (Operation 0; Endermen - UUID 020E0DFB-87AE-4653-9556-831010E291A0, Zombie Pigmen - UUID 49455A49-7EC5-45BA-B886-3B90B23A1718)
Baby speed boost Fixed value of 0.5; exists only for baby Zombies and baby Zombie Villagers. generic.movementSpeed (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.movementSpeed (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.followRange (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.maxHealth, random number between 1.0 and 4.0. zombie.spawnReinforcements (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.spawnReinforcements (Operation 0; Zombies)
Zombie reinforcement callee charge Fixed value of -0.05* created for each zombie spawned as a reinforcement. zombie.spawnReinforcements (Operation 0; Zombies)
potion.moveSpeed or potion.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.movementSpeed (Operation 2; All living entities; UUID 91AEAA56-376B-4498-935B-2F7F68070635)
potion.moveSlowdown or potion.moveSlowdown # (where # is the potion's amplifier) Fixed value of -0.15* when under the Slowness effect, multiplied by the effect's level. generic.movementSpeed (Operation 2; All living entities; UUID 7107DE5E-7CE8-4030-940E-514C1F160890)
potion.damageBoost or potion.damageBoost # (where # is the potion's amplifier) Fixed value of 1.3 when under the Strength effect, multiplied by the effect's level. generic.attackDamage (Operation 2; All living entities; UUID 648D7064-6A60-4F59-8ABE-C2C23A6DD7A9)
potion.weakness or potion.weakness # (where # is the potion's amplifier) Fixed value of -0.5 when under the Weakness effect, multiplied by the effect's level. generic.attackDamage (Operation 0; All living entities; UUID 22653B89-116E-49DC-9B6B-9971489B5BE5)
potion.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.maxHealth (Operation 0; All living entities; UUID 5D6F0BA2-1186-46AC-B896-C61C5CEE99CC)
Unknown synced attribute modifier Unknown; created when client reads attribute data sent by server. varies

History[edit | edit source]

Official release
1.6.1 13w16a Added attributes.
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.
Upcoming
1.9 15w34b Added attack speed attribute.
15w36d Added armor attribute.

References[edit | edit source]