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.
Created Issue:
Translatable component argument boolean doesn't work
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.
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.
I don't think this is working as intended. It not being turned into a string is fine, but this is turning a boolean into a number
Translatable component argument booleandoesn't workTranslatable component argument boolean serialization mismatch
Intended per 1.20.3 changelogs.
Numeric and boolean arguments for translate components are no longer converted to strings
https://www.minecraft.net/en-us/article/minecraft-java-edition-1-20-3
See also https://dzone.com/articles/java-string-format-examples, the format for variables is pretty much the same.
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?