How to add attributes to existing items

How to add attributes to existing items - Free stock photo of antique, art, culture

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!



Best Answer

Here is the updated command syntax for 1.13+:

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




Pictures about "How to add attributes to existing items"

How to add attributes to existing items - Free stock photo of adult, bowl, coffee
How to add attributes to existing items - Free stock photo of antique, beer, brass
How to add attributes to existing items - Assorted-color Bricks



How do you add attributes to an item?

How do you add a new attribute to an existing item type in SAP Hybris Commerce?
  • Go to <HYBRIS_BIN_DIR>/platform using your command prompt, and run the setantenv.bat command (Windows machines), or . ./ ...
  • Run ant extgen command.
  • Type yempty then press Enter.


  • How do you add a new attribute to an existing item type in SAP hybris Commerce?

    Use setattr() to add attributes to a class at runtime
  • class ObjectClass():
  • def __init__(self):
  • self. attribute1 = "attribute1"
  • def newAttr(self, attr):
  • setattr(self, attr, attr)
  • objectClass = ObjectClass()
  • print(objectClass. attribute1)
  • setattr(objectClass, "newAttribute", "new attr")




  • Tip: Add Attributes to Items in Minecraft




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

    Images: ANTONI SHKRABA, ANTONI SHKRABA, Alexander Zvir, Sharon McCutcheon