Mojira Archive
MC-122008

custom_potion_effects in arrow entities duplicates with '/execute store' and isn't affected by '/data remove'

The bug

When using the /execute store command on a tipped arrow with custom potion effects, rather than replacing the respective NBT, it will duplicate the field first, THEN replace the respective NBT in the new field.

How to reproduce

  1. Summon an arrow with custom_potion_effects NBT data:
    /summon arrow ~ ~ ~ {custom_potion_effects:[{ambient:0b,show_particles:1b,duration:1200,id:"minecraft:luck",amplifier:1b}]}
    
  2. Run an example execute store command:
    /execute store success entity @e[limit=1,type=arrow] custom_potion_effects[0].duration int 1 run say store
    
  3. Using /data get on the entity results in duplicate entries:
    /data get entity @e[type=arrow,limit=1] custom_potion_effects
    Result
    Arrow has the following entity data: [{duration: 1200, show_icon: 1b, amplifier: 1b, ambient: 0b, id: "minecraft:luck", show_particles: 1b}, {duration: 1, show_icon: 1b, amplifier: 1b, ambient: 0b, id: "minecraft:luck", show_particles: 1b}]
    

Using /data remove doesn't seem to modify the custom_potion_effects tag at all.

/data remove entity @e[limit=1,type=arrow] custom_potion_effects[0]

using this and then /data get gives the same results as listed above.

Code analysis

Code analysis by Dl can be found in this comment.