API reference / @jsprismarine/entity-brains / TemptingSensor
Class: TemptingSensor
Defined in: sensing/sensors.ts:476
Java's TemptingSensor: the nearest player holding one of the mob's temptations.
Four of the 24 sensor types are this class with a different item predicate: food_temptations (the animal's own isFood), frog_temptations (minecraft:frog_food), and nautilus_temptations (minecraft:nautilus_food). The range is minecraft:tempt_range, not follow range, and the targeting ignores line of sight.
Extends
Constructors
Constructor
new TemptingSensor(
isTemptation):TemptingSensor
Defined in: sensing/sensors.ts:480
Parameters
isTemptation
(item, context) => boolean
Returns
TemptingSensor
Overrides
Properties
name
readonlyname:"TemptingSensor"='TemptingSensor'
Defined in: sensing/sensors.ts:477
The Java class name, which is what a debug read-out shows.
Overrides
requires
readonlyrequires: readonlyMemoryModuleType<unknown>[]
Defined in: sensing/sensors.ts:478
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
Inherited from
forAnimal()
staticforAnimal(isFood):TemptingSensor
Defined in: sensing/sensors.ts:485
Java's TemptingSensor.forAnimal, which defers to the animal's own isFood.
Parameters
isFood
(item) => boolean
Returns
TemptingSensor
forTag()
staticforTag(tag):TemptingSensor
Defined in: sensing/sensors.ts:490
The frog_temptations and nautilus_temptations form: one item tag.
Parameters
tag
string
Returns
TemptingSensor