PocketMine-MP 5.15.1 git-be6754494fdbbb9dd57c058ba0e33a4a78c4581f
pocketmine\entity\effect\EffectManager Class Reference
+ Collaboration diagram for pocketmine\entity\effect\EffectManager:

Public Member Functions

 __construct (private Living $entity)
 
 add (EffectInstance $effect)
 
 all ()
 
 clear ()
 
 get (Effect $effect)
 
 getBubbleColor ()
 
 getEffectAddHooks ()
 
 getEffectRemoveHooks ()
 
 has (Effect $effect)
 
 hasOnlyAmbientEffects ()
 
 remove (Effect $effectType)
 
 tick (int $tickDiff=1)
 

Protected Member Functions

 recalculateEffectColor ()
 

Protected Attributes

Color $bubbleColor
 
ObjectSet $effectAddHooks
 
ObjectSet $effectRemoveHooks
 
array $effects = []
 
bool $onlyAmbientEffects = false
 

Detailed Description

Definition at line 35 of file EffectManager.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\entity\effect\EffectManager::__construct ( private Living  $entity)

Definition at line 53 of file EffectManager.php.

Member Function Documentation

◆ add()

pocketmine\entity\effect\EffectManager::add ( EffectInstance  $effect)

Adds an effect to the mob. 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.

Returns
bool whether the effect has been successfully applied.

Definition at line 126 of file EffectManager.php.

◆ all()

pocketmine\entity\effect\EffectManager::all ( )

Returns an array of Effects currently active on the mob.

Returns
EffectInstance[]

Definition at line 65 of file EffectManager.php.

◆ clear()

pocketmine\entity\effect\EffectManager::clear ( )

Removes all effects from the mob.

Definition at line 72 of file EffectManager.php.

◆ get()

pocketmine\entity\effect\EffectManager::get ( Effect  $effect)

Returns the effect instance active on this entity with the specified ID, or null if the mob does not have the effect.

Definition at line 108 of file EffectManager.php.

◆ getBubbleColor()

pocketmine\entity\effect\EffectManager::getBubbleColor ( )

Definition at line 197 of file EffectManager.php.

◆ getEffectAddHooks()

pocketmine\entity\effect\EffectManager::getEffectAddHooks ( )
Returns
\Closure[]|ObjectSet @phpstan-return ObjectSet<\Closure(EffectInstance, bool $replacesOldEffect) : void>

Definition at line 224 of file EffectManager.php.

◆ getEffectRemoveHooks()

pocketmine\entity\effect\EffectManager::getEffectRemoveHooks ( )
Returns
\Closure[]|ObjectSet @phpstan-return ObjectSet<\Closure(EffectInstance) : void>

Definition at line 232 of file EffectManager.php.

◆ has()

pocketmine\entity\effect\EffectManager::has ( Effect  $effect)

Returns whether the specified effect is active on the mob.

Definition at line 115 of file EffectManager.php.

◆ hasOnlyAmbientEffects()

pocketmine\entity\effect\EffectManager::hasOnlyAmbientEffects ( )

Definition at line 201 of file EffectManager.php.

◆ recalculateEffectColor()

pocketmine\entity\effect\EffectManager::recalculateEffectColor ( )
protected

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

Definition at line 170 of file EffectManager.php.

◆ remove()

pocketmine\entity\effect\EffectManager::remove ( Effect  $effectType)

Removes the effect with the specified ID from the mob.

Definition at line 81 of file EffectManager.php.

◆ tick()

pocketmine\entity\effect\EffectManager::tick ( int  $tickDiff = 1)

Definition at line 205 of file EffectManager.php.

Member Data Documentation

◆ $bubbleColor

Color pocketmine\entity\effect\EffectManager::$bubbleColor
protected

Definition at line 39 of file EffectManager.php.

◆ $effectAddHooks

ObjectSet pocketmine\entity\effect\EffectManager::$effectAddHooks
protected

Definition at line 46 of file EffectManager.php.

◆ $effectRemoveHooks

ObjectSet pocketmine\entity\effect\EffectManager::$effectRemoveHooks
protected

Definition at line 51 of file EffectManager.php.

◆ $effects

array pocketmine\entity\effect\EffectManager::$effects = []
protected

Definition at line 37 of file EffectManager.php.

◆ $onlyAmbientEffects

bool pocketmine\entity\effect\EffectManager::$onlyAmbientEffects = false
protected

Definition at line 40 of file EffectManager.php.


The documentation for this class was generated from the following file: