[MC-56373] Selector and score text components don't work on hoverEvents Created: 05/Jun/14  Updated: 09/Jan/19

Status: Reopened
Project: Minecraft: Java Edition
Component/s: None
Affects Version/s: Minecraft 14w21b, Minecraft 14w26b, Minecraft 14w29b, Minecraft 14w30a, Minecraft 1.8, Minecraft 1.8.1, Minecraft 1.8.8, Minecraft 15w44b, Minecraft 16w06a, Minecraft 1.9 Pre-Release 3, Minecraft 1.9, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 16w43a, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12.2, Minecraft 18w16a, Minecraft 1.13-pre3, Minecraft 1.13-pre4, Minecraft 1.13-pre5, Minecraft 1.13-pre6, Minecraft 1.13-pre7, Minecraft 1.13-pre8, Minecraft 1.13-pre9, Minecraft 1.13, Minecraft 18w30a, Minecraft 18w30b, Minecraft 18w31a, Minecraft 18w32a, Minecraft 18w33a, Minecraft 1.13.1-pre1, Minecraft 1.13.1-pre2, Minecraft 1.13.1, Minecraft 1.13.2-pre1, Minecraft 1.13.2-pre2, Minecraft 1.13.2, Minecraft 18w43a, Minecraft 18w43b, Minecraft 18w43c, Minecraft 18w44a, Minecraft 18w45a, Minecraft 18w46a, Minecraft 18w47a, Minecraft 18w47b, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w49a, Minecraft 18w50a, Minecraft 19w02a
Fix Version/s: None

Type: Bug
Reporter: Alex³ Assignee: Unassigned
Resolution: Unresolved Votes: 34
Labels: None

Attachments: PNG File 2014-06-05_13.58.33.png     PNG File 2014-06-05_13.59.34.png     PNG File 2014-06-05_14.00.35.png     PNG File 2018-06-30_11.04.34.png     PNG File 2018-06-30_11.04.41.png    
Issue Links:
is duplicated by MC-62448 Tellraw Hover event settings while us... Resolved
is duplicated by MC-73995 Bug with /tellraw hoverEvent command Resolved
is duplicated by MC-76246 Show Entity Hover Event Not Functioning Resolved
Confirmation Status: Confirmed


The bug

Some tellraw features (like player score and selectors) don't work on hover events.

How to reproduce

  1. Initialize score and scoreboard:
    /scoreboard objectives add MC-56373 dummy
    /scoreboard players set @s MC-56373 56373
  2. Run this command:
    /tellraw @s [{"text":"Selector Hover","hoverEvent":{"action":"show_text","value":{"selector":"@s"}}},"\n",{"text":"Score Hover","hoverEvent":{"action":"show_text","value":{"score":{"objective":"MC-56373","name":"@s"}}}}]

    → The first hover event won't show the selector
    → The second hover event won't show the score

Code analysis

Code analysis by [Mod] Marcono1234 can be found in this comment.

Comment by [Mod] Marcono1234 [ 10/Jun/14 ]

Partswise confirmed for 14w21b:

  • 1. Command isn't working
  • 2. Command isn't working with "test" (my name isn't test), BUT also not working with SELECTORS where else this is working:
    /tellraw @a {score:{name:@p,objective:vars}}
  • 3.Command isn't working like you said, but maybe intended
Comment by Maxwell Souza Carvalho [ 10/Jun/14 ]

the 2 command, if you instead use a selector, use a name, like Marcono1234 will work

Comment by [Mod] Skylinerw [ 25/Jun/14 ]

Confirmed for 14w26b. As a shorter example:

/tellraw @a {text:"Hover",hoverEvent:{action:show_text,value:{selector:@p}}}

The above should show my name upon hovering over "Hover", but instead shows "@p". And just an example showing "selector" at work, which simply displays my name in chat:

/tellraw @a {selector:@p}
Comment by [Mod] Skylinerw [ 23/Jul/14 ]

Confirmed for 14w30a.

Comment by [Mod] Odysseius [ 20/Dec/14 ]

Is this still a concern in the current Minecraft version? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases. If this has been done, we can reopen the issue.

Keep in mind that the "Resolved"-Status on this ticket just means "Answered", and that we are waiting for further information on whether this issue still exists or not. We will reopen it as soon as the requested information has been delivered.

Comment by Kavukamari [ 08/Jan/15 ]

Confirmed for 1.8.2-pre1

Comment by Tan Chin Cheern [ 08/Jan/15 ]

Did you try 'minecraftjson.com' as a tellraw generator by Ezekielelin?

Comment by Maxwell Souza Carvalho [ 09/Jan/15 ]

i use a lot the Ezekielelin generator, but it don't use all the features of tellraw yet, like scoreboards and selectors on hover event.
json is very complex and have a lot of features, Ezekielelin don't use all of them

Comment by [Mod] Skylinerw [ 13/Feb/15 ]

Confirmed up to 1.8.2 pre-6.

Comment by [Mod] Marcono1234 [ 28/Jul/15 ]

Confirmed for

  • 1.8.8 The behaviour is pretty interesting, it is the same like for resolved books with a selector tag in the pages tag.
selector: Not working
/tellraw @p {"text":"Hover","hoverEvent":{"action":"show_text","value":{"selector":"@p"}}}
translate: Working
/tellraw @p {"text":"Hover","hoverEvent":{"action":"show_text","value":{"translate":"Number: %s","with":[1]}}}
score: Working for explicit player names
/tellraw @p {"text":"Hover","hoverEvent":{"action":"show_text","value":{"score":{"name":"Notch","objective":"test"}}}}
Comment by [Mod] Skylinerw [ 14/Feb/16 ]

Confirmed for 16w06a, though it seems that explicit player names for scores do not work anymore.

Comment by [Mod] Marcono1234 [ 15/Feb/16 ]

Please link to this comment in the description

The following is based on decompiled version of Minecraft 1.8 using MCP. All method and class names are the names used in the decompiled version.
The method probably have changed as the experienced behaviour changed as well.

The reason for this is that the public static IChatComponent func_179985_a(ICommandSender p_179985_0_, IChatComponent p_179985_1_, Entity p_179985_2_) throws CommandException method of the net.minecraft.util.ChatComponentProcessor class which transforms chat components, for example {"selector":"@p"} becomes {"text":"Notch"}, does not transform the chat components of hoverEvents. This is why once the hoverEvent is displayed it shows for example "@p". The reason why scores no longer work as well, might be because they changed the String getUnformattedTextForChat() for multiple chat components as they returned the evaluated value as well (this method and the other methods getting the text value probably only make sense for the net.minecraft.util.ChatComponentText class).

public static IChatComponent func_179985_a(ICommandSender p_179985_0_, IChatComponent p_179985_1_, Entity p_179985_2_) throws CommandException
    Object var3 = null;
    ChatStyle var9 = p_179985_1_.getChatStyle();

    if (var9 != null)
        // Changed this
        // Imported net.minecraft.event.HoverEvent
        ChatStyle chatStyleCopy = var9.createShallowCopy();
        HoverEvent hoverEvent = var9.getChatHoverEvent();
        if (hoverEvent != null && hoverEvent.getAction() == HoverEvent.Action.SHOW_TEXT) {
            chatStyleCopy.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, func_179985_a(p_179985_0_, hoverEvent.getValue(), p_179985_2_)));
        ((IChatComponent) var3).setChatStyle(chatStyleCopy);

    Iterator var11 = p_179985_1_.getSiblings().iterator();

    while (var11.hasNext())
        IChatComponent var13 = (IChatComponent)var11.next();
        ((IChatComponent)var3).appendSibling(func_179985_a(p_179985_0_, var13, p_179985_2_));

    return (IChatComponent)var3;
Comment by [Mod] Skylinerw [ 26/Feb/16 ]

Confirmed for 1.9 pre-3.

Comment by M [ 26/Feb/17 ]

Present in 1.11.2 and snapshot 17w06a
Still affects cases 1 and 3 mentioned in Marcono1234's comment from 28/Jul/15 . Translate feature works correctly, while displaying scores does not.

Comment by Alex³ [ 27/Apr/18 ]

still present in 18w16a

Comment by Alex³ [ 24/Jun/18 ]

affects 1.13-pre3

Comment by Alex³ [ 26/Jun/18 ]

Affects 1.13-pre4

Comment by MalbaCato [ 28/Jun/18 ]

Can we rename the issue to be more descriptive please?
I'm sure that counting something that was implemented more than 4 years ago as new is on the more confusing side of things.

Comment by Alex³ [ 28/Jun/18 ]

Affects 1.13-pre5, and yes the summary should probably be updated.

Comment by [Mod] Kumasasa [ 28/Jun/18 ]

Alex³, go ahead!

Comment by Alex³ [ 30/Jun/18 ]

Oh lol, did you make me the reporter?

Comment by [Mod] Kumasasa [ 30/Jun/18 ]

Comment by Caiden Block [ 21/Oct/18 ]

I find this is extremely annoying when trying to compare users' values e.g. 'Player1's value is /value/ compared to your value of /value/'

  • also affects Minecraft 1.13.2-pre2
Generated at Wed Jan 16 01:57:43 CST 2019 using Jira 7.11.2#711002-sha1:fdc329dee91471a641faabfe39b5ff8c0a5b3f66.