Documentation

PoisonEffect extends Effect
in package

Table of Contents

$bad  : bool
$color  : Color
$hasBubbles  : bool
$name  : Translatable|string
$defaultDuration  : int
$fatal  : bool
__clone()  : mixed
__construct()  : mixed
__serialize()  : array<string|int, mixed>
__unserialize()  : void
add()  : void
Applies effects to the entity when the effect is first added.
applyEffect()  : void
Applies effect results to an entity. This will not be called unless canTick() returns true.
canTick()  : bool
Returns whether the effect will do something on the current tick.
getColor()  : Color
Returns a Color object representing this effect's particle colour.
getDefaultDuration()  : int
Returns the default duration (in ticks) this effect will apply for if a duration is not specified.
getName()  : Translatable|string
Returns the translation key used to translate this effect's name.
hasBubbles()  : bool
Returns whether this effect will give the subject potion bubbles.
isBad()  : bool
Returns whether this effect is harmful.
remove()  : void
Removes the effect from the entity, resetting any changed values back to their original defaults.

Properties

$bad

protected bool $bad = false

$hasBubbles

protected bool $hasBubbles = true

$defaultDuration

private int $defaultDuration = 600

Methods

__clone()

public final __clone() : mixed
Return values
mixed

__construct()

public __construct(Translatable|string $name, Color $color[, bool $isBad = false ][, int $defaultDuration = 600 ][, bool $hasBubbles = true ][, bool $fatal = false ]) : mixed
Parameters
$name : Translatable|string

Translation key used for effect name

$color : Color

Color of bubbles given by this effect

$isBad : bool = false
$defaultDuration : int = 600
$hasBubbles : bool = true

Whether the effect has potion bubbles. Some do not (e.g. Instant Damage has its own particles instead of bubbles)

$fatal : bool = false
Return values
mixed

__serialize()

public final __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__unserialize()

public final __unserialize(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>
Return values
void

applyEffect()

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

public applyEffect(Living $entity, EffectInstance $instance[, float $potency = 1.0 ][, Entity|null $source = null ]) : void
Parameters
$entity : Living
$instance : EffectInstance
$potency : float = 1.0
$source : Entity|null = null
Return values
void

getColor()

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

public getColor() : Color
Return values
Color

getDefaultDuration()

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

public getDefaultDuration() : int
Return values
int

getName()

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

public getName() : Translatable|string
Return values
Translatable|string

hasBubbles()

Returns whether this effect will give the subject potion bubbles.

public hasBubbles() : bool
Return values
bool

isBad()

Returns whether this effect is harmful.

public isBad() : bool

TODO: implement inverse effect results for undead mobs

Return values
bool

remove()

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

public remove(Living $entity, EffectInstance $instance) : void
Parameters
$entity : Living
$instance : EffectInstance
Return values
void

Search results