enter image description here enter image description here

I want to make several items in a /tellraw line, where each item can be on or off, where on items and off items can have different colors and hoverEvents (maybe and clickEvents). If there are too many items, and each possible combination cost a tellraw command, it explodes. Is there a good way to do such thing?

The selector way doesn't match hoverEvent requirement. Issue https://bugs.mojang.com/browse/MC-55493 . Another solution blocked https://bugs.mojang.com/browse/MC-129718

  • If you already know the bug report, why ask for help here? We can't fix the bug (except for modding), only Mojang can. Also, I don't understand this sentence: "If there are too many items, and each possible combination cost a tellraw command, it explodes." Can you explain what you mean with that, please? – Fabian Röling Oct 1 at 18:29
  • @FabianRöling We can't fix the feature, but we may be able to bypass; If there are 16 items, each can be on or off, there are 65536 combinations, which seems too large to handle – l4m2 Oct 1 at 18:42
  • Ah, so you don't want one command for 0000, one for 0001, one for 0010, one for 0011, one for 0100, etc., but instead two for the first digit, two for the second, etc.? – Fabian Röling Oct 1 at 21:06
  • Are texture packs an option? You might be able to abuse translations to generate a (potentially empty) list of entity names, which are translated to only one letter. – Fabian Röling Oct 1 at 21:14
  • Ah, forget it, it's possible without! – Fabian Röling Oct 1 at 21:17
up vote 0 down vote accepted

team prefix&suffix can contain events, so such code makes an armor_stand that "named" aaa and show bbb when hover:

team add test
team modify test prefix {"text":"aaa","hoverEvent":{"action":"show_text","value":"bbb"}}
summon minecraft:armor_stand ~ ~ ~ {CustomName:"\"\""}
team join test @e[type=minecraft:armor_stand]
say @e[type=armor_stand]

I found an easy way around this - sort of.

I don't know your situation very well, so edit it to your liking. This method hasn't really been tested - I've tested half of it but the other half is new.

First, summon four armor stands name A B C and D. Add four more armor stands named "You have reached this objective". Tag one with tag A, one with tag B, one with tag C and the last with tag D (/tag @e[type=armor_stand,limit=1,sort=nearest] add A). Then create two teams, one named red and one named green. Edit the team colors to red and green, respectively. Following me so far?

Next step: run these eight commands in a repeating command block:

/execute as @e[type=armor_stand,name=A,team=red] run team join red @e[tag=A,type=armor_stand] /execute as @e[type=armor_stand,name=A,team=green] run team join green @e[tag=A,type=armor_stand] /execute as @e[type=armor_stand,name=B,team=red] run team join red @e[tag=A,type=armor_stand] /execute as @e[type=armor_stand,name=B,team=green] run team join green @e[tag=A,type=armor_stand] /execute as @e[type=armor_stand,name=C,team=red] run team join red @e[tag=A,type=armor_stand] /execute as @e[type=armor_stand,name=C,team=green] run team join green @e[tag=A,type=armor_stand] /execute as @e[type=armor_stand,name=D,team=red] run team join red @e[tag=A,type=armor_stand] /execute as @e[type=armor_stand,name=D,team=green] run team join green @e[tag=A,type=armor_stand]

Now join armor stands A B C and D to teams.

Now use this command:

/tellraw @a {"text":"","extra":[{"selector":"@e[type=armor_stand,name=A,limit=1]","hoverEvent":{"action":"show_entity","value":"@e[tag=A]"}},{"selector":"@e[type=armor_stand,name=B,limit=1]","hoverEvent":{"action":"show_entity","value":"@e[tag=B]"}},{"selector":"@e[type=armor_stand,name=C,limit=1]","hoverEvent":{"action":"show_entity","value":"@e[tag=C]"}},{"selector":"@e[type=armor_stand,name=D,limit=1]","hoverEvent":{"action":"show_entity","value":"@e[tag=D]"}}]}

If this works, it will show you exactly what is shown in the screenshot. All you have to do for a change is change an objective's (armor stand's) team from red to green, or vice versa, then run the command again. Does this help at all?

  • No. Selector in hoverEvent doesn't work – l4m2 Dec 10 at 22:21
  • Darn. Give me one second. – SpiceWeasel Dec 10 at 22:25
  • Hmmm. Gamepedia doesn't have any solutions. It tells you show_entity exists but doesn't really tell you how to use it. I've tried a few experiments but got nothing. Maybe someone should ask a question about it? Sorry I can't help with that. I don't actually use hoverEvent all that often, so I don't have a clue. – SpiceWeasel Dec 10 at 22:39
  • Update: Apprarently the show_entity value doesn't show the name of the entity, only the information of the entity, so it wouldn't work anyway. However, I see you've accepted the first answer, so do you not need to know anymore? – SpiceWeasel Dec 10 at 23:26
  • It works fine, and usually possible – l4m2 Dec 11 at 4:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.