mojira.dev
MC-279229

SNBT text components prevent \n and \t from working

in tellraw, \n is considered as an Invalid escape sequence, so it's no longer possible to include newlines in text component commands.
I used this command:
/tellraw @a {"text":"\n Text","color":"gray"}

\t also no longer works

 

Linked issues

Attachments

Comments 7

Definitely caused by the change from JSON to SNBT.

25w02a Updated data format of Text Components.
Changelog says:

  • Text Components are no longer stored as JSON wrapped by a string

  • The format itself is the same as before, but inlined directly into the outer structure

  • For example, the item component minecraft:custom_name="{\"text\":\"Renamed item\"}" will become minecraft:custom_name={text:'Renamed item'}

  • This includes Text Components passed as arguments to commands such as /tellraw or /title

    • For example, /tellraw @s "\"text\":\"Hello world\"" may become /tellraw @s {text:'Hello world'}

  • Note: in the case where Text Components are embedded in NBT, no distinction exists between boolean and integer types

    • To pass boolean arguments to translations, you must use the string form

  • For Text Components with the nbt type and interpret set to true, Text Components will be parsed from the given NBT directly rather than converting to string and parsing as JSON

  • The format of hover and click events has been updated

Xfrtrex, if you're quoting the changelog because of the quoted keys, that's valid in SNBT as well. Nothing in your quote concerns the issue of the newline not working.

This should really be fixed, it's breaking a lot of tellraw usages in my datapacks (not that they weren't already broken because of hoverEvent being changed to hover_event and clickEvent being changed to click_event) because of \n and removing all of the \n usages makes them look very ugly in-game, especially hover text.

This has broken all my book creation commands as well. It's pretty hard to make a valid book (with a command) without newlines.

Can confirm in 25w08a.

Can confirm in all versions that released while the bug tracker was down. (Welcome back, Mojira!)

Kremisa

boq

Confirmed

Platform

Important

Commands

25w02a, 25w03a, 25w04a, 25w05a, 25w06a

25w09a

Retrieved