PocketMine-MP 5.35.1 git-e32e836dad793a3a3c8ddd8927c00e112b1e576a
Loading...
Searching...
No Matches
pocketmine\entity\effect\EffectManager Class Reference
+ Inheritance diagram for pocketmine\entity\effect\EffectManager:
+ Collaboration diagram for pocketmine\entity\effect\EffectManager:

Public Member Functions

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

Protected Member Functions

 recalculateEffectColor ()
 

Protected Attributes

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

Detailed Description

Definition at line 32 of file EffectManager.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 34 of file EffectManager.php.

Member Function Documentation

◆ add()

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

Adds an effect to the collection. Existing effects of the same type will be replaced if {

See also
self::canAdd()} returns true.
Returns
bool whether the effect has been successfully applied.

Reimplemented from pocketmine\entity\effect\EffectCollection.

Definition at line 61 of file EffectManager.php.

◆ all()

pocketmine\entity\effect\EffectCollection::all ( )
inherited

Returns all the effects in the collection, indexed by spl_object_id of the effect type.

Returns
EffectInstance[]

Definition at line 73 of file EffectCollection.php.

◆ canAdd()

pocketmine\entity\effect\EffectCollection::canAdd ( EffectInstance $effect)
inherited

In the following cases it will return true:

  • if the effect type is not already applied
  • if an existing effect of the same type can be replaced (due to shorter duration or lower level)

Definition at line 123 of file EffectCollection.php.

References pocketmine\entity\effect\EffectInstance\getDuration().

+ Here is the call graph for this function:

◆ clear()

pocketmine\entity\effect\EffectCollection::clear ( )
inherited

Removes all effects.

Definition at line 80 of file EffectCollection.php.

◆ get()

pocketmine\entity\effect\EffectCollection::get ( Effect $effect)
inherited

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

Definition at line 107 of file EffectCollection.php.

◆ getBubbleColor()

pocketmine\entity\effect\EffectCollection::getBubbleColor ( )
inherited

Definition at line 200 of file EffectCollection.php.

◆ getEffectAddHooks()

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

Definition at line 212 of file EffectCollection.php.

◆ getEffectRemoveHooks()

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

Definition at line 220 of file EffectCollection.php.

◆ has()

pocketmine\entity\effect\EffectCollection::has ( Effect $effect)
inherited

Returns whether the specified effect is active.

Definition at line 114 of file EffectCollection.php.

◆ hasOnlyAmbientEffects()

pocketmine\entity\effect\EffectCollection::hasOnlyAmbientEffects ( )
inherited

Definition at line 204 of file EffectCollection.php.

◆ recalculateEffectColor()

pocketmine\entity\effect\EffectCollection::recalculateEffectColor ( )
protectedinherited

Recalculates the potion bubbles colour based on the active effects.

Definition at line 173 of file EffectCollection.php.

◆ remove()

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

Removes the effect with the specified ID from the mob.

Reimplemented from pocketmine\entity\effect\EffectCollection.

Definition at line 43 of file EffectManager.php.

◆ setEffectFilterForBubbles()

pocketmine\entity\effect\EffectCollection::setEffectFilterForBubbles ( \Closure $filter)
inherited

Sets the filter that determines which effects will be displayed in the bubbles.

@phpstan-param \Closure(EffectInstance) : bool $filter

Definition at line 165 of file EffectCollection.php.

◆ tick()

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

Definition at line 84 of file EffectManager.php.

Member Data Documentation

◆ $bubbleColor

Color pocketmine\entity\effect\EffectCollection::$bubbleColor
protectedinherited

Definition at line 50 of file EffectCollection.php.

◆ $effectAddHooks

ObjectSet pocketmine\entity\effect\EffectCollection::$effectAddHooks
protectedinherited

Definition at line 42 of file EffectCollection.php.

◆ $effectFilterForBubbles

Closure pocketmine\entity\effect\EffectCollection::$effectFilterForBubbles
protectedinherited

Validates whether an effect will be used for bubbles color calculation.

@phpstan-var \Closure(EffectInstance) : bool

Definition at line 59 of file EffectCollection.php.

◆ $effectRemoveHooks

ObjectSet pocketmine\entity\effect\EffectCollection::$effectRemoveHooks
protectedinherited

Definition at line 48 of file EffectCollection.php.

◆ $effects

array pocketmine\entity\effect\EffectCollection::$effects = []
protectedinherited

Definition at line 36 of file EffectCollection.php.

◆ $onlyAmbientEffects

bool pocketmine\entity\effect\EffectCollection::$onlyAmbientEffects = false
protectedinherited

Definition at line 52 of file EffectCollection.php.


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