Entity Health Display

模组

· 作者 PinkGoosik

用于显示实体生命值的 Fabric 服务端库模组。

0 本站下载 0 关注 更新于 2 年前

需要前置:Fabric API

最新 0.3.1+1.21.3 · 1.21.3 · Fabric

一键开服(送7天)

关于

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;
});

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源