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

Phantom attack damage attribute resets on world load if size is nonzero

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.15.2, 20w18a, 1.16.2, 20w51a, 21w03a, 1.16.5, 21w08b, 21w20a, 22w18a, 24w20a
    • None
    • Confirmed
    • Entities

      The bug

      Although MC-135247 no longer applies for normal phantoms since 19w08a, phantoms with size greater than 1 still have the attack damage attribute reset when the world is reloaded. It does temporarily work before reload, though, and phantoms of size 0 have the attribute persist even after world reload.

      How to reproduce

      1. Summon a phantom
      2. Run the command
        /data merge entity @e[type=minecraft:phantom,limit=1] {Size:40}
        
      3. Check the value of the attack damage attribute (for size 40, it defaults to 46).
        /attribute @e[type=minecraft:phantom,limit=1] minecraft:generic.attack_damage base get
        
      4. Attempt to modify the attack damage attribute:
        /attribute @e[type=minecraft:phantom,limit=1] minecraft:generic.attack_damage base set 99
        
      5. Observe that the change did stick temporarily and that the value is now 99:
        /attribute @e[type=minecraft:phantom,limit=1] minecraft:generic.attack_damage base get
        
      6. Reload the world, and then run the above command.
        The value will have reset to the default of 46 (for size 40).

      Code analysis

      19w08a no longer sets the attribute when NBT is read (it only modifies the hitbox). However, it does update the attribute (and hitbox) when the size entity metadata changes. Since the size entity metadata defaults to 0, no update is generated when the size is 0, as is the case for all naturally spawned phantoms.

            Unassigned Unassigned
            pokechu22 [Mod] Pokechu22
            Votes:
            12 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              CHK: