Appearance
twine / On
Function: On() โ
On(
detector,opts?):MethodDecorator
Defined in: twine/src/core/events/register.ts:31
Runs the decorated method when detector holds.
ts
@Module({ name: "stage1", area: true, tickEvery: 10 })
export class Stage1Module {
@On(Detect.in(THE_END, Detect.block(BUTTON_POS, PRESSED)), { own: true })
waterButton(ctx: FunctionContext) {
ctx.execute().in(THE_END).run((c) => c.setblock(GAP, Block.AIR));
}
}The method runs once at build time and emits commands, like other lifecycle hooks. For bodies on a helper object rather than the module class, use on / every.
Parameters โ
detector โ
Detector
opts? โ
OnOptions = {}
Returns โ
MethodDecorator