
实体生命值显示
用于显示实体生命值的Fabric服务端库模组。
查看大图关于
Entity Health Display 是一个用于显示实体生命值的 Fabric 服务端库。
安装
要在你的项目中使用 Entity Health Display,请将 Modrinth 仓库添加到你的构建文件中,并添加模组依赖。将 VERSION_TAG 替换为最新版本,例如 0.3.1+1.20.2
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}")
}
示例
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;
});
正在加载版本记录…
正在加载评论…
评论在新手盒子客户端中发表,这里同步展示。