PocketMine-MP 5.14.2 git-50e2c469a547a16a23b2dc691e70a51d34e29395
pocketmine\entity\effect\EffectInstance Class Reference
+ Collaboration diagram for pocketmine\entity\effect\EffectInstance:

Public Member Functions

 __construct (Effect $effectType, ?int $duration=null, int $amplifier=0, bool $visible=true, bool $ambient=false, ?Color $overrideColor=null)
 
 decreaseDuration (int $ticks)
 
 getAmplifier ()
 
 getColor ()
 
 getDuration ()
 
 getEffectLevel ()
 
 getType ()
 
 hasExpired ()
 
 isAmbient ()
 
 isVisible ()
 
 resetColor ()
 
 setAmbient (bool $ambient=true)
 
 setAmplifier (int $amplifier)
 
 setColor (Color $color)
 
 setDuration (int $duration)
 
 setVisible (bool $visible=true)
 

Detailed Description

Definition at line 30 of file EffectInstance.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\entity\effect\EffectInstance::__construct ( Effect  $effectType,
?int  $duration = null,
int  $amplifier = 0,
bool  $visible = true,
bool  $ambient = false,
?Color  $overrideColor = null 
)
Parameters
int | null$durationPassing null will use the effect type's default duration

Definition at line 41 of file EffectInstance.php.

References pocketmine\entity\effect\Effect\getColor(), pocketmine\entity\effect\Effect\getDefaultDuration(), pocketmine\entity\effect\EffectInstance\setAmplifier(), and pocketmine\entity\effect\EffectInstance\setDuration().

+ Here is the call graph for this function:

Member Function Documentation

◆ decreaseDuration()

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

Decreases the duration by the given number of ticks, without dropping below zero.

Returns
$this

Definition at line 82 of file EffectInstance.php.

◆ getAmplifier()

pocketmine\entity\effect\EffectInstance::getAmplifier ( )

Definition at line 95 of file EffectInstance.php.

◆ getColor()

pocketmine\entity\effect\EffectInstance::getColor ( )

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.

Definition at line 156 of file EffectInstance.php.

◆ getDuration()

pocketmine\entity\effect\EffectInstance::getDuration ( )

Returns the number of ticks remaining until the effect expires.

Definition at line 57 of file EffectInstance.php.

Referenced by pocketmine\entity\effect\PoisonEffect\canTick(), pocketmine\entity\effect\RegenerationEffect\canTick(), and pocketmine\entity\effect\WitherEffect\canTick().

+ Here is the caller graph for this function:

◆ getEffectLevel()

pocketmine\entity\effect\EffectInstance::getEffectLevel ( )

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

Definition at line 102 of file EffectInstance.php.

Referenced by pocketmine\entity\effect\HungerEffect\applyEffect(), pocketmine\entity\effect\LevitationEffect\applyEffect(), and pocketmine\entity\effect\SaturationEffect\applyEffect().

+ Here is the caller graph for this function:

◆ getType()

pocketmine\entity\effect\EffectInstance::getType ( )

Definition at line 50 of file EffectInstance.php.

◆ hasExpired()

pocketmine\entity\effect\EffectInstance::hasExpired ( )

Returns whether the duration has run out.

Definition at line 91 of file EffectInstance.php.

◆ isAmbient()

pocketmine\entity\effect\EffectInstance::isAmbient ( )

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.

Definition at line 139 of file EffectInstance.php.

◆ isVisible()

pocketmine\entity\effect\EffectInstance::isVisible ( )

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

Definition at line 121 of file EffectInstance.php.

◆ resetColor()

pocketmine\entity\effect\EffectInstance::resetColor ( )

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

Definition at line 172 of file EffectInstance.php.

◆ setAmbient()

pocketmine\entity\effect\EffectInstance::setAmbient ( bool  $ambient = true)
Returns
$this

Definition at line 146 of file EffectInstance.php.

◆ setAmplifier()

pocketmine\entity\effect\EffectInstance::setAmplifier ( int  $amplifier)
Returns
$this

Definition at line 109 of file EffectInstance.php.

Referenced by pocketmine\entity\effect\EffectInstance\__construct().

+ Here is the caller graph for this function:

◆ setColor()

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

Sets the colour of this EffectInstance.

Definition at line 163 of file EffectInstance.php.

◆ setDuration()

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

Sets the number of ticks remaining until the effect expires.

Exceptions

InvalidArgumentException

Returns
$this

Definition at line 68 of file EffectInstance.php.

Referenced by pocketmine\entity\effect\EffectInstance\__construct().

+ Here is the caller graph for this function:

◆ setVisible()

pocketmine\entity\effect\EffectInstance::setVisible ( bool  $visible = true)
Returns
$this

Definition at line 128 of file EffectInstance.php.


The documentation for this class was generated from the following file: