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

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.15.2, 20w18a, 1.16.2, 20w51a
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Category:
      Entities

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              pokechu22 [Mod] Pokechu22
              Votes:
              6 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                CHK: