\n in written books not creating new line, giving the error below.
Data tag parsing failed: Invalid escape of 'n' at: {pages:["[\"\",{\"text\":\"one\n<--[HERE]
This is an example below, works in versions 17w15a and lower.
/give @p written_book 1 0 {pages:["[\"\",{\"text\":\"one\ntwo\nthree\"}]"],title:Test,author:Test}
This issue was reported in MC-116553 but not enough information was given.
Linked issues
is duplicated by 3
Comments 5
Confirmed for 17w18a
I upvote this bug report because it's very annoying.
A workaround is to double escape the \n :
\\n
The following example work as intented:
/give @p written_book 1 0 {pages:["{\"text\":\"My\\nBook\"}"],title:"My Book",author:Me}
A workaround is better than nothing, I can work with that for now. Its still a bit strange it changed like that.
Thanks for the information Marcono and Tronics.
See also MC-117080.
After looking at it again this should be indeed intended. The NBT string parser does not know escaping sequences like \n
and it
did not knew them before either, it only acted weird with backslashes treating a single backslash like an escaped one:
/summon armor_stand ~ ~ ~ {CustomName:\} -> "\"
/summon armor_stand ~ ~ ~ {CustomName:\\} -> "\"
Probably intended and caused by the changes to the NBT parser. Escaping the backslashes in front of the "n" solves this.