Hi, this is a complicated issue but I want to store an entity's UUID in an item's tags.I've tried something that looks a little like this (I don't have Minecraft open right now, so forgive any inaccuracies in the syntax, this is purely for illustrative exampling):
/give @s book{UUID:[I;0,0,0,0]}
/data modify entity @s SelectedItem.tags.UUID set from entity <wanted entity> UUID
However, this and several other variants always return an error, either stating that it was "expecting an object but got <value> instead" or "unable to modify player's data".
Even when doing a similar thing but to a dropped item, it said that the data was successfully modified, but when I checked it, there was no change.
How can I do this? Is it even possible?
#Storing an entity's UUID in an item?
1 messages · Page 1 of 1 (latest)
You can't modify player data
the command syntax look correct, but you should probably put the uuid in a storage rather than an item's nbt
I don’t know what your usecase is so I don’t know if it’s better to store the UUID in storage, but if you want to modify the player’s item there is a way. You can first copy the UUID to a temporary place in storage, and then use an Item Modifier to copy it to the player’s held item
do you want to immediately give the player an item with a UUID, or do you want to change the UUID in the player's hand?
It’d be best if I were to get the item with the UUUD, but I imagine that copying it from the target entity would be easier.