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

you can't add a line break when modifying a book with /item modify

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.21
    • None
    • Unconfirmed
    • (Unassigned)

      in the modifier you need to set 2 backslashes like \ \ n(without the spaces, it does a line break here without), or else it won't work, but when using it, then the game adds a backslash in the books data for every backslash, making \ \ n into \\\\n in the nbt

      book made with the following command:

      /give @p written_book[written_book_content={title:"",author:"",pages:['[{"text":"hello\\n"},"no"]']}] 1
      

      book made with /item modify command:

      /give @p written_book
      /item modify entity @s weapon.mainhand {"function":"minecraft:set_written_book_pages","pages":[{"text":"hello\\n","extra":[{"text":"no"}]}],"mode":"append"}
      

        1. give-command-book.png
          54 kB
          IwrsTheKing007
        2. image-2024-07-30-10-38-00-308.png
          54 kB
          IwrsTheKing007
        3. image-2024-07-30-10-38-42-195.png
          66 kB
          IwrsTheKing007
        4. item-modify-command-book.png
          52 kB
          IwrsTheKing007

            Unassigned Unassigned
            IwrsTheKing007 IwrsTheKing007
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: