Attribute

For the command, see Commands/attribute.

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

### Attributes for players

These attributes apply to players.

 generic.luck

### Attributes for bees and parrots

These attributes apply to bees and parrots.

### Properties of unknown attributes

When the game finds an attribute with an unrecognized name, it applies these properties to it.

## 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).

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.

## References

1. ↑ "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
2. ↑ "Equipped as armour or held in hand." – @Dinnerbone (Nathan Adams) on X, May 23, 2013
3. ↑ MC-32578
4. ↑ MC-138868
5. ↑ "Attribute modifiers can be: +- amount, +- amount % (additive), +- amount % (multiplicative)." – @Dinnerbone (Nathan Adams) on X, May 23, 2013