Mojira Archive
MC-62866

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

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.