use pocketmine\network\mcpe\NetworkSession; class CameraShakePacket extends DataPacket/* implements ClientboundPacket*/{ public const NETWORK_ID = ProtocolInfo::CAMERA_SHAKE_PACKET; public const TYPE_POSITIONAL = 0; public const TYPE_ROTATIONAL = 1; public const ACTION_ADD = 0; public const ACTION_STOP = 1; /** @var float */ private $intensity; /** @var float */ private $duration; /** @var int */ private $shakeType; /** @var int */ private $shakeAction; public static function create(float $intensity, float $duration, int $shakeType, int $shakeAction) : self{ $result = new self; $result->intensity = $intensity; $result->duration = $duration; $result->shakeType = $shakeType; $result->shakeAction = $shakeAction; return $result; } public function getIntensity() : float{ return $this->intensity; } public function getDuration() : float{ return $this->duration; } public function getShakeType() : int{ return $this->shakeType; } public function getShakeAction() : int{ return $this->shakeAction; } protected function decodePayload() : void{ $this->intensity = $this->getLFloat(); $this->duration = $this->getLFloat(); $this->shakeType = $this->getByte(); $this->shakeAction = $this->getByte(); } protected function encodePayload() : void{ $this->putLFloat($this->intensity); $this->putLFloat($this->duration); $this->putByte($this->shakeType); $this->putByte($this->shakeAction); } public function handle(NetworkSession $handler) : bool{ return $handler->handleCameraShake($this); } }