Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-112765

hoverEvent JSON with specified color does not share among new lines

XMLWordPrintable

    • 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.

            dinnerbone [Mojang] Nathan Adams
            TheMuffinPony TheMuffinPony
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: