Appearance
spool / Mob
Interface: Mob<S> โ
Defined in: plugins/mob/emit/index.ts:22
A custom mob's codegen. register emits its functions; the caller runs wake once a second and tick every tickEvery ticks.
Type Parameters โ
S โ
S extends string = string
Accessors โ
gestures โ
Get Signature โ
get gestures():
Record<string,FunctionRef>
Defined in: plugins/mob/emit/index.ts:56
Each gesture's raise function, by name - call it as the mob.
Returns โ
Record<string, FunctionRef>
name โ
Get Signature โ
get name():
string
Defined in: plugins/mob/emit/index.ts:30
The mob's name: its tag and function folder.
Returns โ
string
onTickFn โ
Get Signature โ
get onTickFn():
FunctionRef
Defined in: plugins/mob/emit/index.ts:48
<name>/on_tick, the builder's onTick body. Throws if there isn't one.
Returns โ
FunctionRef
spawn โ
Get Signature โ
get spawn():
FunctionRef
Defined in: plugins/mob/emit/index.ts:44
<name>/spawn: summons one at the nearest player.
Returns โ
FunctionRef
states โ
Get Signature โ
get states():
Record<string,FunctionRef>
Defined in: plugins/mob/emit/index.ts:60
Each state's enter function, by name - call it as the mob.
Returns โ
Record<string, FunctionRef>
summon โ
Get Signature โ
get summon():
FunctionRef
Defined in: plugins/mob/emit/index.ts:40
<name>/summon: summons the mob wherever it is run.
Returns โ
FunctionRef
wake โ
Get Signature โ
get wake():
FunctionRef
Defined in: plugins/mob/emit/index.ts:52
<name>/wake: finds the mobs near players and sweeps orphaned rigs. Run once a second.
Returns โ
FunctionRef
Methods โ
fnRef() โ
fnRef(
short):FunctionRef
Defined in: plugins/mob/emit/index.ts:35
The generated function short. Throws before register.
Parameters โ
short โ
string
Returns โ
FunctionRef
freeze() โ
freeze(
ctx,who?):void
Defined in: plugins/mob/emit/index.ts:140
Turns off every loaded mob's AI, so it stands still while its tick is off. Undo with thaw.
who narrows it to some of the mobs; it is a factory because selectors mutate in place.
Parameters โ
ctx โ
FunctionContext
who? โ
() => Selector
Returns โ
void
preview() โ
preview():
MobPreview
Defined in: plugins/mob/emit/index.ts:65
The model and gesture timelines as plain data - what writeMobPreview renders.
Returns โ
MobPreview
register() โ
register(
dp,fn?,onSummon?):void
Defined in: plugins/mob/emit/index.ts:77
Emits the mob's functions into dp. Pass a group (dp.group("sentinel")) to keep them together.
fn creates the functions called from outside the tick tree (summon, gestures, wake), so a caller can wrap them, e.g. in a dimension. onSummon runs inside summon on the new mob, e.g. to freeze it while the caller's mobs are switched off.
Parameters โ
dp โ
Datapack
fn? โ
MobFn
onSummon? โ
(ctx, fresh) => void
Returns โ
void
thaw() โ
thaw(
ctx):void
Defined in: plugins/mob/emit/index.ts:150
Gives back the AI freeze took.
Parameters โ
ctx โ
FunctionContext
Returns โ
void
tick() โ
tick(
ctx):void
Defined in: plugins/mob/emit/index.ts:125
The per-tick poll. While no mob is near a player this costs a score check; scans run in wake.
Parameters โ
ctx โ
FunctionContext
Returns โ
void