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

Storing entity health as /bossbar doesn't work at some times

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Invalid
    • Affects Version/s: 20w17a
    • Fix Version/s: None
    • Confirmation Status:
      Unconfirmed
    • Category:
      (Unassigned)

      Description

      I have made a world to test this and it seems that the Attributes[x].Base is different for every mob and their data, which means a custom zombie with more health and other stats has Attributes.[4].Base as Max Health.

      In previous versions, Max Health was fixed for Attributes.[0].Base

       

      I made a function that draws a health bar of all mobs, though it seems it doesn't work for some. There is a map in attachments.

      execute as @a at @s positioned ^ ^ ^2 as @e[type=!experience_orb,type=!item,type=!player,limit=1,type=!armor_stand,distance=..1.6] at @s store result bossbar healthbar max run data get entity @s Attributes.[1].Base
      execute as @a at @s positioned ^ ^ ^2 as @e[type=!experience_orb,type=!item,type=!player,limit=1,type=!armor_stand,distance=..1.6] at @s store result bossbar healthbar value run data get entity @s Health
      execute as @a at @s positioned ^ ^ ^2 unless entity @e[type=!experience_orb,type=!item,type=!player,limit=1,type=!armor_stand,distance=..1.6] run bossbar set healthbar visible false
      execute as @a at @s positioned ^ ^ ^2 if entity @e[type=!experience_orb,type=!item,type=!player,limit=1,type=!armor_stand,distance=..1.6] run bossbar set healthbar visible true
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            d3athadder_ dave johnson
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: