Attributes UI
Attributes UI 是一款客户端 NeoForge 模组,它在玩家背包左侧添加了一个简洁且可配置的属性表格。
它专为模组化游戏环境设计,让玩家无需打开额外菜单或依赖硬编码兼容性即可同时查看原版和自定义属性。
功能特性
- 直接从背包界面显示玩家属性
- 支持原版和模组自定义属性
- 通过
config/attributesui-client.toml 配置文件自定义行数
- 在背包玩家模型区域提供切换按钮
- 切换状态会在重新打开背包和游戏重启后保持
- 当属性值未超过配置的阈值时,自动隐藏对应行
- 支持使用空白分隔行对区块进行分组
- 支持纯数字和百分比样式显示
- 支持仅用于显示的数值变换,包括
Deduct(减去)、Divide(除以)和 Multiply(乘以)
- 仅限客户端;不会改变实际玩家属性
默认属性
生成的默认配置包含以下属性:
generic.max_health
generic.armor
generic.armor_toughness
generic.attack_damage
generic.attack_speed
配置方法
首次启动游戏后,编辑以下文件:
config/attributesui-client.toml
每个属性条目为一个对象:
attributes = [
{ Name = "Max Health", Attribute = "generic.max_health", Deduct = 0.0, Divide = 0.0, Multiply = 0.0, ShowAbove = 0.0, Type = "plain" },
{ Name = "Armor", Attribute = "generic.armor", Deduct = 0.0, Divide = 0.0, Multiply = 0.0, ShowAbove = 0.0, Type = "plain" }
]
自定义属性示例
attributes = [
{ Name = "Ability Haste", Attribute = "spell_power:haste", Deduct = 100.0, Divide = 0.0, Multiply = 0.0, ShowAbove = 100.0, Type = "percent" },
{ },
{ Name = "Arcane Spell Power", Attribute = "spell_power:arcane", Deduct = 0.0, Divide = 0.0, Multiply = 0.0, ShowAbove = 1.0, Type = "plain" },
{ Name = "Spell Critical Damage", Attribute = "spell_power:critical_damage", Deduct = 0.0, Divide = 0.0, Multiply = 100.0, ShowAbove = 150.0, Type = "percent" }
]
配置字段说明
Name: 表格中显示的显示名称
Attribute: 从玩家身上读取的属性 ID
Deduct: 仅从显示值中减去该数值
Divide: 当大于 0 时,将显示值除以该数值
Multiply: 当大于 0 时,将显示值乘以该数值
ShowAbove: 仅当真实属性值大于此数字时才显示该行
Type: plain(普通)或 percent(百分比)
{ }: 在用户界面中添加空白分隔行
显示变换
变换仅影响视觉效果。模组绝不会更改真实的属性值。
显示值的计算方式如下:
display = raw - Deduct
if Divide > 0: display = display / Divide
if Multiply > 0: display = display * Multiply
如果 Type 设置为 percent,模组会在最终显示值后添加 % 符号。
例如,如果一个自定义属性返回值为 105,且配置中设置了 Deduct = 100 和 Type = "percent",则用户界面将显示 5%。
兼容性
Attributes UI 通过 ID 读取属性,因此只要其他模组的自定义属性被注册为正常的 Minecraft 属性,它就能支持这些自定义属性。
本模组仅限客户端使用,旨在兼容 NeoForge 1.21.1。
Attributes UI
Attributes UI is a client-side NeoForge mod that adds a clean, configurable attributes table to the left side of the player inventory.
It is designed for modded setups where players need to see both vanilla and custom attributes without opening extra menus or relying on hardcoded compatibility.
Features
- Shows player attributes directly from the inventory screen
- Supports vanilla and custom modded attributes
- Configurable rows through
config/attributesui-client.toml
- Toggle button inside the inventory player model area
- Toggle state persists across inventory reopens and game restarts
- Automatically hides rows when their value is not above the configured threshold
- Supports blank separator rows for grouping sections
- Supports plain numbers and percent-style display
- Supports display-only value transforms with
Deduct, Divide, and Multiply
- Client-side only; it does not change actual player attributes
Default Attributes
The default generated config includes:
generic.max_health
generic.armor
generic.armor_toughness
generic.attack_damage
generic.attack_speed
Configuration
After launching the game once, edit:
config/attributesui-client.toml
Each attribute entry is an object:
attributes = [
{ Name = "Max Health", Attribute = "generic.max_health", Deduct = 0.0, Divide = 0.0, Multiply = 0.0, ShowAbove = 0.0, Type = "plain" },
{ Name = "Armor", Attribute = "generic.armor", Deduct = 0.0, Divide = 0.0, Multiply = 0.0, ShowAbove = 0.0, Type = "plain" }
]
Custom Attribute Example
attributes = [
{ Name = "Ability Haste", Attribute = "spell_power:haste", Deduct = 100.0, Divide = 0.0, Multiply = 0.0, ShowAbove = 100.0, Type = "percent" },
{ },
{ Name = "Arcane Spell Power", Attribute = "spell_power:arcane", Deduct = 0.0, Divide = 0.0, Multiply = 0.0, ShowAbove = 1.0, Type = "plain" },
{ Name = "Spell Critical Damage", Attribute = "spell_power:critical_damage", Deduct = 0.0, Divide = 0.0, Multiply = 100.0, ShowAbove = 150.0, Type = "percent" }
]
Config Fields
Name: Display name shown in the table
Attribute: Attribute id to read from the player
Deduct: Subtracts from the shown value only
Divide: Divides the shown value when greater than 0
Multiply: Multiplies the shown value when greater than 0
ShowAbove: Shows the row only when the real attribute value is greater than this number
Type: plain or percent
{ }: Adds a blank separator row in the UI
Display Transforms
Transforms are visual only. The mod never changes the real attribute value.
The display value is calculated as:
display = raw - Deduct
if Divide > 0: display = display / Divide
if Multiply > 0: display = display * Multiply
If Type is percent, the mod adds % after the final displayed value.
For example, if a custom attribute returns 105 and the config has Deduct = 100 and Type = "percent", the UI shows 5%.
Compatibility
Attributes UI reads attributes by id, so it can support custom attributes from other mods as long as they are registered as normal Minecraft attributes.
The mod is client-side and intended for NeoForge 1.21.1.
评论 0
登录后参与评分
还没有评论,来抢沙发吧