Skip to content

API reference / @jsprismarine/prismarine / entity/StatusEffectTick

entity/StatusEffectTick ​

Interfaces ​

StatusEffectHolder ​

Defined in: packages/prismarine/src/entity/StatusEffectTick.ts:72

What tickStatusEffects reads and writes of the holder of a set of effects.

Properties ​

age ​

readonly age: number

Defined in: packages/prismarine/src/entity/StatusEffectTick.ts:76

How many ticks the holder's effects have been ticked, the clock of an endless effect.

effects ​

readonly effects: Map<string, StatusEffect>

Defined in: packages/prismarine/src/entity/StatusEffectTick.ts:74

The holder's active effects by id, which the tick counts down in place.

Methods ​

apply() ​

apply(effect, clock): void

Defined in: packages/prismarine/src/entity/StatusEffectTick.ts:78

What one effect does on the holder this tick, such as Poison's damage.

Parameters ​
effect ​

StatusEffect

clock ​

number

Returns ​

void

remove() ​

remove(id): void

Defined in: packages/prismarine/src/entity/StatusEffectTick.ts:80

Takes one spent effect off the holder and tells clients.

Parameters ​
id ​

string

Returns ​

void

Type Aliases ​

EffectHealthChange ​

EffectHealthChange = { amount: number; kind: "heal"; } | { amount: number; cause: DamageCause; kind: "damage"; }

Defined in: packages/prismarine/src/entity/StatusEffectTick.ts:5

What one effect does to its holder's health on a tick it applies.

Functions ​

effectHealthChange() ​

effectHealthChange(id, amplifier, clock, health, maxHealth): EffectHealthChange | undefined

Defined in: packages/prismarine/src/entity/StatusEffectTick.ts:42

What an effect does to health on one tick, from the 26.3 server's MobEffect.applyEffectTick.

Healing and harm are in half-hearts. Poison stops at one half-heart and wither does not, and Bedrock's fatal poison is poison without the stop. Potency scales the instant effects by a left shift, so level two heals eight and level six heals 128.

Parameters ​

id ​

string

The namespaced effect id.

amplifier ​

number

One below the displayed level.

clock ​

number

What the repeat interval counts: the ticks the effect has left, or the holder's age for one that never expires.

health ​

number

The holder's health now.

maxHealth ​

number

The holder's maximum health.

Returns ​

EffectHealthChange | undefined

The change to apply this tick, or undefined when the effect does nothing to health now.


isInstantEffect() ​

isInstantEffect(id): boolean

Defined in: packages/prismarine/src/entity/StatusEffectTick.ts:17

Whether an effect applies once and is then spent, Java's InstantenousMobEffect.

Parameters ​

id ​

string

Returns ​

boolean


tickStatusEffects() ​

tickStatusEffects(holder): void

Defined in: packages/prismarine/src/entity/StatusEffectTick.ts:92

Applies the effects that act on the server, then counts finite ones down and takes off the ones that ran out.

Speed, jump boost, night vision and the like are the client's to apply once it has been told of the effect; what lands here is what changes health, food and the damage taken. An instant effect acts on the first tick and is spent, and an effect with a duration of one tick still acts before it expires.

Parameters ​

holder ​

StatusEffectHolder

Returns ​

void