2

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!

2 Answers 2

2

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>}]}}}
5
  • Have you tested this? Because I don't think it'll work.
    – MBraedley
    Mar 5, 2016 at 22:37
  • @MBraedley I have tested this. I can put up a gif, if you want. Mar 5, 2016 at 23:42
  • That was me telling you that your command is wrong. You're missing a pair of braces.
    – MBraedley
    Mar 5, 2016 at 23:48
  • Oh, heh, I copied it over wrong. Whoops. Thanks, @MBraedley. ;P Mar 5, 2016 at 23:49
  • That did it! Thanks. Still getting the hang of this stuff.
    – blahpers
    Mar 6, 2016 at 5:59
2

Here is the updated command syntax for 1.13+:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .