Skip to main content
A trigger decides when an effect line runs. It’s the part prefixed with #: yaml
If a line has no trigger, it defaults to #onSpawn.
~ also works as a trigger prefix (~onHurt) if you prefer it over #.

Available triggers

Triggers set the target

Each trigger defines who @target points to. That’s what makes lines like these work:
Two things to keep in mind:
  • #onSpawn has no target. A spawn isn’t caused by any entity, so @target resolves to nothing there. Use @self, @playersRadius[N] or @world instead.
  • The target can be empty even on other triggers. A mob that dies to fall damage has no killer, so an #onDeath @target line simply does nothing. Environmental damage on #onHurt behaves the same way.

One trigger, many lines

Multiple lines can share a trigger. They run in order:

Where triggers apply

Triggers only exist on a mob’s effects: list. Lines inside named effects never carry a trigger of their own: they inherit the moment they were called from. The run line has the trigger, the named effect just executes.