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

Public Member Functions

 add (EffectInstance $effect)
 
 all ()
 
 canAdd (EffectInstance $effect)
 
 clear ()
 
 get (Effect $effect)
 
 getBubbleColor ()
 
 getEffectAddHooks ()
 
 getEffectRemoveHooks ()
 
 has (Effect $effect)
 
 hasOnlyAmbientEffects ()
 
 remove (Effect $effectType)
 
 setEffectFilterForBubbles (\Closure $filter)
 

Protected Member Functions

 recalculateEffectColor ()
 

Protected Attributes

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

Detailed Description

Definition at line 33 of file EffectCollection.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\entity\effect\EffectCollection::__construct ( )

Definition at line 61 of file EffectCollection.php.

Member Function Documentation

◆ add()

pocketmine\entity\effect\EffectCollection::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 in pocketmine\entity\effect\EffectManager.

Definition at line 143 of file EffectCollection.php.

◆ all()

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

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)

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 ( )

Removes all effects.

Definition at line 80 of file EffectCollection.php.

◆ get()

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

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 ( )

Definition at line 200 of file EffectCollection.php.

◆ getEffectAddHooks()

pocketmine\entity\effect\EffectCollection::getEffectAddHooks ( )
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 ( )
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)

Returns whether the specified effect is active.

Definition at line 114 of file EffectCollection.php.

◆ hasOnlyAmbientEffects()

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

Definition at line 204 of file EffectCollection.php.

◆ recalculateEffectColor()

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

Recalculates the potion bubbles colour based on the active effects.

Definition at line 173 of file EffectCollection.php.

◆ remove()

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

Removes the effect with the specified ID.

Reimplemented in pocketmine\entity\effect\EffectManager.

Definition at line 89 of file EffectCollection.php.

◆ setEffectFilterForBubbles()

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

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.

Member Data Documentation

◆ $bubbleColor

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

Definition at line 50 of file EffectCollection.php.

◆ $effectAddHooks

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

Definition at line 42 of file EffectCollection.php.

◆ $effectFilterForBubbles

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

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
protected

Definition at line 48 of file EffectCollection.php.

◆ $effects

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

Definition at line 36 of file EffectCollection.php.

◆ $onlyAmbientEffects

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

Definition at line 52 of file EffectCollection.php.


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