Skip to content

Effect ​

class · pocketmine\entity\effect\Effect · source

Properties ​

$bad ​

php
public bool $bad

$color ​

php
public \pocketmine\color\Color $color

$hasBubbles ​

php
public bool $hasBubbles

$name ​

php
public \pocketmine\lang\Translatable|string $name

Methods ​

__construct() ​

php
public function __construct(\pocketmine\lang\Translatable|string $name, \pocketmine\color\Color $color, bool $bad = false, int $defaultDuration = 600, bool $hasBubbles = true)

add() ​

php
public function add(\pocketmine\entity\Living $entity, \pocketmine\entity\effect\EffectInstance $instance) : void

Applies effects to the entity when the effect is first added.

applyEffect() ​

php
public function applyEffect(\pocketmine\entity\Living $entity, \pocketmine\entity\effect\EffectInstance $instance, float $potency = 1.0, ?\pocketmine\entity\Entity $source = null) : void

Applies effect results to an entity. This will not be called unless canTick() returns true.

canTick() ​

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

Deprecated

Implement getApplyInterval() instead

Returns whether the effect will do something on the current tick.

getApplyInterval() ​

php
public function getApplyInterval(\pocketmine\entity\effect\EffectInstance $instance) : int

Returns after how many ticks applyEffect() will be called. If this returns 0, the effect will not be ticked. If it returns 1, it will be ticked every tick.

getColor() ​

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

Returns a Color object representing this effect's particle colour.

getDefaultDuration() ​

php
public function getDefaultDuration() : int

Returns the default duration (in ticks) this effect will apply for if a duration is not specified.

getName() ​

php
public function getName() : \pocketmine\lang\Translatable|string

Returns the translation key used to translate this effect's name.

hasBubbles() ​

php
public function hasBubbles() : bool

Returns whether this effect will give the subject potion bubbles.

isBad() ​

php
public function isBad() : bool

Returns whether this effect is harmful. TODO: implement inverse effect results for undead mobs

onEntityDeath() 5.46.0 ​

php
public function onEntityDeath(\pocketmine\entity\Living $entity, \pocketmine\entity\effect\EffectInstance $instance) : void

Called when an entity dies while it has this effect (e.g. Wind Charged and Weaving act on death).

remove() ​

php
public function remove(\pocketmine\entity\Living $entity, \pocketmine\entity\effect\EffectInstance $instance) : void

Removes the effect from the entity, resetting any changed values back to their original defaults.

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