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

Health bar of ridable mobs has incorrect number of hearts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.19.4, 1.20.4, 24w03b
    • None
    • Confirmed
    • UI

      Health is a floating point, but almost always treated as an integer. For instance, a horse with 30 max health and 29.001 current health will have 15/15 hearts full, because there are few damage sources that could kill the horse without dealing 30 damage.

      But, a similar horse with, say, 29.3 max health will only have 14 hearts in its health bar, despite also being able to survive 29 full points of damage. If it had a 15th heart, it would be full.

      This may have been introduced in 1.19.4; I don't recall breeding horses prior to it and getting any horses with non-integer max health.

      To replicate:

      • summon a horse
      • do /attribute @e[type=minecraft:horse,sort=nearest,limit=1] minecraft:generic.max_health base set 29.3
      • note the health bar with 14 hearts
      • if you like, deal a full heart of damage to the horse, and all 14 hearts will still be full (27.3 current health is rounded up and displayed as 28)

            Unassigned Unassigned
            Kirby703 Kirby703
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: