Add some constants to AnimatePacket

This commit is contained in:
Dylan K. Taylor 2017-07-31 16:03:34 +01:00
parent 17be06a56d
commit 0b47324fe3
3 changed files with 11 additions and 2 deletions

View File

@ -1187,7 +1187,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$pk = new AnimatePacket();
$pk->entityRuntimeId = $this->id;
$pk->action = 3; //Wake up
$pk->action = AnimatePacket::ACTION_STOP_SLEEP;
$this->dataPacket($pk);
}
}

View File

@ -32,6 +32,10 @@ use pocketmine\Player;
class PlayerAnimationEvent extends PlayerEvent implements Cancellable{
public static $handlerList = null;
/**
* @deprecated This is dependent on the protocol and should not be here.
* Use the constants in {@link pocketmine\network\mcpe\protocol\AnimatePacket} instead.
*/
const ARM_SWING = 1;
/** @var int */

View File

@ -31,9 +31,14 @@ use pocketmine\network\mcpe\NetworkSession;
class AnimatePacket extends DataPacket{
const NETWORK_ID = ProtocolInfo::ANIMATE_PACKET;
const ACTION_SWING_ARM = 1;
const ACTION_STOP_SLEEP = 3;
const ACTION_CRITICAL_HIT = 4;
public $action;
public $entityRuntimeId;
public $float; //TODO (Boat rowing time?)
public $float = 0.0; //TODO (Boat rowing time?)
public function decodePayload(){
$this->action = $this->getVarInt();