Skip to content

API reference / @jsprismarine/entity-brains / TestNavigation

Class: TestNavigation ​

Defined in: testWorld.ts:115

Records every navigation call so a test can assert on movement without a path finder.

Implements ​

Constructors ​

Constructor ​

new TestNavigation(): TestNavigation

Returns ​

TestNavigation

Properties ​

done ​

done: boolean = true

Defined in: testWorld.ts:121


moves ​

readonly moves: object[] = []

Defined in: testWorld.ts:117

Every moveTo call, in order.

speedModifier ​

speedModifier: number

target ​

target: Vec3


stopped ​

stopped: number = 0

Defined in: testWorld.ts:118


stuck ​

stuck: boolean = false

Defined in: testWorld.ts:122


unreachable ​

readonly unreachable: Vec3[] = []

Defined in: testWorld.ts:120

Positions canReach and moveTo refuse. A test adds one to make a target unreachable.

Accessors ​

lastMove ​

Get Signature ​

get lastMove(): { speedModifier: number; target: Vec3; } | undefined

Defined in: testWorld.ts:156

The last position the mob was told to walk to.

Returns ​

{ speedModifier: number; target: Vec3; } | undefined

Methods ​

canReach() ​

canReach(target): boolean

Defined in: testWorld.ts:145

True unless the target is listed in TestNavigation.unreachable.

Parameters ​

target ​

Vec3

Returns ​

boolean

Implementation of ​

BrainNavigation.canReach


isDone() ​

isDone(): boolean

Defined in: testWorld.ts:135

False from the first accepted moveTo until stop, or until a test sets done.

Returns ​

boolean

Implementation of ​

BrainNavigation.isDone


isStuck() ​

isStuck(): boolean

Defined in: testWorld.ts:140

Whatever a test put in stuck. Nothing in the double sets it.

Returns ​

boolean

Implementation of ​

BrainNavigation.isStuck


moveTo() ​

moveTo(target, speedModifier): boolean

Defined in: testWorld.ts:125

Records the call and reports false for a target listed in TestNavigation.unreachable.

Parameters ​

target ​

Vec3

speedModifier ​

number

Returns ​

boolean

Implementation of ​

BrainNavigation.moveTo


stop() ​

stop(): void

Defined in: testWorld.ts:150

Counts the call in stopped and marks the path done.

Returns ​

void

Implementation of ​

BrainNavigation.stop