mojira.dev
MC-279232

SNBT text components prevent mixing text styles in lists

In one single tellraw or titleraw command can't be strings (TAG_String) and components (TAG_Compound) used at the same time. In previous versions, this worked fine.

Example:

/tellraw @a ["String-Text ", {"text":"Component-Text"}]

Expected Behavior:

String-Text Component-Text

will be shown in the chat.

Observed Behavior:
In the chat the part from the square brackets opening to the end of the command will be marked red and

Can't insert TAG_Compound into list of TAG_String at position 29: ...g-Text ", <--[HERE]

will be shown over the chat entry line.

Linked issues

Attachments

Comments 6

The pigs in the Screenshot have modified NBT ({NoAI:true})

That shortcut is no longer valid, and per SNBT syntax, that's no bug. You can still achieve the desired result by making the first entry also an object, rather than a string.

This causes issues for editing sign block data also since the lines are stored in a common list and empty lines automatically default to empty strings. It is not currently possible to use text component compounds on single lines of sign text without writing every line of the sign at once to also be a compound. See MC-279252.

I honestly don't understand why they changed the text from JSON to SNBT; there's not much gain to this.

This also prevents mixing integers or booleans with other components in a translate's with, with no workaround besides turning them into components (which is semantically incorrect):

/tellraw @a {"translate":"arguments.item.overstacked","with":[{"translate":"item.minecraft.apple"},64]}

Instead you can use something like that:

/tellraw @a [["String-Text "], [{"text":"Component-Text"}]]

(I've just made a list for every single tag)

PrimCargo693208

boq

Confirmed

Platform

Important

Commands

commands

25w02a

25w04a

Retrieved