-
Bug
-
Resolution: Fixed
-
Minecraft 1.11.2, Minecraft 17w06a
-
macOS Sierra (v 10.12.3 [16D32]), running launcher V2.0.805 and Minecraft Server 17w06a provided by minecraft.net, RAM: 12 GB client, 8 GB server
-
Confirmed
The bug
When you do a tellraw command with a hoverEvent and you specify a color (such as specified below), the color only works along the first line.
/tellraw @p [{"text":"Hover!","hoverEvent":{"action":"show_text","value":[{"text":"Green text\nNot green text","color":"green"}]}}]
When hovered, should show
Green Text
Not green text
instead of
Green Text
Not green text
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
This happens because the method net.minecraft.client.gui.GuiScreen.handleComponentHover(ITextComponent, int, int) just splits the text at line breaks and then renders each line separately. Therefor the second line has no formatting anymore. Instead the method net.minecraft.client.gui.GuiUtilRenderComponents.splitText(ITextComponent, int, FontRenderer, boolean, boolean) could be used.