Skip to content

Death messages ​

Replace the vanilla death message ("Steve was slain by Zombie") with your own text for chosen deaths: the deathMessage action of a rule. Deaths without a rule that sets one keep the vanilla message.

Writing them ​

json
{
  "rules": [
    { "match": "mekanism:acid", "then": { "deathMessage": "{player} dissolved in acid" } },
    { "match": "*@twilightforest:lich", "if": ["advancement:twilightforest:progress_lich"],
      "then": { "deathMessage": "{player} was outsmarted by the Lich" },
      "else": { "deathMessage": "{player} met something in the dark" } },
    { "match": "minecraft:lava @dim:minecraft:the_nether", "then": { "deathMessage": "&c{player} became part of the Nether" } }
  ]
}
  • The first rule from the top that sets deathMessage for this death wins (priority); with conditions, met and not met can have different messages.
  • Values are one-line templates: every template variable, {var|fallback}, & colors and lang: keys.
  • lang: keys: on Forge / NeoForge each modded client translates the key (its language and resource packs). On Fabric 1.19.4+ the server sends the key as a translation, so every client with the key (a resource pack, a mod) sees its own text, also without What Hit Me?; clients without the key get the English text the server knows, or the key itself when the server does not know it either. Older Fabric versions send the server's English text. In translations use %1$s (player), %2$s (attacker) and %3$s (damage name) like vanilla death messages: {variables} are filled only where What Hit Me? renders the text itself.

Useful variables: {player}, {name}, {attacker_name}, {weapon}, {damage_name}, {dimension}, {death_message} (the vanilla text).

json
"mob:minecraft:zombie @item:*sword*": "{player} was cut down by {attacker_name} wielding {weapon|a blade}"

Support matrix ​

A custom death message on the death screen and in the chat (Fabric 1.21.1)

ServerPlayers with the modPlayers without the modDeath screenServer log
Fabric (every version)Custom messageCustom messageCustom messageCustom message
Forge / NeoForge (every version)Custom message (the client replaces the vanilla chat line)Vanilla messageCustom message (Forge 1.7.10: the death screen shows no message)[What Hit Me?] Death message: ... line

Why the difference? Fabric lets the mod change the message where the game builds it, so everyone gets it. Forge and NeoForge have no event for that, so the server sends the custom text to modded clients, which replace the matching chat line and the death screen text. Players without the mod keep the vanilla message.

Forge / NeoForge servers

If it matters that nobody sees the vanilla message (for example because a rule hides the killer), turn on requireClientMod. Otherwise the server logs a warning on start and on /whm reload.

The death recap (/whm last, the panel) quotes the message the player actually saw.

Hidden death messages ​

When a rule hides death_message and no rule sets a deathMessage, a neutral built-in message is used:

KillerMessage
An entity{player} was killed by {name} — {name} is the rule's name, e.g. ???
No entity{player} died

These are translated for players with the mod (10 languages). On Fabric they are sent as translations with an English fallback on 1.19.4+, and in English on older Fabric versions. Players without the mod see English.

A deathMessage set by a rule always wins over the built-in hidden message.

Testing ​

/whm test mekanism:acid
/whm test minecraft:generic twilightforest:lich --as Steve

/whm test and the preview of the pack editor show the death message that would be used and the rule it comes from.

Made by junjun1z. The mods are MIT licensed.