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

AttributeModifiers NBT with missing fields is not upgraded correctly to components

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w10a
    • 24w09a
    • None
    • Plausible
    • Datafixer
    • Important
    • Platform

      In versions 1.20.4 or before, an item's AttributeModifiers tag was accepted correctly even if the Operation or Name fields were omitted. However, if you open a world in snapshot 24w09a with a custom item that has an attribute with one of these fields omitted, the tag will simply disappear.

      Steps to reproduce

      1. Create a world with version 1.20.4 with cheats enabled
      2. Run these commands to obtain the items.
        // without Name
        give @p stone{AttributeModifiers:[{AttributeName:"minecraft:generic.movement_speed",Amount:1d,Operation:0,UUID:[I;1,1,1,1]}]}
        // without Operation
        give @p stone{AttributeModifiers:[{AttributeName:"minecraft:generic.movement_speed",Name:"",Amount:1d,UUID:[I;1,1,1,1]}]}
        
      3. When you hold these items in your hands, you will notice that your movement speed increases correctly, even though the fields are missing.
      4. Now, enter the same world in 24w09a

      Expected behaviour

      The items should be transferred correctly, along with their attributes, which should still increase the player's movement speed.

      Observed behaviour

      The items are not upgraded correctly and and their AttributeModifiers tag disappears completely.

            gegy1000 [Mojang] Gegy
            Triton365 Triton365
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: