TransWikia.com

Copy and change item names in chest

Arqade Asked by deathismyfriend on February 9, 2021

I am trying to Copy a chests contents over and then change the display names of all the items in the chest.

I can easily do the first part by /clone.

I have been trying to do this part with the /blockdata command like this.

/blockdata -505 69 471 {Items:{display:{Name:"Altered_Item"}}}

I also tried some other variants. The method above removes all the items in the chest though.
Is there a way without knowing the item ids to change just the display name of every item in the chest ?

2 Answers

Does this need to happen particularly quickly? Because if not, you could summon tnt or a fireball to destroy the cloned chest so it drops its items, use /entitydata to change their display names, then teleport them to a hopper above another chest. This is a comparatively slow workaround and leaves you with an extra chest (the cloned one that was destroyed will drop as an item), but you can't edit an item's data without completely overwriting it unless it's in entity form. Hope this helps!

Answered by TenNineAce on February 9, 2021

1.14+

Evolution of commands has made this possible using the /data modify command.

/data modify block Cx Cy Cz Items[].display.Name set value '{"text":"The Item"}'

This command will set all item's name to The Item.

But, if you only want to target an item in a specific slot, use this command:

/data modify block Cx Cy Cz Items[{Slot:1b}].display.Name set value '{"text":"The Item"}'

Replace the number in Slot:1b with the desired slot.

Answered by ExpertCoder14 on February 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP