Inheritance: extends DataPacket
Exemplo n.º 1
0
 public function sendPosition(Vector3 $pos, $yaw = null, $pitch = null, $mode = 0, $channel = Network::CHANNEL_PRIORITY)
 {
     $yaw = $yaw === null ? $pos->yaw : $yaw;
     $pitch = $pitch === null ? $pos->pitch : $pitch;
     $pk = new MovePlayerPacket();
     $pk->eid = $this->getId();
     $pk->x = $pos->x;
     $pk->y = $pos->y + $this->getEyeHeight();
     $pk->z = $pos->z;
     $pk->bodyYaw = $yaw;
     $pk->pitch = $pitch;
     $pk->yaw = $yaw;
     $pk->mode = $mode;
     $this->dataPacket($pk->setChannel($channel));
 }
Exemplo n.º 2
0
 public function sendPosition(Vector3 $pos, $yaw = null, $pitch = null, $mode = 0, $channel = Network::CHANNEL_PRIORITY, array $targets = null)
 {
     $yaw = $yaw === null ? $this->yaw : $yaw;
     $pitch = $pitch === null ? $this->pitch : $pitch;
     $pk = new MovePlayerPacket();
     $pk->eid = $this->getId();
     $pk->x = $pos->x;
     $pk->y = $pos->y + $this->getEyeHeight();
     $pk->z = $pos->z;
     $pk->bodyYaw = $yaw;
     $pk->pitch = $pitch;
     $pk->yaw = $yaw;
     $pk->mode = $mode;
     if ($targets !== null) {
         Server::broadcastPacket($targets, $pk->setChannel($channel));
     } else {
         $pk->eid = 0;
         $this->dataPacket($pk->setChannel($channel));
     }
 }
Exemplo n.º 3
0
 public function teleport(Vector3 $pos, $yaw = \null, $pitch = \null)
 {
     if (parent::teleport($pos, $yaw, $pitch)) {
         foreach ($this->windowIndex as $window) {
             if ($window === $this->inventory) {
                 continue;
             }
             $this->removeWindow($window);
         }
         $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, 300);
         $this->resetFallDistance();
         $this->orderChunks();
         $this->nextChunkOrderRun = 0;
         $this->forceMovement = new Vector3($this->x, $this->y, $this->z);
         $this->newPosition = \null;
         $pk = new MovePlayerPacket();
         $pk->eid = $this->getId();
         $pk->x = $this->x;
         $pk->y = $this->y + $this->getEyeHeight();
         $pk->z = $this->z;
         $pk->bodyYaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $pk->yaw = $this->yaw;
         $pk->mode = 1;
         $this->directDataPacket($pk->setChannel(Network::CHANNEL_PRIORITY));
     }
 }