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

JSON formatting in the action bar is not supported via the chat packet, breaking coloration for some messages (spectators opening loot table chests and building too high)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • None
    • Minecraft 1.12, Minecraft 17w31a, Minecraft 1.12.1 Pre-Release 1, Minecraft 1.12.1, Minecraft 1.12.2 Pre-Release 1, Minecraft 1.12.2 Pre-Release 2, Minecraft 1.12.2, Minecraft 17w43a, Minecraft 17w43b, Minecraft 17w45a, Minecraft 17w46a, Minecraft 17w48a, Minecraft 17w50a, Minecraft 18w01a, Minecraft 18w03b, Minecraft 18w06a, Minecraft 18w09a, Minecraft 18w10d, Minecraft 18w14b, Minecraft 1.13-pre1, Minecraft 1.13-pre3, Minecraft 1.13-pre6, Minecraft 1.13-pre8, Minecraft 1.13-pre10, Minecraft 1.13, Minecraft 18w30b, Minecraft 18w31a, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 19w04b, Minecraft 19w05a, Minecraft 19w06a, Minecraft 19w11b, Minecraft 19w12a, Minecraft 19w13b, Minecraft 1.14 Pre-Release 1, Minecraft 1.14, 1.14.4, 19w41a, 1.15 Pre-release 6
    • Confirmed
    • (Unassigned)

      Chat messages in the action bar do not correctly render component-based formatting, if they are sent via the Chat packet (0x0F). However, they do work correctly if deprecated §-based formatting codes are sent within a component, or if the Title packet (0x47) is used.

      Affected methods and actions

      • Anything that directly sends a chat message with type GAME_INFO
      • Anything that calls EntityPlayer.sendStatusMessage(IChatComponent, boolean) with the second parameter set to true (both serverside and clientside)
      • Anything that calls GuiIngame.setOverlayMessage(IChatComponent, boolean) with the second parameter set to true.

      Specifically, the following are known to have messages that are formatted, but don't display formatted:

      • Opening a chest in spectator mode
      • Building above the height limit

      To reproduce in-game

      1. Create a chest with a loot table via
        /setblock ~ ~ ~ minecraft:chest{"LootTable":"minecraft:chests/simple_dungeon"}
        
      2. Switch to spectator mode
        /gamemode spectator
        
      3. Attempt to open the chest
        → Note that the message that appears above the hotbar is white, not red

      To directly reproduce

      1. Send a chat packet (SPacketChat / 0x0F) with a payload such as {"color":"green","text":"Test"} and the position set to actionbar (ChatType.GAME_INFO / 2).
        → Observe that the message appears white

      Cause

      GuiIngame.setOverlayMessage(IChatComponent, boolean) uses component.getUnformattedText to get the text to display when it should use getFormattedText. (The method in question is on line 1107 of the actual source).

      This does not affect the title packet because that method retrieves the formatted text and then uses GuiIngame.setOverlayMessage(String, boolean) with it.

            Unassigned Unassigned
            pokechu22 [Mod] Pokechu22
            Votes:
            18 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: