Skip to content

API reference / @jsprismarine/entity-brains / NearestLivingEntitySensor

Class: NearestLivingEntitySensor ​

Defined in: sensing/sensors.ts:37

Java's NearestLivingEntitySensor: the base every "what is around me" memory is built on.

It writes both NEAREST_LIVING_ENTITIES, the distance-sorted list, and NEAREST_VISIBLE_LIVING_ENTITIES, the line-of-sight-filtered view over it. Nine other sensors read those two rather than scanning again.

Extends ​

Extended by ​

Constructors ​

Constructor ​

new NearestLivingEntitySensor(scanRate?): NearestLivingEntitySensor

Defined in: sensing/sensor.ts:33

Parameters ​

scanRate? ​

number = DEFAULT_SCAN_RATE

Returns ​

NearestLivingEntitySensor

Inherited from ​

Sensor.constructor

Properties ​

name ​

readonly name: string = 'NearestLivingEntitySensor'

Defined in: sensing/sensors.ts:38

The Java class name, which is what a debug read-out shows.

Overrides ​

Sensor.name


scanRate ​

readonly scanRate: number = DEFAULT_SCAN_RATE

Defined in: sensing/sensor.ts:33

Inherited from ​

Sensor.scanRate

Accessors ​

requires ​

Get Signature ​

get requires(): readonly MemoryModuleType<unknown>[]

Defined in: sensing/sensors.ts:40

Every memory the sensor writes. The brain registers each one when the sensor is added.

Returns ​

readonly MemoryModuleType<unknown>[]

Every memory the sensor writes. The brain registers each one when the sensor is added.

Overrides ​

Sensor.requires

Methods ​

randomlyDelayStart() ​

randomlyDelayStart(randomInt): void

Defined in: sensing/sensor.ts:36

Java's randomlyDelayStart: offsets the first scan into [0, scanRate).

Parameters ​

randomInt ​

(bound) => number

Returns ​

void

Inherited from ​

Sensor.randomlyDelayStart


tick() ​

tick(context): void

Defined in: sensing/sensor.ts:41

Counts down and scans when the countdown reaches zero.

Parameters ​

context ​

BrainContext

Returns ​

void

Inherited from ​

Sensor.tick