Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-276979

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 24w39a
    • None
    • Confirmed
    • Datafixer

      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 latest.log):

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

        1. image-2024-09-26-21-59-58-710.png
          49 kB
          chenyuxuan
        2. latest.log
          3 kB
          ErrorCraft

            Unassigned Unassigned
            ErrorCraft ErrorCraft
            Votes:
            3 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              CHK: