显示工具和护甲的当前耐久度!

安装方法
在已有世界中安装
- 下载数据包
- 将 zip 文件放入世界存档的
/datapacks 文件夹中 %appdata%/.minecraft/saves
- 完整路径应类似于
C:\Users\[用户名]\AppData\Roaming\.minecraft\saves\[世界名称]\datapacks
- 在游戏中运行
/reload
在新世界中安装
- 下载数据包
- 开始创建新世界
- 点击 更多 (More) 选项卡
- 点击 数据包 (Datapacks) 按钮
- 点击 打开数据包文件夹,在下载的资源管理器窗口中放入下载的 zip 文件
- 在游戏中运行
/reload
启用图标(可选)
- 安装主数据包
- 下载资源包
- 安装并启用该资源包
- 运行命令
/trigger DurabilityHud.resourcepack
- 享受吧
包含的命令
- 启用图标(需要资源包)
/trigger DurabilityHud.resourcepack
- 按玩家切换耐久度 HUD
/trigger DurabilityHud.toggle
- 显示/隐藏护甲耐久度
/trigger DurabilityHud.armor

面向开发者(如何让物品与此数据包配合工作)
只要物品拥有 max_damage 组件,它就应该能正确显示。
但在 1.21.3 版本中,来自 Minecraft 的原生物品(以及未修改的模组物品)默认并不带有 max_damage 组件。因此我们硬编码了这些值,但只要存在 max_damage,你就应该没问题。
如果无法添加 max_damage,则可以修改/覆盖 get.max.[槽位].default.mcfunction 以返回自定义物品类型的最大耐久度值。或者将自定义物品添加到 tags/item/... 下现有的 durability.max.[最大耐久度].json 标签文件中。
无法获取最大耐久度的物品将显示负值。
Displays current durability of Tools and Armor!

How to Install
Insall in Pre-existing world
- Download the datapack
- Put the zip file in the
/datapack folder of your world-save %appdata%/.minecraft/saves
- Full path should be something like
C:\Users\[USERNAME]\AppData\Roaming\.minecraft\saves\[WORLDNAME]\datapacks
- run
/reload in game
Insall in a New world
- Download the datapack
- Start creating a new world
- Click the More Tab
- Click the Datapacks Button
- Click Open Pack Folder, put the downloaded zip file in the explorer window
- run
/reload in game
Enable Icons (optional)
- Install the actual datapack
- Download the resource pack
- Install and enable the resource pack
- run the command
/trigger DurabilityHud.resourcepack
- Enjoy
Included Commands
- Enable icons (requires resourcepack)
/trigger DurabilityHud.resourcepack
- Toggle Durability Hud per player
/trigger DurabilityHud.toggle
- Show/Hide armor durability
/trigger DurabilityHud.armor

For Developers (how to get items to work with this pack)
As long as a item has the component max_damage it should display correctly.
But as of 1.21.3 plain items from minecraft (and plain modded ones) dont come with the max_damage component by default. Therefore we hardcode these values, but as long as max_damage exists you should be fine.
If adding max_damage is not a option then it is possible to modify/override the get.max.[Slot].default.mcfunction to return custom max damage values for custom item types. Or add custom items to the existing durability.max.[maxdurability].json tag files under tags/item/....
items that are unable to get max damage will display negative values.
评论 0
登录后参与评分
还没有评论,来抢沙发吧