API reference / @jsprismarine/entity-brains / NearestItemSensor
Class: NearestItemSensor
Defined in: sensing/sensors.ts:110
Java's NearestItemSensor: the nearest visible item within 32 blocks the mob wants.
Java asks the mob itself through wantsToPickUp; this takes the predicate, which is where the piglin's gold rules and the allay's held-item match plug in.
Extends
Constructors
Constructor
new NearestItemSensor(
wantsToPickUp?):NearestItemSensor
Defined in: sensing/sensors.ts:114
Parameters
wantsToPickUp?
WantsToPickUp = ...
Returns
NearestItemSensor
Overrides
Properties
name
readonlyname:"NearestItemSensor"='NearestItemSensor'
Defined in: sensing/sensors.ts:111
The Java class name, which is what a debug read-out shows.
Overrides
requires
readonlyrequires: readonlyMemoryModuleType<unknown>[]
Defined in: sensing/sensors.ts:112
Every memory the sensor writes. The brain registers each one when the sensor is added.
Overrides
scanRate
readonlyscanRate:number=DEFAULT_SCAN_RATE
Defined in: sensing/sensor.ts:33
Inherited from
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
tick()
tick(
context):void
Defined in: sensing/sensor.ts:41
Counts down and scans when the countdown reaches zero.
Parameters
context
Returns
void