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

/data remove cannot remove attribute (modifier)s


    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.13, 20w51a, 21w06a
    • None
    • Windows 10
      Java 9.0.4
    • Community Consensus
    • Commands

      I spawned in one pig, and ran the following commands as a test of adding/remove NBT data, specifically modifiers on mobs:

      /data merge entity @e[limit=1,type=minecraft:pig] {Attributes:[{Name:"generic.armor",Modifiers:[{UUIDMost:4321,UUIDLeast:1234,Amount:1.0d,Operation:0,Name:"test_armor"}]}]}

      This is to add a modifier of 1 extra armor to a pig.
      I tried the following to remove said Modifier, but none worked. (note, the 4th entry in the list of attributes is the base armor attribute, so it is not arbitrary)

      /data remove entity @e[limit=1,type=minecraft:pig] Attributes[3].Modifiers
      /data remove entity @e[limit=1,type=minecraft:pig] Attributes[3].Modifiers[0]
      /data remove entity @e[limit=1,type=minecraft:pig] Attributes[3]

      None of these had any effect on updating or removing the Modifier. The only possible work around I have found is modifying the values using a merge that either knows the exact index (not really efficient if in command blocks / function file), or using a pair of the UUIDs and Name to set the amount to 0 (Also not what I would like to do, as that would mess with UUID unique pairing).

      The expected outcome is that just the modifier will be removed from the NBT data for the armor attribute.

            Unassigned Unassigned
            BroteinBar Matthew
            7 Vote for this issue
            8 Start watching this issue