mojira.dev
MC-269091

AttributeModifiers NBT with missing fields is not upgraded correctly to components

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.

Linked issues

Comments 2

Apologies for the incorrect resolution as duplicate of MC-269037. It wasn't clear to me that this is a world upgrade issue. I've edited the bug report slightly to make this clearer.

Uh wait... I apologize, it appears that only the AttributeModifier tag is lost, not the entire item. I wrote them incorrectly at first.

Triton365

gegy

Plausible

Platform

Important

Datafixer

24w09a

24w10a

Retrieved