Skip to content

EffectInstance ​

class · pocketmine\entity\effect\EffectInstance · source

Methods ​

__construct() ​

php
public function __construct(\pocketmine\entity\effect\Effect $effectType, ?int $duration = null, int $amplifier = 0, bool $visible = true, bool $ambient = false, ?\pocketmine\color\Color $overrideColor = null, bool $infinite = false)

decreaseDuration() ​

php
public function decreaseDuration(int $ticks) : \pocketmine\entity\effect\EffectInstance

Decreases the duration by the given number of ticks, without dropping below zero. Note: Infinite effects will still have their durations updated, but they'll wrap around to Limits::INT32_MAX if they drop below zero. This is because periodic effects rely on the duration ticker to know when to tick.

getAmplifier() ​

php
public function getAmplifier() : int

getColor() ​

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

Returns the particle colour of this effect instance. This can be overridden on a per-EffectInstance basis, so it is not reflective of the default colour of the effect.

getDuration() ​

php
public function getDuration() : int

Returns the number of ticks remaining until the effect expires.

getEffectLevel() ​

php
public function getEffectLevel() : int

Returns the level of this effect, which is always one higher than the amplifier.

getType() ​

php
public function getType() : \pocketmine\entity\effect\Effect

hasExpired() ​

php
public function hasExpired() : bool

Returns whether the duration has run out.

isAmbient() ​

php
public function isAmbient() : bool

Returns whether the effect originated from the ambient environment. Ambient effects can originate from things such as a Beacon's area of effect radius. If this flag is set, the amount of visible particles will be reduced by a factor of 5.

isInfinite() ​

php
public function isInfinite() : bool

Returns whether the effect is meant to last indefinitely

isVisible() ​

php
public function isVisible() : bool

Returns whether this effect will produce some visible effect, such as bubbles or particles.

resetColor() ​

php
public function resetColor() : \pocketmine\entity\effect\EffectInstance

Resets the colour of this EffectInstance to the default specified by its type.

setAmbient() ​

php
public function setAmbient(bool $ambient = true) : \pocketmine\entity\effect\EffectInstance

setAmplifier() ​

php
public function setAmplifier(int $amplifier) : \pocketmine\entity\effect\EffectInstance

setColor() ​

php
public function setColor(\pocketmine\color\Color $color) : \pocketmine\entity\effect\EffectInstance

Sets the colour of this EffectInstance.

setDuration() ​

php
public function setDuration(int $duration) : \pocketmine\entity\effect\EffectInstance

Sets the number of ticks remaining until the effect expires.

setVisible() ​

php
public function setVisible(bool $visible = true) : \pocketmine\entity\effect\EffectInstance

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