mojira.dev
MC-87143

Setblock signs with text put "null" on empty lines by reloading the world

Setblock signs with text put "null" in the empty boxes by reloading the world

When I restarted my world, all the empty boxes have been replaced by "null"
1 - Give a command block (/give @p command_block)
2 - Put this command and active it :

/setblock ~ ~ ~ minecraft:standing_sign 0 replace {Text1:"Hello !"}

3 - Look at your sign , it is normal

4 - Restart your world
5 - Look again the sign

Linked issues

Attachments

Comments 23

marcono1234

Confirmed for

  • 15w35e when copying sign with NBT data

The problem is that Minecraft defaults not existing Text entries to "null":

{
	Text1:"{\"text\":\"Hello !\"}",
	Text2:"null",
	Text3:"null",
	Text4:"null"
}

However this is invalid as it now uses always JSON to store text on a sign, so when placing a copied sign or realoading a world, it thinks that the sign displays

Hello!
null
null
null

and transforms every entry that is not in JSON format to JSON format:

{
	Text1:"{\"text\":\"Hello !\"}",
	Text2:"{\"text\":\"null\"}",
	Text3:"{\"text\":\"null\"}",
	Text4:"{\"text\":\"null\"}"
}

Note: This also happens when you provide an empty string as value however placing a sign without NBT data acts different as it automatically uses the JSON format there

Rory

Confirmed for 15w40b.
Marcono is correct, setting blank lines to "{\"text\": \" \"}", will stop this from occurring. It only occurs when you have text and blank lines not using JSON.
The bug happens when you unload the sign as well as when you leave the world.

Meri Diana

Confirmed also for 15w42a.
Edit: e.g. instead of:

setblock ~ ~1 ~ wall_sign 0 replace {
Text2:"{\"text\":\"OAK\",\"color\":\"dark_green\",\"bold\":true}"}

I've got to insert:

setblock ~ ~1 ~ wall_sign 0 replace {
Text1:"{\"text\":\"\"}",
Text2:"{\"text\":\"OAK\",\"color\":\"dark_green\",\"bold\":true}",
Text3:"{\"text\":\"\"}",
Text4:"{\"text\":\"\"}"}

for "null" to not appear on the empty sign lines.

Adrodoc55

I can confirm this for 15w47a

Erik Broes

Are there currently any cases if you are not coming from a snapshot where this happens? If so, could you guys please give the command used, the source-version and the version last loaded in?

13 more comments
Meri Diana

@unknown Thank you for the explanation regarding JSON/Gson!
It's good that it doesn't affect going from 1.8 to 1.9 }=) - but I could swear it was an issue in a previous snapshot, as "null" appeared for me on signs from older versions.
Might be I'm mistaken and I set those signs in an older 1.9 snapshot right before the change to strict JSON.

Whether or not the amount of characters shouldn't be the first priority depends on the perspective.
Whether one likes or despises misleadingly so-called "One Command" contraptions or not, they are a big thing since a while in the commandblocking community, and quite often those things that are loved or sought-after by the community or their mapmakers or minigames servers, are being supported (I'm assuming hence e.g. new CommandBlocks/commands + positioning of items in headslot of ArmorStands), to uphold the popularity of Minecraft.

Those strict JSON signs are very "pricey" as for the needed characters.

So, no matter if I personally support "one command" things or not, for the sake of Minecraft's popularity I guess it's reasonable to support the current "trend" in CommandBlocking.

Also, we shouldn't forget it's not just fancy stuff that can be done with those stacked commands, but also major and foremost easy changes in maps, so it's also a really good utility/tool.
Thus keeping some often needed commands small in the amount of to-be-used characters doesn't seem wrong to me.

Of course, the related bugpost that you linked that is being caused by this seems severe and important enough so that a reopening of this very bugpost and finding another solution for a fix should be considered, no matter what other motivations there could be as of why having to reference also not needed sign lines.

marcono1234

Is this report still flagged for review?

[Mod] redstonehelper

It is not.

Erik Broes

The data required by the sign is changed, if there is an upgradepath issue other than with the commands to set it (with an invalid/incomplete set of data) I can look into it.

marcono1234

@unknown have you considered using the fix provided in this comment?

Berard Alexandre

Erik Broes

Confirmed

blockdata, empty, line, null, setblock, sign, text

Minecraft 15w34d, Minecraft 15w35e, Minecraft 15w40b, Minecraft 15w42a, Minecraft 15w45a, Minecraft 15w47a, Minecraft 15w47c

Minecraft 15w49a

Retrieved