I'm using Minecraft 1.21.1 and trying to summon a villager with custom name from NBT storage (I'm trying to use it as constant registry and reuse the custom name later in other places)
Here's the commands I've tried to use:
[35mdata [34mmodify storage [33mexample:storage [0mCustomName [34mset value [33m{[32m"text"[34m:[32m"Villager"[34m,[32m"color"[34m:[32m"gold"[33m}
[35msummon [33mminecraft:villager [32m~ ~ ~ [33m{[37mCustomName[34m:[32m'{"storage":"example:storage","nbt":"CustomName","interpret":true}'[34m,[37mNoAI[34m:[32mtrue[34m,[37mPersistenceRequired[34m:[32mtrue[33m}
It summons a villager but the name is empty. Am I missing something?
It works fine with the tellraw command:
[35mdata [34mmodify storage [33mexample:storage [0mCustomName [34mset value [33m{[32m"text"[34m:[32m"Villager"[34m,[32m"color"[34m:[32m"gold"[33m}
[35mtellraw [36m@s [33m[[32m"§7["[34m,[35m{[32m"storage"[34m:[32m"example:storage"[34m,[32m"nbt"[34m:[32m"CustomName"[34m,[32m"interpret"[34m:[32mtrue[35m}[34m,[32m"§7]: "[34m,[32m"Hello"[33m]
Also, is it a good idea to use the storage for reusing this kind of data or there are better ways?