mojira.dev
MC-267438

Translatable component argument boolean serialization mismatch

This command outputs different text in singleplayer vs. multiplayer. On singleplayer, you get a "true hey" message in chat while on multiplayer you get a "1 hey" message in chat.

/tellraw @s {"translate":"%s %s","with":[true, "hey"]}

This is caused by the serialization process for components using nbt now which does not preserve boolean information. When the component is serialized to NBT the arguments ("with") becomes

[{"":1b},{"":"hey"}]

and when the client deserializes that, it reads the 1b as a numeric 1 byte which is then displayed as a 1.

Comments 3

I find it hard to believe its "works as intended" to have 2 starkly different behaviors for singleplayer and multiplayer. I don't see how that text bit in the minecraft changelog is at all indicative of this being WAI, just because they aren't converted to strings means that the behavior is different for singleplayer and multiplayer? How is that at all related.

It is WAI, since we prefer to keep string representation of a booleans undefined (same with, to some degree, numbers).
Forcing true }}to be always displayed as {{{}"true", ignores, well, just about every other language supported by game.
As to answer why we are keeping those types, if they are not meant to be displayed: it's for future extensions.

Shouldn't the result on multiplayer and singleplayer at least be the same?

Machine Maker

(Unassigned)

Confirmed

Commands, Text

1.20.4, 23w51b

Retrieved