Is there a way to make a visible health bar for mobs other than ender dragons and withers?
Solution 1:
Have you tried making it yourself?
What you can try doing is:
- Assign a scoreboard value based on a mob's health.
NB: You cannot use the
health
criteria on entities. Only players./scoreboard objectives add healthbar dummy
- Test for mob healths and assign them a score based on their current health in a repeater command block.
/scoreboard players set @e healthbar __ {Health:__s}
Replace__
with a health value, and repeat from 1 (half a heart) to 100 (max health of golems).
You should have a long row of command blocks just doing this if you're doing it correctly.
- Give mob names based on their health. Here's two unicode symbols that represent hearts:
♥♡
, every tick after #2 happens.
If you know what you are doing, you can find your heart symbols in here.
/entitydata @e[score_healthbar_min=20,score_healthbar=20] {CustomName:"♥♥♥♥♥♥♥♥♥♥"}
/entitydata @e[score_healthbar_min=18,score_healthbar=19] {CustomName:"♥♥♥♥♥♥♥♥♥♡"}
/entitydata @e[score_healthbar_min=16,score_healthbar=17] {CustomName:"♥♥♥♥♥♥♥♥♡♡"}
/entitydata @e[score_healthbar_min=14,score_healthbar=15] {CustomName:"♥♥♥♥♥♥♥♡♡♡"}
and so on... Of course, you could just do plain numbers:/entitydata @e[score_healthbar_min=20,score_healthbar=20] {CustomName:"♥ 20"}
/entitydata @e[score_healthbar_min=19,score_healthbar=19] {CustomName:"♥ 19"}
/entitydata @e[score_healthbar_min=18,score_healthbar=18] {CustomName:"♥ 18"}
/entitydata @e[score_healthbar_min=17,score_healthbar=17] {CustomName:"♥ 17"}
or, if you cannot use Unicode:/entitydata @e[score_healthbar_min=20,score_healthbar=20] {CustomName:"Health: 20"}
/entitydata @e[score_healthbar_min=19,score_healthbar=19] {CustomName:"Health: 19"}
/entitydata @e[score_healthbar_min=18,score_healthbar=18] {CustomName:"Health: 18"}
/entitydata @e[score_healthbar_min=17,score_healthbar=17] {CustomName:"Health: 17"}
If you know what you're doing, you should have a long chain of about about 150 chain command blocks and a repeat command block and mobs should have health bar as their custom name. Less, if you only only want to test a smaller health range, or put all mobs with more than 20 health as "20+
" or any other optimisation changes, etc.
The downsides to this system however, is ALL NAMETAG NAMES WILL BE OVERWRITTEN.
A workaround would be to put @e[type=MOBNAME]
, but that would multiply the number of commands you have to create by the number of mobs you want to track.
Or, you could look at this answer on how to tag specific mob types and then instead of the above paragraph, just edit your health testing commands to only test selected mobs. Of course, you would need a few more extra command blocks to do your marking of mobs that should have their health tracked and displayed and the command blocks handling steps 2 and 3 should have a selector to filter for those mobs too.