Skip to content

Rules ​

Everything a modpack changes about a death is a rule: a match key, optional conditions on the player's progress, and the actions - name, tip, death message, triggers, ignore, hide. With conditions a rule has two sets of actions: one for when they are met and one for when they are not met.

The server decides. It evaluates the rules for each player whenever it builds an output and sends only the finished result, so hidden information never reaches the client. There is no tick work.

A first rule ​

Before the advancement: the attacker is hidden as ???, no tipAfter the advancement: the same death with the attacker, its name from the pack and the tip

config/whathitme/pack/rules/bosses.json:

json
{
  "rules": [
    {
      "match": "*@minecraft:wither_skeleton",
      "if": ["advancement:minecraft:nether/find_fortress"],
      "then": {
        "name": "&8Ashen Sentinel",
        "hint": "Its blade inflicts Wither. Carry a bucket of milk."
      },
      "else": {
        "name": "???",
        "hide": ["attacker", "mod", "weapon", "tip"]
      },
      "memo": "Unknown until the fortress is found"
    }
  ]
}

Until the player has found a fortress, the wither skeleton's hits are named ??? and the attacker, mod, weapon and tip are removed before anything is sent. Afterwards they show "Ashen Sentinel" with the tip, including old entries in /whm, because rules are evaluated every time an output is built.

Check it: /whm reload, then

/whm test mob:minecraft:wither_skeleton --as Steve
/whm test mob:minecraft:wither_skeleton --as Steve --assume advancement:minecraft:nether/find_fortress

In game, the same rule in the pack editor:

The rule in the pack editor: match key, condition, "Conditions met" and "Conditions not met" columns

Rule fields ​

FieldTypeMeaning
matchstring, requiredMatch key of the record: damage id, @entity, @item:, @dim:, wildcards. "*" matches every damage.
ifcondition or listAll of these must be true
anycondition or listAt least one must be true
unlesscondition or listNone of these may be true
thenactionsWithout conditions: always used. With conditions: used when they are met.
elseactionsOnly with conditions: used when they are not met
memostringYour note, never shown to players
enabledbooleanfalse keeps the rule in the file but does not use it ("Rule on" in the editor)

Actions ​

ActionTypeMeaning
namestringThe name shown for the hit. Template variables, & colors, lang: keys. (Names, tips, ignore & hide)
hintstringThe tip. Same syntax.
deathMessagestringThe death message of a death by this hit (Death messages)
triggersobject{ "commands": [...], "oncePerPlayer": false, "cooldownSeconds": 0 } - console commands on a matching death (Triggers)
ignorebooleantrue: hidden like the [Mute] button, also left out of totals, counts and /whm stats (the killing blow too). false: explicitly not ignored.
hidelistParts shown as ??? and never sent (hide)

An empty or missing action is "not set": the next rule (or the built-in behaviour) decides that field. "hint": "" does not remove the tip; use "hide": ["tip"].

Priority ​

The rules of all pack files form one list: files in load order, rules in the order inside each file (the pack editor's arrows move them). Rules added by scripts come after the files.

For every field separately, the first rule from the top wins whose match key fits and whose active branch sets that field:

json
"rules": [
  { "match": "*@minecraft:wither", "then": { "name": "&5The Withered King" } },
  { "match": "*@minecraft:*",      "then": { "hint": "Bosses hit hard: bring a shield." } },
  { "match": "*",                  "then": { "deathMessage": "{player} was defeated by {name}" } }
]

A death by the Wither gets its name from rule 1, its tip from rule 2 and its death message from rule 3. Put special rules above general ones; there is no "most specific wins". How wildcard rules and exact rules interact: Wildcards: order and priority.

  • hide counts as one field: the first rule that hides something decides the whole list.
  • triggers: only the first rule with triggers runs for a death.
  • ignore: false is a value: it stops later rules from ignoring the damage.
  • A rule whose conditions are not met and that has no else sets nothing; later rules decide.

The preview ​

The pack editor shows, at the end of every rule, "For this hit it becomes:" - the same output as /whm test for that match key, with the rule each field comes from:

The preview: which rule sets the name and the tip, and the chat summary

Pick the player whose progress to use (As) and type conditions to treat as met, then Test. The preview shows the saved rules: press Done first after a change.

When rules are evaluated ​

Whenever the server builds an output for a player:

  • death recap, respawn summary, alerts,
  • /whm history, last, snapshot, inspect (with the inspected player's progress),
  • /whm search entries,
  • template previews,
  • death messages and triggers.

Nothing is cached between outputs, so completing a quest reveals old entries at once.

Players and personal entries ​

  • A player's personal name, tip or hidden damage (personal mode, [Mute]) wins over a rule's name / tip, unless the active branch hides something (then personal names, tips and templates do not apply to that record), or the modpack locks personal entries.
  • Players without the mod get the server's English chat with the rules applied. On Forge / NeoForge the vanilla death message cannot be changed for them, so a hidden killer may still appear there. Use requireClientMod if that matters. Fabric servers replace the death message for everyone.

Requirements

Rules need the mod on the server (or single player). In client-only mode the client's own pack gives names, tips and ignore; conditions count as not met and nothing is hidden.

More examples ​

See the Cookbook for ready-to-copy rules: hide everything in a dimension until it is unlocked, tips that change after a few deaths, FTB Quests and Game Stages examples, a reward on the first death to a boss.

Made by junjun1z. The mods are MIT licensed.