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

F3 + I does not preserve new lines in unwritten books in lecterns

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • Minecraft 1.14.3, 1.16.1, 20w27a, 1.16.2
    • None
    • Confirmed
    • (Unassigned)

      The bug

      Using the F3 + I key bind on a lectern with a book and quill does not preserve new line characters.  For example, typing:

      hello
      world
      

      into a book and quill, placing it on a lectern, and using F3 + I obtains:

      /setblock ~ ~ ~ minecraft:lectern[facing=south,has_book=true,powered=false]{Book:{id:"minecraft:writable_book",Count:1b,tag:{pages:["hello
      world"]}},Page:0}
      

      When used to generate a new lectern, this command produces a book and quill with the text:

      helloworld
      

      Attempting to manually insert the new-line character, \n, between "hello" and "world" results in the error: "Invalid Escape sequence '\n' in quoted string."

      This issue does not occur with written books, and is likely related to a discrepancy between written and unwritten books: unlike written books, unwritten books do not appear to accept JSON-formated text.

      For example:

      /give @p minecraft:written_book{pages:['{"text":"hello\\nworld"}'],author:"None",title:"Test"}
      

      results in:

      hello
      world
      

      However,

      /give @p minecraft:writable_book{pages:['{"text":"hello\\nworld"}']}
      

      results in the literal text:

      {"text":"hello\nworld"}
      

      This portion of the issue also occurs when /setblock is used to summon lecterns.

      How to reproduce

      1. Enter the following text into book and quill:
        Test
        Test
      2. Without signing the book, place it onto a lectern
      3. Right-click the lectern to read the book
        The text is displayed correctly
      4. Exit the lectern GUI and press F3 + I while looking at the lectern
      5. Destroy the lectern
      6. Run the command that was copied to your clipboard
      7. Right-click the lectern again
        The text in the book now reads: "TestTest"

            Unassigned Unassigned
            ThisSentenceIsFalse Billiam
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: