Documentation

EffectManager
in package

Table of Contents

$bubbleColor  : Color
$effectAddHooks  : array<string|int, Closure>|ObjectSet
$effectRemoveHooks  : array<string|int, Closure>|ObjectSet
$effects  : array<string|int, EffectInstance>
$onlyAmbientEffects  : bool
$entity  : Living
__construct()  : mixed
add()  : bool
Adds an effect to the mob.
all()  : array<string|int, EffectInstance>
Returns an array of Effects currently active on the mob.
clear()  : void
Removes all effects from the mob.
get()  : EffectInstance|null
Returns the effect instance active on this entity with the specified ID, or null if the mob does not have the effect.
getBubbleColor()  : Color
getEffectAddHooks()  : array<string|int, Closure>|ObjectSet
getEffectRemoveHooks()  : array<string|int, Closure>|ObjectSet
has()  : bool
Returns whether the specified effect is active on the mob.
hasOnlyAmbientEffects()  : bool
remove()  : void
Removes the effect with the specified ID from the mob.
tick()  : bool
recalculateEffectColor()  : void
Recalculates the mob's potion bubbles colour based on the active effects.

Properties

$effectAddHooks

protected array<string|int, Closure>|ObjectSet $effectAddHooks
Tags
phpstan-var

ObjectSet<\Closure(EffectInstance, bool $replacesOldEffect) : void>

$effectRemoveHooks

protected array<string|int, Closure>|ObjectSet $effectRemoveHooks
Tags
phpstan-var

ObjectSet<\Closure(EffectInstance) : void>

$onlyAmbientEffects

protected bool $onlyAmbientEffects = false

Methods

add()

Adds an effect to the mob.

public add(EffectInstance $effect) : bool

If a weaker effect of the same type is already applied, it will be replaced. If a weaker or equal-strength effect is already applied but has a shorter duration, it will be replaced.

Parameters
$effect : EffectInstance
Return values
bool

whether the effect has been successfully applied.

clear()

Removes all effects from the mob.

public clear() : void
Return values
void

getEffectAddHooks()

public getEffectAddHooks() : array<string|int, Closure>|ObjectSet
Tags
phpstan-return

ObjectSet<\Closure(EffectInstance, bool $replacesOldEffect) : void>

Return values
array<string|int, Closure>|ObjectSet

getEffectRemoveHooks()

public getEffectRemoveHooks() : array<string|int, Closure>|ObjectSet
Tags
phpstan-return

ObjectSet<\Closure(EffectInstance) : void>

Return values
array<string|int, Closure>|ObjectSet

has()

Returns whether the specified effect is active on the mob.

public has(Effect $effect) : bool
Parameters
$effect : Effect
Return values
bool

hasOnlyAmbientEffects()

public hasOnlyAmbientEffects() : bool
Return values
bool

remove()

Removes the effect with the specified ID from the mob.

public remove(Effect $effectType) : void
Parameters
$effectType : Effect
Return values
void

tick()

public tick([int $tickDiff = 1 ]) : bool
Parameters
$tickDiff : int = 1
Return values
bool

recalculateEffectColor()

Recalculates the mob's potion bubbles colour based on the active effects.

protected recalculateEffectColor() : void
Return values
void

Search results