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

Only if Health is provided maxHealth attribute is used as maximum Health value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w19a
    • Minecraft 15w49b, Minecraft 1.10.2, Minecraft 16w43a, Minecraft 16w44a, Minecraft 1.11 Pre-Release 1, Minecraft 1.11, Minecraft 16w50a, Minecraft 1.11.1, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 17w13b, Minecraft 17w15a, Minecraft 17w16b, Minecraft 17w17a, Minecraft 17w18b, Minecraft 1.12 Pre-Release 2, 20w07a, 1.16.1, 20w29a, 1.16.2 Pre-release 2, 1.16.2 Release Candidate 1, 1.16.2, 21w03a, 1.16.5, 21w05b, 21w06a, 21w07a, 21w08b
    • Confirmed
    • (Unassigned)

      The bug

      When you summon a mob only with a given value for the generic.max_health attribute the value for the Health tag is the default health value of this mob which can be higher than the value of the attribute generic.max_health. If you however provide the Health tag, the attribute value is used as maximum value.

      How to reproduce

      1. Use the following command
        /summon wolf ~ ~ ~ {Attributes:[{Name:"generic.max_health",Base:0.1d}]}
        
      2. Inspect the NBT data
        /data get entity @e[type=wolf,limit=1] Health
        

        The Health value is the default 8f which is larger than the maximum

      3. Use the following command
        Health provided
        /summon wolf ~ ~ ~ {Attributes:[{Name:"generic.max_health",Base:0.1d}],Health:8f}
        
      4. Inspect the NBT data
        /data get entity @e[type=wolf,limit=1] Health
        

        Its Health value is now the value of the generic.max_health attribute

      Wrong max_health value is used

      Not reproducible anymore in 20w07a (and probably earlier) because when summoning tame wolves their Health is set as well.

      Based on Skylinerw's comment on MC-93830 it also appears that the game is not using the value for the generic.max_health attribute the mob has at the end.

      The following command will cause Health to be set to the maximum value defined by the generic.max_health attribute in the command, however the game overrides this value with the default 20d. This means the Health value of 2f would have been valid.

      /summon wolf ~ ~1 ~ {OwnerUUID:"00000000-0000-0000-0000-000000000000",Attributes:[{Name:"generic.max_health",Base:0.1d}],Health:2f}
      

            Unassigned Unassigned
            marcono1234 Marcono1234
            Votes:
            6 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: