Phpcraft
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Phpcraft\Packet\EntityEffectPacket Class Reference
Inheritance diagram for Phpcraft\Packet\EntityEffectPacket:
Inheritance graph
[legend]
Collaboration diagram for Phpcraft\Packet\EntityEffectPacket:
Collaboration graph
[legend]

Public Member Functions

 __construct ($eids, EffectType $effect, int $amplifier, $duration, bool $particles=true)
 
 send (Connection $con)
 
 __toString ()
 
- Public Member Functions inherited from Phpcraft\Packet\EntityPacket
 __construct ($eids=[])
 
 replaceEntity (GMP $old_eid, GMP $new_eid)
 

Static Public Member Functions

static read (Connection $con)
 

Public Attributes

 $effect
 
 $amplifier
 
 $duration
 
 $particles
 
- Public Attributes inherited from Phpcraft\Packet\EntityPacket
 $eids
 

Detailed Description

Sent by servers to clients to inform them about entities gaining a potion effect.

Constructor & Destructor Documentation

◆ __construct()

Phpcraft\Packet\EntityEffectPacket::__construct (   $eids,
EffectType  $effect,
int  $amplifier,
  $duration,
bool  $particles = true 
)
Parameters
array<GMP>|GMP|int|string$eids A single entity ID or an array of entity IDs.
EffectType$effect
int$amplifierThe effect's amplifier = the effect's level - 1.
GMP | int | string$durationThe effect's duration, in seconds.
bool$particles

Member Function Documentation

◆ __toString()

Phpcraft\Packet\EntityEffectPacket::__toString ( )

Reimplemented from Phpcraft\Packet\Packet.

◆ read()

static Phpcraft\Packet\EntityEffectPacket::read ( Connection  $con)
static

Initialises the packet class by reading its payload from the given Connection.

Parameters
Connection$con
Returns
EntityEffectPacket
Exceptions
IOException

Reimplemented from Phpcraft\Packet\Packet.

◆ send()

Phpcraft\Packet\EntityEffectPacket::send ( Connection  $con)

Adds the packet's ID and payload to the Connection's write buffer and sends it over the wire if the connection has a stream. Note that in some cases this will produce multiple Minecraft packets, therefore you should only use this on connections without a stream if you know what you're doing.

Parameters
Connection$con
Returns
void
Exceptions
IOException

Reimplemented from Phpcraft\Packet\Packet.

Member Data Documentation

◆ $amplifier

int Phpcraft\Packet\EntityEffectPacket::$amplifier

The effect's amplifier = the effect's level - 1.

◆ $duration

Phpcraft\Packet\EntityEffectPacket::$duration

◆ $effect

EffectType Phpcraft\Packet\EntityEffectPacket::$effect

◆ $particles

bool Phpcraft\Packet\EntityEffectPacket::$particles