伤害信息

伤害信息

实体受到伤害时显示飘浮的伤害数字,风格完全可自定义。

高性能 —— 伤害记录按游戏刻批量处理,并通过现代提交管线渲染,对客户端性能的影响微乎其微。

自定义伤害显示

所有伤害数字样式都在一个 JSON 文件中定义:

  • 路径: assets/damage_info/damage_info/damage_info.json(资源位置:damage_info:damage_info/damage_info.json)
  • 编辑后使用 /reload 重新加载。

示例

{
  "default": {
    "damage_type": "default",
    "texture": "damage_info:textures/damage_font.png",
    "texture_width": 55,
    "texture_height": 7,
    "glyph_spacing": 0,
    "render_size": 0.2,
    "max_life": 40,
    "color": "ff9104",
    "critical_color": "ff5a28"
  },
  "entries": [
    {
      "damage_type": "lyra:servant",
      "texture": "damage_info:textures/damage_font.png",
      "texture_width": 55,
      "texture_height": 7,
      "glyph_spacing": 0,
      "render_size": 0.2,
      "max_life": 40,
      "color": "68dfff",
      "critical_color": "049fff"
    }
  ]
}

字段

字段 描述
damage_type 伤害类型 ID。default 是所有未列出类型的备选样式。
texture 字形纹理。布局:数字 0-9 依次排列,后跟小数点(索引 10)。
texture_width / texture_height 纹理大小(以像素为单位)。字形宽度由 texture_width / 11 推导得出。
glyph_spacing 字形之间的水平间距(以像素为单位)。
render_size 在世界中的渲染大小。
max_life 伤害数字的寿命(以游戏刻为单位)。
color / critical_color 普通 / 暴击颜色,十六进制 RGB(不带 #)。