Attribute

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
When applied to an item, a modifier will adjust the corresponding attribute if the item is held or worn. 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 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
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
These Attributes are found on all mobs, including players.

Attributes for players
These attributes are only used by players.

Attributes for horses
These Attributes are only used by Horses.

Attributes for zombies
These Attributes are only used by zombies.

Properties of unknown attributes
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)

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

Operations
A modifier's operation dictates how it modifies an attribute's base value. Three operations exist, "+- amount", "+- amount % (additive)", and "+- amount % (multiplicative)". 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
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!