The bug
Text wrapping is not working correctly with text which consists of multiple text components. An "in-game" example where this bug can be seen are achievements. The method net.minecraft.stats.StatBase.createChatComponent()
builds the text component by inserting the achievement name in between two text components containing the bracket.
The problem is that the brackets are wrapped independently from the achievement name.
Note: There seems to be a different bug with this which causes words to not be wrapped correctly if they are the first word of a text component and the text in the text component before it nearly took up all the space (see reproduction example "First words not wrapped correctly").
Expected behavior
The expected behavior is probably that the method net.minecraft.client.gui.GuiUtilRenderComponents.splitText(ITextComponent, int, FontRenderer, boolean, boolean)
first joins all text components to one string and then starts splitting it.
How to reproduce
Achievement
Set the chat width in the "Chat Settings" to 81px
Give yourself the following achievement
/advancement grant @p only minecraft:nether/return_to_sender
→ You should see that the opening bracket is not wrapped with the achievement name
Custom text components
Set the chat width in the "Chat Settings" to 40px
Use the following command
/tellraw @p ["some te","xt"]
→ You will see that despite there being no space between "te" and "xt", "xt" was still wrapped in the next line while "te" was not
First words not wrapped correctly
Set the chat width in the "Chat Settings" to 40px
Use the following command
/tellraw @p ["some ","text test"]
→ You will see that "text" is not wrapped correctly even though it would fit in the next line
Linked issues
is duplicated by 1
Attachments
Comments 8
Can confirm for MC 1.12.1, the advancement part should be updated though. The new working command is:
/advancement grant @p only minecraft:nether/return_to_sender
Confirmed for 1.14 and 1.14.1-pre2.
I've attached two screenshots of this, based on the last screenshot example in https://bugs.mojang.com/browse/MC-48904 (found that issue before this one).
/tellraw @p [{"text":"["},{"text":"Tip","color":"green"},{"text":"] Follow us on "},{"text":"Twitter","color":"aqua"},{"text":" at: "},{"text":"www.twitter.com/SurvivalCraftMS","color":"dark_aqua"},{"text":" for the latest updates to our server!"}]
Can a mod please update the affected versions to 1.12? Thank you.