Magical gene / no coat effect

Guardian

It does not start anything. But whatever hurts you, within sixteen blocks, has a horse to deal with — and it holds its ground rather than chasing.

Built, and not yet seen in game

The gene, its inheritance and its founder table exist and are covered by the test suite; the translator that turns it into behaviour was written against the 26.1.2 sources and is flagged unverified in its own comments. Nothing on this page has been watched happening to a horse. What to look at, and what is most likely to be wrong, is on To be verified.

What it does

CombinationOutcome
Grd/Grd, tamedattacks whatever damaged its owner, within 16 blocks
Grd/Grd, untamednothing — it has no owner to defend
anything elsenothing

How it differs from a gladiator

Gladiator attacks anything hostile that comes close, whether or not it concerns you, and stops when you mount. This attacks only what has actually hurt you, and works while you are riding. One is a guard dog; this is a bodyguard.

Health

It fights on your behalf, so it takes damage on your behalf. The same pairing with magic health applies.

Gene key
horsegenetics.guardian
Alleles
Grd guardian, n
Inheritance
homozygous recessive
Reaches the game as
a temper effect on an on_owner_hurt trigger
Coat effect
none, ever
The trigger fires on every damage event to every player in the world

on_owner_hurt is not a horse-tick effect — it hooks a global event, and on a populated server that event is constant. Early-out before any lookup: check cheaply whether this player owns any horse at all before touching genotypes, abilities or entity searches. Getting this wrong costs on every hit anyone takes anywhere.

PvP is a real behaviour change

A horse that retaliates against a player attacker changes what a fight is on a PvP server, and does it without either player agreeing to it. Gate the retaliation on the server’s PvP setting, and treat player targets as a separate decision from mob targets.

It holds a radius. It must never chase

A horse that pursues is a horse that dies forty blocks from its owner, and the owner blames the gene — correctly. Attack what comes within reach and return. Full pursuit and owner-leashed pursuit were both specified and both rejected in design; if a later session wants either, it is reopening a settled call, not filling a gap.

The trigger is shared with ender echo

on_hurt and on_owner_hurt are two new entries in a closed set of four. Ender echo wants the first; scheduling the two genes together means the trigger machinery is paid for twice.

Owner, not rider

It defends whoever tamed it, whether or not they are on it. A horse standing in a paddock that comes for the skeleton shooting at its owner across the fence is the behaviour people will remember, and gating on rider instead would throw it away for no gain.

The gene most likely to be somebody’s favourite

Of everything in the behaviour family, this is the one that reads least like a mechanic and most like a relationship — and it is the only locus in the mod whose trigger is something that happens to the player. It is worth the new trigger for that alone.

Planned source: common/genetics/genes/GuardianGene.java