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

JSON components saved in different order

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Awaiting Response
    • None
    • 1.20.4
    • None
    • openjdk version "21.0.1" 2023-10-17 LTS
      OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
      OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode, sharing)

      Windows 11
    • Unconfirmed
    • (Unassigned)

      When generating an via a loot_table JSON, and modifying another item with the 

      /data merge item

       command, even though the order of the NBT components is the same on both, it saves one of them in a different order in the level.dat file.

      For example, here's the NBT of an item created using the loot table, and given using the `/loot` command to the player

      display: {
        Lore: {
          [0]: '{"text":"Drop onto an enchanting table","color":"gray","italic":false}'
          [1]: '{"text":"With an enchanted book","color":"gray","italic":false}'
          [2]: '{"text":"To upgrade the book!","color":"gray","italic":false}'
        }
        Name: '{"text":"Upgrade Rune","color":"light_purple","italic":false}'
      }

      And here's the item when modified using the `/data merge entity` command

      display: {
        Lore: {
          [0]: '{"text":"Drop onto an enchanting table","italic":false,"color":"gray"}'
          [1]: '{"text":"With an enchanted book","italic":false,"color":"gray"}'
          [2]: '{"text":"To upgrade the book!","italic":false,"color":"gray"}'
        }
        Name: '{"text":"Upgrade Rune","italic":false,"color":"light_purple"}'
      }

      note the order of the lore and name's tags such as colors and italics.

      Here's the command I used to modify the item's nbt: https://pastebin.com/rfVhHA4Y
      And here's the JSON that generates the original version: https://pastebin.com/tmuULRAY

      As you can see in both the command and JSON the order of the italics and the color is in the same order, text, color, italics.

       

       

            Unassigned Unassigned
            Yoav_TC Yoav_TC
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: