mojira.dev
MC-279252

Changing a single line of a sign with /data is no longer possible in some situations

Due to text components being changed from strings containing JSON to NBT structures, the messages lists in signs can be either a list of 4 strings or a list of 4 compounds. If all lines are unformatted, they resolve to strings.

A side-effect of this change is that it is no longer possible to replace a single line with formatted text if all lines are currently unformatted (because the list cannot contain a compound and 3 strings).

This is a breaking change as before it was always 4 strings regardless of text formatting.

Steps to Reproduce:

  1. Open a singleplayer world in 1.21.4

  2. Place a sign

  3. Stand inside of it and run

    /data modify block ~ ~ ~ front_text.messages[0] set value '{"text":"Hello","bold":true}'{\code}
    # Observe the sign
    # Close your game and relaunch in 25w02a then reopen the world.
    # Destroy the sign and replace it
    # Stand inside of it and run

    /data modify block ~ ~ ~ front_text.messages[0] set value {text:"Hello",bold:true}{\code}

  4. Observe the sign

Observed Results:

In 1.21.4, the bold line correctly replaces the first line. This works because you are changing the list from

["","","",""]{\code} to

['{"bold":true,"text":"Hello"}',"","",""]{\code}

In 25w02a, the command that you would expect to do the same thing fails because you are essentially attempting to change

["","","",""]{\code} to

[{bold:true,text:"Hello"},"","",""]{\code} which is illegal as NBT lists may only contain a single type.

Expected Results:

In both versions, the respective command should modify the first line of the sign to say "Hello" in bold.

Linked issues

Attachments

Comments 6

Can confirm.

[media]

You need to use in 25w02a the command from 1.21.4.
The following command stil works: 

/data modify block ~ ~ ~ front_text.messages[0] set value '{"text":"Hello","bold":true}'

Edit: This command adds the message as a string, which means that "{"text":"Hello","bold":true}" is shown on the sign instead of "Hello"

That command puts that literal string as the sign text, the point is to put the word "Hello" but bolded, which is what's broken

Not correct - it inserts the raw string into the sign.

[media]

Version: 25w06a

[media]


STILL BROKEN

/data modify block -73 67 -52 front_text.messages[0] set value {text:"Hello, World!",color:aqua}

!NOT RESOLVED as of 25w08a!

Unable to use text components to set single line

Issue: MC-280287

DorkOrc

gegy

Confirmed

Platform

Important

Commands

25w02a, 25w05a

25w09a

Retrieved