玩家伤害反馈
看到你受到的伤害,以及你对其他玩家造成的伤害。 每当一名玩家受伤时,都会弹出一个数字——受害者总是能看到它,如果是由另一名玩家造成的攻击,该攻击者也能看到。从设计层面就支持多人联机:服务器会向每个客户端精确发送其被允许看到的内容。
这个模组做什么?
仅限玩家的伤害数值
大多数显示伤害数值的模组会在任何受到伤害的目标上方显示浮动数字——僵尸、牛、物品展示框等皆是如此。而这个模组只做一件事:玩家。当一名玩家受到伤害时,其头顶会出现一个数字。
两种视角,两种颜色
- 受害者始终能看到自己受到的伤害(默认为红色)。
- 攻击者(如果攻击来自另一名玩家)能看到自己造成的伤害(默认为白色)——这样 PvP 终于能给你一个需要反应的数值,而不是去猜测一个你甚至看不见的血条。
两种颜色均可自定义配置;如果你只想让玩家看到自己受到的伤害,也可以完全关闭攻击者的视图。
真正安全的多联机兼容
服务器监控真实的伤害事件——在护甲、附魔和吸收效果全部结算之后——并向有权查看结果的客户端发送一个小数据包。没有基于血条变化的客户端推测,因此你看到的数字就是实际发生的数字,而未安装此模组的玩家则不会收到任何额外数据。
配置
config/player_damage_feedback-client.toml(仅客户端,不影响平衡)
# 总开关
enabled = true
# 当你击中敌人时,也在其头顶显示伤害数值
showToAttacker = true
大小:
# 不是像素。伤害数字是直接渲染在游戏世界中的 3D 文字广告牌(类似名称标签),因此这是世界空间的比例缩放乘数。
# 1.0 = 近距离时的正常可读大小。
# 0.5 = 一半大小,2.0 = 两倍大小。
size = 1.0
时间与运动:
# 数字在屏幕上停留的时间,单位为游戏刻(20 刻 = 1 秒)
lifetimeTicks = 40
# 在重力将其拉回之前的初始上升速度,单位为每刻方块数
riseSpeed = 0.09
# 随机水平偏移量,单位为方块,防止连续命中完全重叠
horizontalSpread = 0.3
颜色(十六进制 RGB):
# 当你受到伤害时数字的颜色
colorTaken = "#FF5555"
# 当你造成伤害时,敌人头顶数字的颜色
colorDealt = "#FFFFFF"
工作原理
- 一名玩家受到伤害。Forge 在解决所有减伤后在服务端触发
LivingDamageEvent。
- 服务端将最终数值发送给受害者的客户端。
- 如果伤害来源是另一名玩家,服务端也会将该数值发送给攻击者的客户端。
- 每个客户端检查自身配置,并在允许的情况下在受害者头顶生成一个浮动数字——渲染为始终面向摄像机的广告牌,带有轻微的重力效果上下浮动,并随时间推移淡出消失。
无需 Mixin,无需 vanilla 粒子注册表,无需客户端检测技巧——仅靠一个事件、一种数据包类型,以及在世界的粒子渲染阶段直接进行渲染。
依赖
为了获得完整体验,请在客户端和服务端都安装此模组——连接到运行此模组的服务端的原版客户端将无法接收到额外数据包,而在原版服务器上运行的模组客户端也将没有任何内容可接收。
致谢
- 灵感来源于 damagenumbers(作者:Lua / foxgirl.dev)——一款优秀的通用生物伤害数值模组。本模组弥补了纯客户端模组无法做到的一件事:告知攻击者他们对另一名玩家造成了多少伤害。
Player Damage Feedback
See the damage you take, and the damage you deal to other players. A number pops up whenever a player is hurt - the victim always sees it, and if another player landed the hit, that player sees it too. Multiplayer-correct by design: the server tells each client exactly what it's allowed to see.
What does this mod do?
Damage numbers, scoped to players
Most damage-number mods show a floating number over anything that gets hurt - zombies, cows, item frames, all of it. This mod does one thing: players. When a player takes damage, a number appears above them.
Two viewers, two colors
- The victim always sees the damage they took (red by default).
- The attacker, if the hit came from another player, sees the damage they dealt (white by default) - so PvP finally gives you a number to react to instead of guessing from a health bar you can't even see.
Both colors are configurable, and the attacker's view can be turned off entirely if you only want players to see their own damage.
Actually multiplayer-safe
The server watches the real damage event - after armor, enchantments, and absorption are all applied - and sends a tiny packet to whoever is allowed to see the result. There's no client-side guessing based on health-bar changes, so the number you see is always the number that actually happened, and a player without the mod simply doesn't receive anything extra.
Configuration
config/player_damage_feedback-client.toml (client-side, no balance impact)
# Master on/off switch
enabled = true
# Also show a number above the enemy when YOU hit them
showToAttacker = true
Size:
# NOT pixels. Damage numbers are 3D text billboards rendered directly in the
# game world (like a nameplate), so this is a world-space scale multiplier.
# 1.0 = normal readable size at close range.
# 0.5 = half size, 2.0 = double size.
size = 1.0
Timing and motion:
# How long a number stays on screen, in game ticks (20 ticks = 1 second)
lifetimeTicks = 40
# Initial upward speed in blocks per tick, before gravity pulls it back down
riseSpeed = 0.09
# Random horizontal offset in blocks, so repeated hits don't fully overlap
horizontalSpread = 0.3
Colors (hex RGB):
# Color of the number when YOU take damage
colorTaken = "#FF5555"
# Color of the number above an enemy when YOU deal the damage
colorDealt = "#FFFFFF"
How it works
- A player takes damage. Forge fires
LivingDamageEvent on the server, after all mitigation is resolved.
- The server sends the final amount to the victim's client.
- If the source of the damage was another player, the server also sends it to the attacker's client.
- Each client checks its own config and, if allowed, spawns a floating number above the victim - rendered as a billboard that always faces the camera, rising and falling with a bit of gravity, fading out over its lifetime.
No mixins, no vanilla particle registry, no client-side detection tricks - just one event, one packet type, and direct rendering during the world's particle pass.
Requirements
Install on both the client and the server for the full experience - a vanilla client connecting to a server running this mod simply won't get the extra packets, and a modded client on a vanilla server won't have anything to receive.
Credits
- Inspired by damagenumbers by Lua (foxgirl.dev) - a great mod for general mob damage numbers. This mod covers the one thing a purely client-side mod can't: telling an attacking player how much damage they dealt to another player.
评论 0
登录后参与评分
还没有评论,来抢沙发吧