Stacking attribute modifiers

Stacking attribute modifiers - Developmental Toys on White Surface

I'm making a Diablo-like loot system in my map, and it would be neat to have some sort of random modifiers on weapons, like:

Sharp knife: +10 (+2) Dmg

Dull knife +10 (-2) Dmg

Obviously, I don't care about the way it's going to look, I simply need it to work on items in chests/on mobs. So can I have 2 attribute modifiers to modify the same value?

So far I have this command:

/give @p minecraft:wooden_sword 1 0 {AttributeModifiers:[{AttributeName:"generic.attackDamage",Name:"generic.attackDamage",Amount:3,Operation:0,UUIDLeast:3,UUIDMost:3,Slot:"offhand"}]}

Now I want it to give more/less damage to player. And the item will probably be in the chest, or in mob's inventory.






Pictures about "Stacking attribute modifiers"

Stacking attribute modifiers - Colleagues doing a Huddle
Stacking attribute modifiers - Minimalistic workplace with laptop and empty frame with office attributes during coffee break
Stacking attribute modifiers - A Boy Stacking Peeled Potatoes





[3.16] The Ultimate Attribute stacking build




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Polina Tankilevitch, Edmond Dantès, Tatiana Syrikova, Artem Podrez