mojira.dev
MC-276979

Lock field on containers and minecraft:lock data component do not get datafixed correctly when a \ is present

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):

  1. Place a container block with a lock in a world in 1.21.1:

    /setblock ~ ~ ~ minecraft:chest{Lock:"\\"}
  2. Observe how the lock string is

    "\\"

     when checked using the data command:

    /data get block ~ ~ ~ Lock
  3. Load the world in 24w39a.

  4. 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):

  1. Give yourself the following item stack in 1.21.1:

    /give @s stick[minecraft:lock="\\"]
  2. 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"
  3. Load the world in 24w39a.

  4. 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

[media]
  1. ):

    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":'"\\"'}}}'

Attachments

Comments 1

[media]

looks like the issue here is that they only add a \ before ", but not add one before \

ErrorCraft

Panda4994

Confirmed

Platform

Normal

Datafixer

24w39a

1.21.2 Pre-Release 1

Retrieved