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

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 1.11.2, Minecraft 17w06a
    • Environment:

      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

    • Confirmation Status:
      Confirmed

      Description

      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.

        Attachments

          Activity

            People

            • Assignee:
              dinnerbone [Mojang] Dinnerbone (Nathan Adams)
              Reporter:
              TheMuffinPony TheMuffinPony
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                CHK: