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

JSON Inheritance in Books Differs from /tellraw, /title, and Signs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 1.13.1
    • Minecraft 14w29b, Minecraft 14w30a, Minecraft 14w30b, Minecraft 14w30c, Minecraft 14w31a, Minecraft 14w32a, Minecraft 14w32b, Minecraft 14w32c, Minecraft 14w32d, Minecraft 14w33a, Minecraft 14w33b, Minecraft 14w33c, Minecraft 1.8, Minecraft 1.8.1-pre3, Minecraft 1.8.1, Minecraft 1.8.3, Minecraft 1.8.7, Minecraft 1.8.8, Minecraft 15w47c, Minecraft 15w49a, Minecraft 15w49b, Minecraft 15w50a, Minecraft 16w05b, Minecraft 16w06a, Minecraft 1.9 Pre-Release 3, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 1.11.2, Minecraft 1.12 Pre-Release 6, Minecraft 18w08b, Minecraft 18w11a
    • None
    • Community Consensus

      NOTE: This is not a duplicate of MC-55373, which outlines specifics to inheritance. This report is exclusive to books, in which the outlined specifics to inheritance in the other report are not followed as they should be expected to.


      I have confirmed that the following fix does work using 1.8 MCP:

      @marcono1234

      The reason why this happens is because the public void drawScreen(int mouseX, int mouseY, float partialTicks) method of the net.minecraft.client.gui.GuiScreenBook class calls the method String getUnformattedText() of the net.minecraft.util.IChatComponent interface which results in "§lGood bye.". However instead it should call the String getFormattedText() method which would results in "§r§r§l§lGood§r bye.§r" (the correct text).


      When using the following:

      /give @a minecraft:written_book 1 0 {title:"Test",author:"Test",pages:["[\"\",{\"text\":\"Good\",\"bold\":true},\" bye.\"]"]}

      Picture "book inherit" displays the result, in which both "Good" and "bye." are bold, while only "Good" is supposed be bold. Picture "sign inherit" shows the exact same JSON being used, which displays how inheritance should be expected.

      This is displayed correctly for signs, /tellraw, and /title, but not for books. If the newline character (\n) is inserted before "bye.", the inheritance occurs as it should be expected to, shown in picture "book inherit 2":

      /give @a minecraft:written_book 1 0 {title:"Test",author:"Test",pages:["[\"\",{\"text\":\"Good\",\"bold\":true},\"\\nbye.\"]"]}

      This only occurs with formatting options, including: color, bold, italic, strikethrough, underlined, and obfuscated.

        1. sign inherit.png
          sign inherit.png
          9 kB
        2. book inherit 2.png
          book inherit 2.png
          4 kB
        3. book inherit.png
          book inherit.png
          5 kB

            Unassigned Unassigned
            skylinerw [Mod] Skylinerw
            Votes:
            11 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: