Appearance
spool / MobBuilder
Interface: MobBuilder<S> โ
Defined in: plugins/mob/builder.ts:19
Builds a custom mob: a vanilla mob does the AI, with a display-entity model riding it.
const sentinel = defineMob(Husk({ ... }), rig()).relayHits(4).build("sentinel"); sentinel.register(dp); // then run sentinel.wake once a second and sentinel.tick(ctx) every 2 ticks
It handles what riding doesn't:
- Yaw: the mob's rotation is copied to the rig.
- Reach: relayHits turns hits on a
Display.hitbox(...)into damage on the mob. - Death: rigs whose mob is gone are removed.
Type Parameters โ
S โ
S extends string = never
Methods โ
build() โ
build(
name,opts?):Mob<S>
Defined in: plugins/mob/builder.ts:73
The Mob named name (its tag and function folder). Throws if a gesture's timings don't fit.
Parameters โ
name โ
string
opts? โ
MobOptions = {}
Returns โ
Mob<S>
gesture() โ
gesture(
name,g):this
Defined in: plugins/mob/builder.ts:49
Adds a gesture as a <mob>/<name> function, plus a trigger if it has when.
Parameters โ
name โ
string
g โ
Gesture<S>
Returns โ
this
onDifficulty() โ
onDifficulty(
body):this
Defined in: plugins/mob/builder.ts:43
Runs body as each mob at summon, and on every live mob within a second of the difficulty changing.
Where attribute modifiers go; remove before adding, since re-adding an existing modifier fails. Needs the difficulty(dp) score seeded.
Parameters โ
body โ
MobDifficulty
Returns โ
this
onTick() โ
onTick(
body):this
Defined in: plugins/mob/builder.ts:67
Your per-tick behaviour, run as and at each awake mob, so use @s.
Runs before gestures and the yaw copy. Emitted as <mob>/on_tick (onTickFn), which is what to pass to dp.allowNbtRead.
Parameters โ
body โ
MobTick<S>
Returns โ
this
relayHits() โ
relayHits(
damage,type?):this
Defined in: plugins/mob/builder.ts:32
Turns hits on the model's hitbox into damage on the mob. The model needs a hitbox.
Parameters โ
damage โ
number
type? โ
DamageType
Returns โ
this
states() โ
states<
T>(defs):MobBuilder<T>
Defined in: plugins/mob/builder.ts:55
The mob's states by name. Declare before gestures and onTick so state names are typed.
Type Parameters โ
T โ
T extends string
Parameters โ
defs โ
Record<T, MobState<NoInfer<T>>>
Returns โ
MobBuilder<T>