Skip to content

EffectCollection ​

class · pocketmine\entity\effect\EffectCollection · source

Properties ​

$bubbleColor protected ​

php
protected \pocketmine\color\Color $bubbleColor

$effectAddHooks protected ​

php
protected \pocketmine\utils\ObjectSet $effectAddHooks

$effectFilterForBubbles protected ​

php
protected \Closure $effectFilterForBubbles

Validates 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 $onlyAmbientEffects

Methods ​

__construct() ​

php
public function __construct()

add() ​

php
public function add(\pocketmine\entity\effect\EffectInstance $effect) : bool

Adds an effect to the collection. Existing effects of the same type will be replaced if self::canAdd() returns true.

all() ​

php
public function all() : array

Returns 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) : bool

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)

clear() ​

php
public function clear() : void

Removes all effects.

get() ​

php
public function get(\pocketmine\entity\effect\Effect $effect) : ?\pocketmine\entity\effect\EffectInstance

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

getBubbleColor() ​

php
public function getBubbleColor() : \pocketmine\color\Color

getEffectAddHooks() ​

php
public function getEffectAddHooks() : \pocketmine\utils\ObjectSet

getEffectRemoveHooks() ​

php
public function getEffectRemoveHooks() : \pocketmine\utils\ObjectSet

has() ​

php
public function has(\pocketmine\entity\effect\Effect $effect) : bool

Returns whether the specified effect is active.

hasOnlyAmbientEffects() ​

php
public function hasOnlyAmbientEffects() : bool

recalculateEffectColor() protected ​

php
protected function recalculateEffectColor() : void

Recalculates the potion bubbles colour based on the active effects.

remove() ​

php
public function remove(\pocketmine\entity\effect\Effect $effectType) : void

Removes the effect with the specified ID.

setEffectFilterForBubbles() ​

php
public function setEffectFilterForBubbles(\Closure $filter) : void

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

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.