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
$bubbleColor
protected
Color
$bubbleColor
$effectAddHooks
protected
array<string|int, Closure>|ObjectSet
$effectAddHooks
Tags
$effectRemoveHooks
protected
array<string|int, Closure>|ObjectSet
$effectRemoveHooks
Tags
$effects
protected
array<string|int, EffectInstance>
$effects
= []
$onlyAmbientEffects
protected
bool
$onlyAmbientEffects
= false
$entity
private
Living
$entity
Methods
__construct()
public
__construct(Living $entity) : mixed
Parameters
- $entity : Living
Return values
mixed —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.
all()
Returns an array of Effects currently active on the mob.
public
all() : array<string|int, EffectInstance>
Return values
array<string|int, EffectInstance> —clear()
Removes all effects from the mob.
public
clear() : void
Return values
void —get()
Returns the effect instance active on this entity with the specified ID, or null if the mob does not have the effect.
public
get(Effect $effect) : EffectInstance|null
Parameters
- $effect : Effect
Return values
EffectInstance|null —getBubbleColor()
public
getBubbleColor() : Color
Return values
Color —getEffectAddHooks()
public
getEffectAddHooks() : array<string|int, Closure>|ObjectSet
Tags
Return values
array<string|int, Closure>|ObjectSet —getEffectRemoveHooks()
public
getEffectRemoveHooks() : array<string|int, Closure>|ObjectSet
Tags
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