Skip to content

helix / Trigger

Class: Trigger

Defined in: core/values/advancement.ts:17

One advancement trigger with its conditions, built from typed concepts (no hand-written JSON). The conditions are sourced from the same ItemValue you'd give, so an item's "fires when used/attacked with" check matches the exact item that was granted - one definition, like Predicate.

Trigger.usingItem(wand) // right-click / use of the item Trigger.playerHurtEntity(wand) // attacked something while holding it

Methods

toJson()

toJson(version): CriterionJson

Defined in: core/values/advancement.ts:21

The criterion JSON, with embedded item predicates rendered for version.

Parameters

version

VersionProfile

Returns

CriterionJson


of()

static of(trigger, conditions?): Trigger

Defined in: core/values/advancement.ts:50

Escape hatch: a trigger by id with already-built conditions.

Parameters

trigger

string

conditions?

Record<string, unknown>

Returns

Trigger


playerHurtEntity()

static playerHurtEntity(item, slot?): Trigger

Defined in: core/values/advancement.ts:42

minecraft:player_hurt_entity - fires when the player damages an entity while holding item in slot (default main hand). The held-item gate reuses Predicate.holding, so "attacked with this item" matches the same way "holding this item" does.

Parameters

item

ItemValue

slot?

"mainhand" | "offhand"

Returns

Trigger


usingItem()

static usingItem(item): Trigger

Defined in: core/values/advancement.ts:29

minecraft:using_item - fires while the player is using item (right-click on a usable item). The item condition is the item's own predicate form.

Parameters

item

ItemValue

Returns

Trigger

Released under the MIT License · Credits