TransWikia.com

1.16.4 - How to show the mob's health above his head?

Arqade Asked by AruBr on August 4, 2021

My objective is to create a health bar above the mob’s head, and I was thinking about storing the data in a sign, and then setting the mob’s CustomName to the sign Text1, but this way I would need a sign for each mob of my world.

One Answer

Edit

/scoreboard could help.

scoreboard objectives add health health
# Put the following in a repeating command block
execute as @e[tag=track_health] run data merge @s {CustomName:'{"score":{"name":"@s","objective":"health"}}'}

Old answers

data merge entity @e[tag=track_health,limit=1] {CustomName:'{"nbt":"Health","entity":"@e[tag=track_health,limit=1]"}'
setblock ~ ~ ~ minecraft:sign{Text1:'{"nbt":"Health","entity":"@e[tag=track_health,limit=1]"}'}

Answered by Makonede on August 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP