EffectCollection
Properties
$bubbleColor protected
php
protected \pocketmine\color\Color $bubbleColor$effectAddHooks protected
php
protected \pocketmine\utils\ObjectSet $effectAddHooks$effectFilterForBubbles protected
php
protected \Closure $effectFilterForBubblesValidates whether an effect will be used for bubbles color calculation.
$effectRemoveHooks protected
php
protected \pocketmine\utils\ObjectSet $effectRemoveHooks$effects protected
php
protected array $effects$onlyAmbientEffects protected
php
protected bool $onlyAmbientEffectsMethods
__construct()
php
public function __construct()add()
php
public function add(\pocketmine\entity\effect\EffectInstance $effect) : boolAdds an effect to the collection. Existing effects of the same type will be replaced if self::canAdd() returns true.
all()
php
public function all() : arrayReturns all the effects in the collection, indexed by spl_object_id of the effect type.
canAdd()
php
public function canAdd(\pocketmine\entity\effect\EffectInstance $effect) : boolIn 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)
clear()
php
public function clear() : voidRemoves all effects.
get()
php
public function get(\pocketmine\entity\effect\Effect $effect) : ?\pocketmine\entity\effect\EffectInstanceReturns the effect instance active with the specified ID, or null if does not have the effect.
getBubbleColor()
php
public function getBubbleColor() : \pocketmine\color\ColorgetEffectAddHooks()
php
public function getEffectAddHooks() : \pocketmine\utils\ObjectSetgetEffectRemoveHooks()
php
public function getEffectRemoveHooks() : \pocketmine\utils\ObjectSethas()
php
public function has(\pocketmine\entity\effect\Effect $effect) : boolReturns whether the specified effect is active.
hasOnlyAmbientEffects()
php
public function hasOnlyAmbientEffects() : boolrecalculateEffectColor() protected
php
protected function recalculateEffectColor() : voidRecalculates the potion bubbles colour based on the active effects.
remove()
php
public function remove(\pocketmine\entity\effect\Effect $effectType) : voidRemoves the effect with the specified ID.
setEffectFilterForBubbles()
php
public function setEffectFilterForBubbles(\Closure $filter) : voidSets the filter that determines which effects will be displayed in the bubbles.
