跳转到内容

样式文件说明

样式文件位于:

config/stylizeddamage/styles/<样式名>.json

每个样式文件定义一个伤害跳字的完整视觉表现。文件名即为样式名(不含 .json)。

模组自带默认样式文件 styles/default.json

样式属性一览

属性类型默认值说明
color字符串"#FFFFFF"文字颜色(支持固定色/彩虹)
fontSize浮点数1.0字体大小倍率
fontStyle字符串"bold"字体样式
shadow布尔值true是否显示文字阴影
outlineColor字符串/nullnull文字描边颜色
backgroundColor字符串/nullnull文字背景色块
sound字符串/nullnull跳字出现音效
prefix字符串""文字前缀
suffix字符串""文字后缀
icon字符串/nullnull图标纹理路径
iconPosition字符串"left"图标位置:"left""right"
iconOffsetX浮点数0图标水平微调像素偏移
iconOffsetY浮点数0图标垂直微调像素偏移
killText字符串/nullnullkill 型跳字显示的文本(替代伤害数字)
bypassDisplayOpacity布尔值falsetrue 时无视全局 displayOpacity 配置
animation对象动画配置(见下文)
damageScale对象伤害大小缩放(见下文)

颜色系统

固定色

十六进制 RGB 格式:

json
"color": "#FF4444"

也支持 ARGB 格式(含透明度):

json
"color": "#80FF4444"

彩虹色

json
"color": "rainbow:speed:10"
  • speed 参数控制色相旋转速度(每 tick 偏移的度数)
  • 值越大颜色变化越快
  • 每 tick 色相自动偏移,产生流动的彩虹效果

字体样式

效果
"normal"普通字体
"bold"粗体
"italic"斜体
"bold_italic"粗斜体

前缀与后缀

json
"prefix": "-",
"suffix": " ❤"

渲染效果示例:-128 ❤

图标

图标显示在文字旁边,按 Minecraft 纹理路径指定:

json
"icon": "minecraft:textures/particle/angry.png",
"iconPosition": "right",
"iconOffsetX": 0,
"iconOffsetY": 4
参数说明
icon纹理路径,格式 命名空间:textures/...
iconPosition"left"(文字左边)或 "right"(文字右边)
iconOffsetX水平微调(正=右移,负=左移)
iconOffsetY垂直微调(正=下移,负=上移)

音效

跳字出现时播放的音效,使用 Minecraft 音效 ID:

json
"sound": "minecraft:entity.player.hurt"

设为 null 则不播放音效。

damageScale — 伤害大小缩放

根据伤害数值自动放大字体和延长停留时间,伤害越高字越大、停留越久。

json
"damageScale": {
  "enabled": true,
  "baseFontSize": 1.0,
  "stepSize": 10,
  "sizeOffsetPerStep": 1,
  "maxSize": 2.5,
  "holdBase": 0,
  "holdOffsetPerStep": 10,
  "holdMax": 20
}
参数类型默认值说明
enabled布尔值true是否启用
baseFontSize浮点数1.0基础字体大小倍率(伤害为 0 时)
stepSize浮点数10每步对应多少伤害值
sizeOffsetPerStep浮点数1每步增加的字体大小
maxSize浮点数2.5最大字体大小倍率
holdBase浮点数0基础额外停留 tick 数
holdOffsetPerStep浮点数10每步增加的停留 tick 数
holdMax浮点数20最大额外停留 tick 数

计算公式

字体大小 = clamp(baseFontSize + (伤害值 / stepSize) × sizeOffsetPerStep, baseFontSize, maxSize)
停留增量 = clamp(round((伤害值 / stepSize) × holdOffsetPerStep), 0, holdMax - holdBase)

最终停留时间 = 动画中的 hold + 停留增量。

killText — 击杀文字

当伤害类型为 "kill"(致命伤害)时,跳字不显示伤害数字,而是显示 killText 字段的值:

json
"killText": "击杀!"

设为 null 则正常显示伤害数字。

关于如何配置 kill 伪伤害类型 → 配置文件说明

完整样式示例

默认样式 (default.json)

白色粗体、向上浮动、淡入淡出、随伤害放大:

json
{
  "color": "#FFFFFF",
  "fontSize": 1,
  "fontStyle": "bold",
  "shadow": true,
  "outlineColor": null,
  "prefix": "",
  "suffix": "",
  "icon": "",
  "sound": null,
  "killText": "kill!",
  "iconPosition": "right",
  "iconOffsetX": 0,
  "iconOffsetY": 4,
  "damageScale": {
    "enabled": true,
    "baseFontSize": 1.0,
    "stepSize": 10,
    "sizeOffsetPerStep": 1,
    "maxSize": 2.5,
    "holdBase": 0,
    "holdOffsetPerStep": 10,
    "holdMax": 20
  },
  "animation": {
    "hold": 5,
    "position": {
      "enter": {
        "type": "normal",
        "duration": 5,
        "easing": { "in": false, "out": true },
        "startOffset": { "type": "xy", "x": { "base": 2, "random": [-2, 2] }, "y": { "base": 2, "random": [-2, 2] } },
        "targetOffset": { "type": "direction", "angle": { "base": 90, "random": [-1, 1] }, "distance": { "base": 20, "random": [-2, 2] } }
      },
      "exit": { "type": "none" }
    },
    "size": {
      "enter": {
        "type": "normal",
        "duration": 5,
        "easing": { "in": true, "out": true },
        "startOffset": -0.6,
        "targetOffset": 0
      },
      "exit": {
        "type": "normal",
        "duration": 10,
        "easing": { "in": true, "out": false },
        "targetOffset": -1
      }
    },
    "brightness": {
      "enter": { "type": "none" },
      "exit": { "type": "none" }
    },
    "opacity": {
      "enter": {
        "type": "normal",
        "duration": 5,
        "easing": { "in": true, "out": true },
        "startOpacity": 0,
        "targetOpacity": 1
      },
      "exit": {
        "type": "normal",
        "duration": 10,
        "easing": { "in": true, "out": false },
        "targetOpacity": 0
      }
    }
  }
}

火焰伤害样式 (fire.json)

橙色文字 + 跳动动画 + 🔥 后缀:

json
{
  "color": "#FF6600",
  "fontSize": 1.1,
  "fontStyle": "bold",
  "shadow": true,
  "outlineColor": "#331100",
  "suffix": "🔥",
  "animation": {
    "hold": 10,
    "position": {
      "enter": {
        "type": "normal",
        "duration": 6,
        "easing": { "in": false, "out": true },
        "startOffset": { "type": "direction", "angle": -70, "distance": { "base": 8, "random": 0.5 } },
        "targetOffset": { "type": "xy", "x": { "base": 0, "random": [-0.2, 0.2] }, "y": 0 }
      },
      "exit": { "type": "none" }
    },
    "size": {
      "enter": {
        "type": "normal",
        "duration": 4,
        "easing": { "in": true, "out": true },
        "startOffset": 0.5,
        "targetOffset": 0
      },
      "exit": {
        "type": "normal",
        "duration": 8,
        "easing": { "in": true, "out": true },
        "targetOffset": -0.3
      }
    },
    "opacity": {
      "enter": {
        "type": "normal",
        "duration": 6,
        "easing": { "in": true, "out": true },
        "startOpacity": 0,
        "targetOpacity": 1
      },
      "exit": {
        "type": "normal",
        "duration": 10,
        "easing": { "in": true, "out": true },
        "targetOpacity": 0
      }
    }
  }
}

魔法伤害样式 (magic.json)

紫色闪烁文字 + ✦ 后缀:

json
{
  "color": "rainbow:speed:5",
  "fontSize": 1.2,
  "fontStyle": "italic",
  "shadow": true,
  "outlineColor": "#6600AA",
  "suffix": " ✦",
  "animation": {
    "hold": 8,
    "position": {
      "enter": {
        "type": "normal",
        "duration": 10,
        "easing": { "in": true, "out": false },
        "startOffset": { "type": "direction", "angle": -90, "distance": 20 },
        "targetOffset": { "type": "xy", "x": 0, "y": 0 }
      },
      "exit": {
        "type": "normal",
        "duration": 15,
        "easing": { "in": true, "out": true },
        "targetOffset": { "type": "direction", "angle": -60, "distance": 30 }
      }
    },
    "brightness": {
      "enter": {
        "type": "normal",
        "duration": 8,
        "easing": { "in": true, "out": true },
        "startOffset": 0.3
      },
      "exit": {
        "type": "normal",
        "duration": 10,
        "easing": { "in": true, "out": true },
        "targetOffset": -0.2
      }
    },
    "opacity": {
      "enter": {
        "type": "normal",
        "duration": 6,
        "easing": { "in": true, "out": true },
        "startOpacity": 0,
        "targetOpacity": 1
      },
      "exit": {
        "type": "normal",
        "duration": 15,
        "easing": { "in": true, "out": true },
        "targetOpacity": 0
      }
    }
  }
}

基于 MIT 许可发布