Wiki 9Minecraft Wiki 9Minecraft

Display a Health Bar Above an Entity

Java EditionModGuides 4FAQ 10Related mods 48
DownloadHologram API Mod

Get the files on 9Minecraft

Creating the Health Display

Health bars require updating text to reflect current HP. Unlike static labels, these need to refresh continuously.

1. Identify the entity you want to track (boss, player, or custom mob)

2. Create a hologram positioned 1-2 blocks above the entity's head

3. Use a text component that displays the current health value and maximum health

4. Style it with a color that changes based on health percentage (green for high, red for low)

Keeping It Updated

Attach a tick-based update loop to the hologram:

  • Every tick, query the entity's current health
  • Update the text component with the new values
  • Recalculate the color based on health ratio if desired
  • Set render distance high enough that players see the bar from a distance

Consider using a progress bar format (like ████░░░░) instead of raw numbers for visual clarity. Set the lifetime to persist as long as the entity is alive, or remove it when health reaches zero.

More guides for this mod