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

Public Member Functions

 __construct ($eids=[], int $animation=self::ANIMATION_SWING_MAIN_ARM)
 
 send (Connection $con)
 
 __toString ()
 
 getAnimationName ()
 
- 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

const ANIMATION_SWING_MAIN_ARM = 0
 
const ANIMATION_TAKE_DAMAGE = 1
 
const ANIMATION_LEAVE_BED = 2
 
const ANIMATION_SWING_OFFHAND = 3
 
const ANIMATION_CRITICAL_EFFECT = 4
 
const ANIMATION_MAGIC_CRITICAL_EFFECT = 5
 
 $animation = self::ANIMATION_SWING_MAIN_ARM
 
- Public Attributes inherited from Phpcraft\Packet\EntityPacket
 $eids
 

Constructor & Destructor Documentation

◆ __construct()

Phpcraft\Packet\EntityAnimationPacket::__construct (   $eids = [],
int  $animation = self::ANIMATION_SWING_MAIN_ARM 
)
Parameters
array<GMP>|GMP|int|string$eids A single entity ID or an array of entity IDs.
int | null$animation

Member Function Documentation

◆ __toString()

Phpcraft\Packet\EntityAnimationPacket::__toString ( )

Reimplemented from Phpcraft\Packet\Packet.

◆ getAnimationName()

Phpcraft\Packet\EntityAnimationPacket::getAnimationName ( )

The name of the animation in English, e.g. "swing main arm" or "critical effect"

Returns
string

◆ read()

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

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

Parameters
Connection$con
Returns
EntityAnimationPacket
Exceptions
IOException

Reimplemented from Phpcraft\Packet\Packet.

◆ send()

Phpcraft\Packet\EntityAnimationPacket::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

◆ $animation

int Phpcraft\Packet\EntityAnimationPacket::$animation = self::ANIMATION_SWING_MAIN_ARM

◆ ANIMATION_CRITICAL_EFFECT

const Phpcraft\Packet\EntityAnimationPacket::ANIMATION_CRITICAL_EFFECT = 4

◆ ANIMATION_LEAVE_BED

const Phpcraft\Packet\EntityAnimationPacket::ANIMATION_LEAVE_BED = 2

◆ ANIMATION_MAGIC_CRITICAL_EFFECT

const Phpcraft\Packet\EntityAnimationPacket::ANIMATION_MAGIC_CRITICAL_EFFECT = 5

◆ ANIMATION_SWING_MAIN_ARM

const Phpcraft\Packet\EntityAnimationPacket::ANIMATION_SWING_MAIN_ARM = 0

◆ ANIMATION_SWING_OFFHAND

const Phpcraft\Packet\EntityAnimationPacket::ANIMATION_SWING_OFFHAND = 3

◆ ANIMATION_TAKE_DAMAGE

const Phpcraft\Packet\EntityAnimationPacket::ANIMATION_TAKE_DAMAGE = 1