Skip to content

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 ​

Sensor.constructor

Properties ​

name ​

readonly name: "TemptingSensor" = 'TemptingSensor'

Defined in: sensing/sensors.ts:477

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

Overrides ​

Sensor.name


requires ​

readonly requires: readonly MemoryModuleType<unknown>[]

Defined in: sensing/sensors.ts:478

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

Overrides ​

Sensor.requires


scanRate ​

readonly scanRate: number = DEFAULT_SCAN_RATE

Defined in: sensing/sensor.ts:33

Inherited from ​

Sensor.scanRate

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


forAnimal() ​

static forAnimal(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() ​

static forTag(tag): TemptingSensor

Defined in: sensing/sensors.ts:490

The frog_temptations and nautilus_temptations form: one item tag.

Parameters ​

tag ​

string

Returns ​

TemptingSensor