持久生命值属性

一个由计分板驱动的服务器端模组,旨在让永久生命值增减变得更简单。

元素类型 名称 流程用途
Gamerule DefaultMaxHealth 默认值:20
Gamerule HealthSetOnJoin 默认值:True
Scoreboard HasPlayerJoined 当玩家加入世界时:
如果 HasPlayerJoined 计分板 ≠ 1 且 HealthSetOnJoin 游戏规则开启:
→ 将 PlayerMaxHealth 计分板设为 20
→ 将 HasPlayerJoined 计分板设为 DefaultMaxHealth 游戏规则的值
Scoreboard PlayerMaxHealth 当玩家重生时:
以事件/目标实体身份运行命令:
/attribute @s minecraft:generic.max_health base set <PlayerMaxHealth Scoreboard>
Command /set_max_health 用法:/set_max_health <playername> <max_health>
→ 将 PlayerMaxHealth 计分板设为 <max_health>
→ 以事件/目标实体身份运行命令:
/attribute @s minecraft:generic.max_health base set <PlayerMaxHealth Scoreboard>