The Lock
field on containers and the minecraft:lock
item stack data component do not get datafixed correctly when a backslash is present.
Steps to reproduce (container block):
Place a container block with a lock in a world in 1.21.1:
/setblock ~ ~ ~ minecraft:chest{Lock:"\\"}
Observe how the lock string is
"\\"
when checked using the data command:
/data get block ~ ~ ~ Lock
Load the world in 24w39a.
Observe how the lock is gone:
/data get block ~ ~ ~ lock
There is also no error present in the logs.
Steps to reproduce (minecraft:lock
item stack data component):
Give yourself the following item stack in 1.21.1:
/give @s stick[minecraft:lock="\\"]
Observe how the
minecraft:lock
data component is"\\"
when holding the item stack and checked using the data command:
/data get entity @s SelectedItem.components."minecraft:lock"
Load the world in 24w39a.
Observe how the
minecraft:lock
data component is empty:/data get entity @s SelectedItem.components."minecraft:lock"
In the logs the following error is also present (see
):
Tried to load invalid item: 'com.google.gson.stream.MalformedJsonException: Unterminated string at line 1 column 4 path $ missed input: {"minecraft:custom_name":'"\\"'} missed input: {"minecraft:lock":{components:{"minecraft:custom_name":'"\\"'}}}'
looks like the issue here is that they only add a \ before ", but not add one before \