The /give and /replaceitem commands are fine if I want to create a new item with a custom attribute, but is there a command to add an attribute to an existing item?

The closest I've gotten to this is adding attributes to an entity representing a dropped item, but the attributes do not carry over to the item once picked up:

/entitydata @e[type=Item,r=1] {AttributeModifiers:[{...}]}

Thanks in advance!


Yup! What you're doing works just fine, with some minor tweaks.

To apply the attribute modifier to the item, you need to do this instead:

/entitydata @e[type=Item,r=1] {Item:{tag:{AttributeModifiers:[{<attribute stuffs>}]}}}
  • Have you tested this? Because I don't think it'll work. – MBraedley Mar 5 '16 at 22:37
  • @MBraedley I have tested this. I can put up a gif, if you want. – Addison Crump Mar 5 '16 at 23:42
  • That was me telling you that your command is wrong. You're missing a pair of braces. – MBraedley Mar 5 '16 at 23:48
  • Oh, heh, I copied it over wrong. Whoops. Thanks, @MBraedley. ;P – Addison Crump Mar 5 '16 at 23:49
  • That did it! Thanks. Still getting the hang of this stuff. – blahpers Mar 6 '16 at 5:59

Here is the updated command syntax for 1.13+:

/data merge entity @e[type=item,distance=..5,limit=1] {Item:{tag:{AttributeModifiers:[{<attribute stuff>}]}}}

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.