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

Line breaks different in signed book

XMLWordPrintable

    • Confirmed

      The bug

      When writing in a book & quill and a word jumps to the next line on the last letter, it will jump back when the space bar is struck. However, in the signed book, that word will be on the next line and if the text on the page is over 13 lines long, a line of text will be lost. I have illustrated this in the screenshots below.

      P.S.: Yes, I know this has been reported before but that report was written off as a duplicate to another issue that was not related. MC-78858 was not a duplicate of MC-31113.

      Code analysis

      Based on 1.11 decompiled using MCP 9.35 rc1

      Automatic linebreak for valid text lengths while editing

      The last word appears in the new line because the method net.minecraft.client.gui.GuiScreenBook.drawScreen(int, int, float) just appends the cursor (flashing _) to the text which increases the length. One possible approach to fix this might be to use the method net.minecraft.client.gui.GuiUtilRenderComponents.splitText(ITextComponent, int, FontRenderer, boolean, boolean) and then test if the cursor character can be appended to the last ITextComponent item and if not a new ITextComponentItem has to be added (this would probably solve the second bug as well).

      Automatic linebreak while editing differs from signed version

      The reason here is similar to the one for MC-83469 and is caused by the two different rendering methods.
      net.minecraft.client.gui.GuiUtilRenderComponents.splitText(ITextComponent, int, FontRenderer, boolean, boolean) splits a string before the character which causes the string to exceed a given rendering width, whereas net.minecraft.client.gui.FontRenderer.drawSplitString(String, int, int, int, int) splits it after the character which exceeded the given width. (Please correct me here if I am wrong).

        1. glitch 1.JPG
          glitch 1.JPG
          28 kB
        2. glitch 2.JPG
          glitch 2.JPG
          36 kB
        3. signed glitch.JPG
          signed glitch.JPG
          34 kB

            rherlitz Rikard Herlitz
            MinerMom Donna Beane
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: