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

Text wrapping is not working correctly with text consisting of multiple text components

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 17w45b, Minecraft 17w46a, Minecraft 17w47a, Minecraft 17w47b, Minecraft 17w48a, Minecraft 18w06a, Minecraft 18w20c, Minecraft 1.13-pre6, Minecraft 1.13.1-pre1, Minecraft 1.14, Minecraft 1.14.1 Pre-Release 2
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      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

      1. Set the chat width in the "Chat Settings" to 81px
      2. 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

      1. Set the chat width in the "Chat Settings" to 40px
      2. 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

      1. Set the chat width in the "Chat Settings" to 40px
      2. 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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                marcono1234 [Mod] Marcono1234
              • Votes:
                7 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  CHK: