API reference / @jsprismarine/entity-brains / GateBehavior
Class: GateBehavior
Defined in: behavior/gate.ts:69
Java's GateBehavior.
A gate is running while at least one of its children is. tickOrStop ticks every running child and stops the gate once none of them is left, so a run_one gate ends when its chosen child ends, and a try_all gate ends when the last of them does.
Extended by
Implements
Constructors
Constructor
new GateBehavior(
orderPolicy,runningPolicy,behaviors,options?):GateBehavior
Defined in: behavior/gate.ts:78
Parameters
orderPolicy
runningPolicy
behaviors
readonly WeightedBehavior[]
options?
GateOptions = {}
Returns
GateBehavior
Properties
name
readonlyname:string
Defined in: behavior/gate.ts:70
The Java class name, which is what a debug read-out shows.
Implementation of
Accessors
requiredMemories
Get Signature
get requiredMemories(): readonly
MemoryModuleType<unknown>[]
Defined in: behavior/gate.ts:97
Every memory the behavior reads or writes. The brain registers each one when the behavior is added, which is how a memory a mob never declares still gets a slot.
Returns
readonly MemoryModuleType<unknown>[]
Every memory the behavior reads or writes. The brain registers each one when the behavior is added, which is how a memory a mob never declares still gets a slot.
Implementation of
BehaviorControl.requiredMemories
status
Get Signature
get status():
BehaviorStatus
Defined in: behavior/gate.ts:93
Returns
Implementation of
Methods
doStop()
doStop(
context,timestamp):void
Defined in: behavior/gate.ts:145
Stops every running child and erases the gate's exitErasedMemories.
Parameters
context
timestamp
number
Returns
void
Implementation of
tickOrStop()
tickOrStop(
context,timestamp):void
Defined in: behavior/gate.ts:133
Ticks every running child and stops the gate once none is left running.
Parameters
context
timestamp
number
Returns
void
Implementation of
tryStart()
tryStart(
context,timestamp):boolean
Defined in: behavior/gate.ts:111
Checks the gate's own memory conditions, reorders the children when the policy is shuffled, then starts them until one takes under run_one, or all of them have been tried under try_all.
Parameters
context
timestamp
number
Returns
boolean