If you have looked at the tooltips on tools in the latest snapshot, you've seen something interesting: attribute modifiers. I did a bit of poking around on the Minecraft Wiki and in the NBT data and it turns out items and armor can have custom attribute modifiers. Follow this structure to add them to an item using an editor such as NBTExplorer or NBTEdit.
The NBT structure on an item is:
tag (compound)
AttributeModifiers (list)
(unnamed compound -- a single attribute)
AttributeName (string) the attribute to apply the modifier to
Name (string) the name of the modifier
Amount (double) the amount to increment by
Operation (int) this can be 0, 1, or 2 0 adds the amount to the base 1 multiples the base by the amount 2 not sure what this does still the wiki doesn't make much sense
UUIDMost a random number that you didn't already use
Can you add examples? I don't understand the difference between Name and attribute name.
Name is just how you want to name the modifier. This can be whatever you want unless already used on the item (That isn't very clever to do anyway).
AttributeName is the name of the attribute it needs to change. This means it needs to be specifically the name of an attribute.
Operations:
0: adds or subtracts a value from the base value (metric varies) (ie: your base attack is 2, operation 0 w/ a value of 3 is your base of 2 plus the value of 3, giving you an attack of 5, a 2.5x increase)
1: follows operation 0 modifiers, and adds the product of itself and the value, to itself (ie: your new operation 0 value is 5, operation 1 w/ a value of 0.5, is your new base of 5 plus itself times 0.5, or 5+5*0.5, so 7.5, a 50% increase from your 0 operation, or a 375% increase from your base strength
2: follows operation 1 modifiers, and multiplies the resulting value by your value-plus-one (ie: your new operation 1 value is 7.5, operation 2 w/ a value of 0.5 is your new base of 7.5 times your value of 0.5 plus one, or 7.5*(0.5+1), so 11.25, which I would imagine rounds down to a final base strength of 11
Of course, when dealing with a single item, you will never have more than one operation
I assume these are the rules regarding an instance in which a player is under the effects of some combination of armor or held items, which have overlapping properties, and have different operations
For example, if you were creating a custom map, you could, depending on the situation, either create a full set of diamond armor, all of which with operation 0 max health attributes, so that you gain a bit of health for each one. Or, if they were all hard to get, you could use 1/2 operations, which would give you escalating health, the more pieces you had, or even some combination of the two.
This is what I have made of the explanation in the wiki, at least.
If only there were a simpler way... oh well. All I need is to remember the correct attribute terms and I'm okay! It just takes too long for doing it on-the-go with friends. Just ask JBarker13 and StarFall_24. They kept getting frustrated.
(T_T) / (^-^)
-HOW DARE YOU JUDGE?!- (T^T)
[Because I have to, broski. Because I have to.] (=-=)
Max Health (obvious what it does, can also be negative however the health wont go below 0, 0 health equals 1 health (a half hearth) as it doesnt kill you but any damage you recive will 1hKo you)
Mob Follow Range (doesnt seem to work on players. I guessed it lowers/increases your visiblity but that seems to be wrong.)
Knockback Ressistance (changes how much you get knocked back, +100% causes that you get no knockback at all, -100% causes you to fly double as far.)
Speed (changes your speed. DUH!)
Attack damage (changes the base attack of a item, can also apply to fists if the player is wearing armor whit say +2 attack damage, now the fist do 2 damage more, and a normal diamond sword does 9 damage - 2 more than normally)
Horse Jump Strenght (i havent tested jet but i guess it wont work on players, hence the name.)
Zombie Reinforcements (seems to do nothing for me, i need to test this further)
Mob Follow Range increases the amount of blocks a mob will follow another mob/the player. Horse Jump Strength, as you said, only works on horses. Zombie Reinforcements is the chance a zombie wearing the armour will spawn more zombies to help when hit. All have infinite maximum amounts except for Mob Follow Range (2048 blocks), Knockback Resistance (1.0), Horse Jump Strength (2), and Zombie Reinforcements (1.0). The things you must type for the desired traits are: generic.maxHealth, generic.knockbackResistance, generic.followRange, generic.movementSpeed, generic.attackDamage, horse.jumpStrength, or zombie.spawnReinforcements. For each new attribute modifier, you must make a new TagCompound under the AttributeModifiers List along with the necessary info (Operation (Int), UUIDLeast (Long), UUIDMost (Long), Amount (Double), Name (String), and AttributeName (String)) Hope this helps everyone!
(^-^)
The NBT structure on an item is:
tag (compound)
Latest map created: Mizzle III| Swapping Chunks | Replica
EDIT: I tested it, and you can't see the hearts, but you do have extra health.
They've kind of handled that with horses already.
Name is just how you want to name the modifier. This can be whatever you want unless already used on the item (That isn't very clever to do anyway).
AttributeName is the name of the attribute it needs to change. This means it needs to be specifically the name of an attribute.
0: adds or subtracts a value from the base value (metric varies) (ie: your base attack is 2, operation 0 w/ a value of 3 is your base of 2 plus the value of 3, giving you an attack of 5, a 2.5x increase)
1: follows operation 0 modifiers, and adds the product of itself and the value, to itself (ie: your new operation 0 value is 5, operation 1 w/ a value of 0.5, is your new base of 5 plus itself times 0.5, or 5+5*0.5, so 7.5, a 50% increase from your 0 operation, or a 375% increase from your base strength
2: follows operation 1 modifiers, and multiplies the resulting value by your value-plus-one (ie: your new operation 1 value is 7.5, operation 2 w/ a value of 0.5 is your new base of 7.5 times your value of 0.5 plus one, or 7.5*(0.5+1), so 11.25, which I would imagine rounds down to a final base strength of 11
Of course, when dealing with a single item, you will never have more than one operation
I assume these are the rules regarding an instance in which a player is under the effects of some combination of armor or held items, which have overlapping properties, and have different operations
For example, if you were creating a custom map, you could, depending on the situation, either create a full set of diamond armor, all of which with operation 0 max health attributes, so that you gain a bit of health for each one. Or, if they were all hard to get, you could use 1/2 operations, which would give you escalating health, the more pieces you had, or even some combination of the two.
This is what I have made of the explanation in the wiki, at least.
(T_T) / (^-^)
-HOW DARE YOU JUDGE?!- (T^T)
[Because I have to, broski. Because I have to.] (=-=)
(^-^)