From 0b47324fe368dc408fbc8225b06d48706b8cf8a1 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 31 Jul 2017 16:03:34 +0100 Subject: [PATCH] Add some constants to AnimatePacket --- src/pocketmine/Player.php | 2 +- src/pocketmine/event/player/PlayerAnimationEvent.php | 4 ++++ src/pocketmine/network/mcpe/protocol/AnimatePacket.php | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 5542fa599..7216f082d 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -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); } } diff --git a/src/pocketmine/event/player/PlayerAnimationEvent.php b/src/pocketmine/event/player/PlayerAnimationEvent.php index 1a025e3cd..f2bc89c72 100644 --- a/src/pocketmine/event/player/PlayerAnimationEvent.php +++ b/src/pocketmine/event/player/PlayerAnimationEvent.php @@ -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 */ diff --git a/src/pocketmine/network/mcpe/protocol/AnimatePacket.php b/src/pocketmine/network/mcpe/protocol/AnimatePacket.php index f92c9d764..0c1eecc07 100644 --- a/src/pocketmine/network/mcpe/protocol/AnimatePacket.php +++ b/src/pocketmine/network/mcpe/protocol/AnimatePacket.php @@ -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();