1

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.

  • Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins! – Frank Jun 2 '16 at 22:40
  • I've tried to do it myself, don't worry. I'll try to make my question better next time, thanks. – Vovalium Jun 2 '16 at 22:44
  • If you show us what you've tried, you'll benefit yourself greatly. – Frank Jun 2 '16 at 22:45
  • Guess that should do it. In any case, I don't have time to make it better right now. Thanks for your advice, Frank. – Vovalium Jun 2 '16 at 22:51
  • That shows what you have. That doesn't show what you've tried. That's what's important. – Frank Jun 2 '16 at 22:52
2

Yes, you separate modifiers with a comma:

AttributeModifiers:[{<modifier 1>},{<modifier 2>},{<modifier 3>}]

However, you must ensure that the UUID pairs are unique across the items. For example, if the item(s) have the following UUIDs on the modifiers:

{UUIDLeast:1,UUIDMost:1}
{UUIDLeast:1,UUIDMost:1}

Then only one of the modifiers will be applied to the player. The fix is to use unique values. For example, all of the following will be applied as the pairs are unique:

{UUIDLeast:1,UUIDMost:1}
{UUIDLeast:1,UUIDMost:2}
{UUIDLeast:2,UUIDMost:1}
{UUIDLeast:2,UUIDMost:2}

Example item to provide (the first modifier has a UUID pair of 3,3 while the second modifier has a pair of 4,4):

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.