API reference / @jsprismarine/entity-brains / BehaviorBuilder
Class: BehaviorBuilder<Accessors>
Defined in: behavior/builder.ts:74
Accumulates memory requirements and then builds a OneShot.
The type parameter is the tuple of accessors the body receives, in declaration order.
Type Parameters
Accessors
Accessors extends readonly unknown[]
Methods
absent()
absent<
Value>(memory):BehaviorBuilder<readonly [Accessors,AbsentMemory<Value>]>
Defined in: behavior/builder.ts:112
The memory must be empty; the body gets an AbsentMemory it can fill.
Type Parameters
Value
Value
Parameters
memory
MemoryModuleType<Value>
Returns
BehaviorBuilder<readonly [Accessors, AbsentMemory<Value>]>
build()
build(
body):OneShot
Defined in: behavior/builder.ts:142
Closes the chain with the body.
Parameters
body
(context, ...accessors) => boolean
Returns
present()
present<
Value>(memory):BehaviorBuilder<readonly [Accessors,PresentMemory<Value>]>
Defined in: behavior/builder.ts:86
The memory must hold a value; the body gets a PresentMemory.
Type Parameters
Value
Value
Parameters
memory
MemoryModuleType<Value>
Returns
BehaviorBuilder<readonly [Accessors, PresentMemory<Value>]>
registered()
registered<
Value>(memory):BehaviorBuilder<readonly [Accessors,RegisteredMemory<Value>]>
Defined in: behavior/builder.ts:122
The memory need only exist; the body gets a RegisteredMemory.
Type Parameters
Value
Value
Parameters
memory
MemoryModuleType<Value>
Returns
BehaviorBuilder<readonly [Accessors, RegisteredMemory<Value>]>
named()
staticnamed(name):BehaviorBuilder<readonly []>
Defined in: behavior/builder.ts:81
Starts a chain. behavior is the shorthand.
Parameters
name
string
Returns
BehaviorBuilder<readonly []>