Entity Health Display Mod provides a server-side library for displaying the health of mobs in Minecraft. It runs on Fabric servers to show custom health text and heart icons for different mobs. Other projects can use this library to format how mob names, current health numbers, and maximum health values appear in the world.

Entity Health Display Mod

Features:

  • Server-Side Library: Works on Fabric servers as a foundation for showing mob health information.
  • Custom Health Formatting: Uses the FORMAT_HEALTH_DISPLAY event to customize how the mob name, current health, maximum health, and heart symbols look.
  • Color-Coded Health Text: Changes the health number color based on the mob’s remaining health, such as turning yellow when health drops to half or lower and staying green when above half.
  • Display Conditions: Uses the SHOULD_DISPLAY_HEALTH event to control when a mob’s health appears in the world.

Configuration:

Projects using this library can add the repository and dependencies to their build file:

repositories {
    maven {
        url "https://api.modrinth.com/maven"
        content { includeGroup "maven.modrinth" }
    }
    maven { url "https://maven.nucleoid.xyz" }
}

dependencies {
    modImplementation include("maven.modrinth:entity-health-display:VERSION_TAG")
    modImplementation include("eu.pb4:placeholder-api:${project.placeholder_api}")
    modImplementation include("eu.pb4:polymer-virtual-entity:${project.polymer_version}")
}

Example code for registering health display formatting and visibility conditions:

HealthDisplayEvents.FORMAT_HEALTH_DISPLAY.register((entity, world) -> {
   String color = (entity.getMaxHealth() / 2) >= entity.getHealth() ? "<yellow>" : "<green>";
   var text = TextParserUtils.formatText("<red>" + entity.getName().getString() + " " + color + String.format("%.1f", entity.getHealth()) + "<white>/<green>" + (int)entity.getMaxHealth() + "<red>❤");
   return text;
});

HealthDisplayEvents.SHOULD_DISPLAY_HEALTH.register((entity, world) -> {
   return true;
});

Entity Health Display Mod Download Links

For Minecraft 1.21.11, 1.21.10, 1.21.9

Click to rate this post!
[Total: 0 Average: 0]