use pocketmine\math\Vector3; use pocketmine\network\mcpe\handler\SessionHandler; class SetEntityMotionPacket extends DataPacket implements ClientboundPacket{ public const NETWORK_ID = ProtocolInfo::SET_ENTITY_MOTION_PACKET; /** @var int */ public $entityRuntimeId; /** @var Vector3 */ public $motion; public static function create(int $entityRuntimeId, Vector3 $motion) : self{ $result = new self; $result->entityRuntimeId = $entityRuntimeId; $result->motion = $motion->asVector3(); return $result; } protected function decodePayload() : void{ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->motion = $this->getVector3(); } protected function encodePayload() : void{ $this->putEntityRuntimeId($this->entityRuntimeId); $this->putVector3($this->motion); } public function handle(SessionHandler $handler) : bool{ return $handler->handleSetEntityMotion($this); } }