Open GrantGryczan opened 2 years ago
I'm fairly sure you actually can't have newlines in NBT text. Are you sure there is any valid output?
Yes you can, and removing the double slashes fixes it.
Can you show me a detailed example? Minecraft does not seem to accept \n
, while \\n
is accepted.
This works:
This doesn't:
This NBT is not in a Minecraft command. It's in a string in a JSON file.
I realize this issue is more complicated that I thought, because it seems escaping needs to be done differently between NBT in a JSON string and NBT in a command.
Edit: Never mind, \n
isn't even valid in NBT for a command, escaped or not. It's not a valid escape sequence.
NBT.stringify({ test: '\n' })
should output"{test:'\n'}"
when used in a JSON file, not"{test:'\\n'}"
. This input impossible to specify in commands validly though.Minimal reproduction code:
Minecraft does not recognize this NBT as valid. Entering
/loot give @s loot test:book
will not work. Opening the outputted loot table file shows this error:And Minecraft logs this error: