EffectInstance
Methods
__construct()
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()
public function decreaseDuration(int $ticks) : \pocketmine\entity\effect\EffectInstanceDecreases 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()
public function getAmplifier() : intgetColor()
public function getColor() : \pocketmine\color\ColorReturns 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()
public function getDuration() : intReturns the number of ticks remaining until the effect expires.
getEffectLevel()
public function getEffectLevel() : intReturns the level of this effect, which is always one higher than the amplifier.
getType()
public function getType() : \pocketmine\entity\effect\EffecthasExpired()
public function hasExpired() : boolReturns whether the duration has run out.
isAmbient()
public function isAmbient() : boolReturns 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()
public function isInfinite() : boolReturns whether the effect is meant to last indefinitely
isVisible()
public function isVisible() : boolReturns whether this effect will produce some visible effect, such as bubbles or particles.
resetColor()
public function resetColor() : \pocketmine\entity\effect\EffectInstanceResets the colour of this EffectInstance to the default specified by its type.
setAmbient()
public function setAmbient(bool $ambient = true) : \pocketmine\entity\effect\EffectInstancesetAmplifier()
public function setAmplifier(int $amplifier) : \pocketmine\entity\effect\EffectInstancesetColor()
public function setColor(\pocketmine\color\Color $color) : \pocketmine\entity\effect\EffectInstanceSets the colour of this EffectInstance.
setDuration()
public function setDuration(int $duration) : \pocketmine\entity\effect\EffectInstanceSets the number of ticks remaining until the effect expires.
setVisible()
public function setVisible(bool $visible = true) : \pocketmine\entity\effect\EffectInstance