I recently realized that NBT tags like CustomName and Lore only supports "text" as its base. If you do "selector", it'll use the target selector (e.g. @p[tag=bananas]) as the text itself. If you use something like "score", it gives nothing.
It might cause lag if the components update every tick, but take a look at signs. It supports all chat components mentioned above. Even if the sign only updates its dynamic values on creation or when /data modify runs that specific line again, it's sufficient for items and entities as well. Of course, it shouldn't be able to run events like "clickEvent".
Here's an example:
/summon zombie ~ ~ ~ {CustomName:'[{"score":{"objective":"health","name":"@s"}}," / ",{"nbt":"Attributes.[{Name:"generic.maxHealth"}]","entity":"@s"}]'} In recent system, it will summon a zombie with no name. My described behavior is to let the zombie have the name "20 / 20" shown (in this command, it will only be " / 20" (P.S. It's just an example, as a command block expe*cough*, I can fix that. But I have to show variations) ).
Then, to update the name, we can do, /execute as @e[type=zombie] run data modify entity @s CustomName set value '[{"score":{"objective":"health","name":"@s"}}," / ",{"nbt":"Attributes.[{Name:"generic.maxHealth"}]","entity":"@s"}]'. This can allow the zombie's name change every time /data modify is called.
This is a suggestion, and I'd / we'd like to see it implemented.
Please sign in to leave a comment.
4 Comments