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 totrue
(both serverside and clientside)Anything that calls
GuiIngame.setOverlayMessage(IChatComponent, boolean)
with the second parameter set totrue
.
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
Create a chest with a loot table via
/setblock ~ ~ ~ minecraft:chest{"LootTable":"minecraft:chests/simple_dungeon"}
Switch to spectator mode
/gamemode spectator
Attempt to open the chest
→ Note that the message that appears above the hotbar is white, not red
To directly reproduce
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.
Linked issues
is duplicated by 1
relates to 2
Comments 13
How do you send that chat packet? I'm curious.
Also, confirmed in 1.12, when failed to place a command block on height level 256.
How do you send that chat packet? I'm curious.
That requires a modified or otherwise custom server (which is the situation where this first was encountered – for the protocol documentation on wiki.vg); it's the situation where I first heard of this behavior, and then I went back and traced it to where a packet like that is sent in vanilla.
I did some research when I had to figure out when this bug was fixed, and figured out that it was fixed in 20w17a for 1.16.0!
I assume that they just forgot to mention this as fixed as the same snapshot added font and hex color support to components and they likely just fixed the bug while adding that
Can confirm for 1.12 and 1.11.2 client.