-
Notifications
You must be signed in to change notification settings - Fork 0
Attribute Modifiers
Attribute modifiers are things you can apply to items to modify a players' attributes (like attack damage, for example). If you're not familiar with how these work, there are some niches to understand to make sure you're getting the most out of them.
This wiki page should cover everything you need to know, but if you want some more in-depth information on attribute modifiers, the Minecraft Wiki's page on attributes is really useful.
Anyway, let's start with what they look like.
You might be used to seeing attribute modifiers like this, in NBT format:
{AttributeName:"generic.attack_damage", Name:"generic.attack_damage", Amount:20.0, Operation:0, Slot:"mainhand", UUID:[I; -192596, -61963, -161679, -10288428]}
In Minecraft, this kind of compound is how you would apply a modifier to an item via the /give command.
This might seem like a lot, but it's really quite simple. In the above example, we see an attribute modifier which is modifying the attack damage attribute of a player by an amount of 20, with an operation of 0, when they're holding the item in their main hand. Now, you probably won't ever have to worry about reading one of these, but in case you do, SkCheez displays them in a slightly nicer, more readable, way.
Anyway, if you're a bit confused, don't worry! This next section, about what each of the components do and how they can interact with each other, will hopefully clear things up a bit.
There are six components that make up a modifier, and you really only need to worry about five of them.
This is, arguably, the most important part of the modifier - it's the attribute that the modifier modifies. This can, to my knowledge anyway, be any of the vanilla attribute types. Here's a list of all the attribute types that you can use:
armor, armor toughness, attack damage, attack knockback, attack speed, flying speed, follow range, knockback resistance, luck, max absorption, max health, movement speed, spawn reinforcements
# fancy new types that are coming in 1.20.5
scale, step height, jump strength, block interaction range, entity interaction range, block break speed, gravity, safe fall distance, fall damage multiplier
It's important to note that not all of these attribute types can be applied to players. As an example, the spawn reinforcements attribute applies exclusively to zombies (and zombie variants). Additionally, all of the attributes have a minimum and maximum value, and a base value. For a more detailed guide on all the attributes and what they do, head on over to the Minecraft Wiki's attribute page!
The amount is also very important. As you can probably guess, it helps define the amount that the modifier will modify the attribute by. Make sure you understand how the operation component works as well, because the amount and operation work together to dictate how the attribute is modified.
The name of the modifier is, objectively, the least important part. It makes literally no difference what this is set to, other than for descriptive purposes.