예제 #1
0
파일: StartDASH.php 프로젝트: EmreTr1/rtr
 public function checkMove(Player &$player, $time)
 {
     if ($time - $this->past[$player->getName()] > 400) {
         // stable->450 safe->600
         $x = -\sin($player->yaw / 180 * M_PI) * \cos($player->pitch / 180 * M_PI);
         $y = -\sin($player->pitch / 180 * M_PI);
         $z = \cos($player->yaw / 180 * M_PI) * \cos($player->pitch / 180 * M_PI);
         $player->addEntityMotion(0, $x, $y, $z);
         // echo "c! " . ($time - $this->past [$player->getName ()]) . "\n";
         // echo "n! " . $x . ":" . $y . ":" . $z . "\n";
     }
     $this->past[$player->getName()] = $time;
 }
예제 #2
0
 public function spawnTo(Player $player)
 {
     $pk = new AddEntityPacket();
     $pk->type = Arrow::NETWORK_ID;
     $pk->eid = $this->getId();
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->did = 0;
     //TODO: send motion here
     $player->dataPacket($pk);
     $player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
     parent::spawnTo($player);
 }
예제 #3
0
 public function spawnTo(Player $player)
 {
     $pk = new AddEntityPacket();
     $pk->eid = $this->getId();
     $pk->type = Skeleton::NETWORK_ID;
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->yaw = $this->yaw;
     $pk->pitch = $this->pitch;
     $pk->metadata = $this->dataProperties;
     $player->dataPacket($pk);
     $player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
     parent::spawnTo($player);
 }
예제 #4
0
 public function spawnTo(Player $player)
 {
     echo __METHOD__ . __LINE__ . "\n";
     $pk = new AddEntityPacket();
     $pk->eid = $this->getId();
     $pk->type = Minecart::NETWORK_ID;
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->did = 0;
     //$pk->speedX = $this->motionX;
     //$pk->speedY = $this->motionY;
     //$pk->speedZ = $this->motionZ;
     $player->dataPacket($pk);
     $player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
     parent::spawnTo($player);
 }
예제 #5
0
 public function spawnTo(Player $player)
 {
     $pk = new AddEntityPacket();
     $pk->eid = $this->getId();
     $pk->type = Blaze::NETWORK_ID;
     $pk->x = $this->x;
     $pk->y = $this->y + 2;
     $pk->z = $this->z;
     $pk->speedX = $this->motionX;
     $pk->speedY = $this->motionY;
     $pk->speedZ = $this->motionZ;
     $pk->yaw = $this->yaw;
     $pk->pitch = $this->pitch;
     $pk->metadata = $this->dataProperties;
     $player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
     $player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
     parent::spawnTo($player);
 }
예제 #6
0
 public function spawnTo(Player $player)
 {
     $pk = new AddEntityPacket();
     $pk->type = FallingSand::NETWORK_ID;
     $pk->eid = $this->getId();
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->did = -($this->getBlock() | $this->getDamage() << 0x10);
     $player->dataPacket($pk);
     $player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
     parent::spawnTo($player);
 }
예제 #7
0
 public function spawnTo(Player $player)
 {
     if ($player !== $this and !isset($this->hasSpawned[$player->getId()])) {
         $this->hasSpawned[$player->getId()] = $player;
         $pk = new AddPlayerPacket();
         $pk->clientID = 0;
         if ($player->getRemoveFormat()) {
             $pk->username = TextFormat::clean($this->nameTag);
         } else {
             $pk->username = $this->nameTag;
         }
         $pk->eid = $this->getId();
         $pk->x = $this->x;
         $pk->y = $this->y;
         $pk->z = $this->z;
         $pk->yaw = $this->yaw;
         $pk->pitch = $this->pitch;
         $item = $this->getInventory()->getItemInHand();
         $pk->item = $item->getId();
         $pk->meta = $item->getDamage();
         $pk->metadata = $this->getData();
         $player->dataPacket($pk);
         $player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
         $this->inventory->sendArmorContents($player);
     }
 }
예제 #8
0
파일: Item.php 프로젝트: rryy/PocketMine-MP
 public function spawnTo(Player $player)
 {
     $pk = new AddItemEntityPacket();
     $pk->eid = $this->getId();
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->yaw = $this->yaw;
     $pk->pitch = $this->pitch;
     $pk->roll = 0;
     $pk->item = $this->getItem();
     $player->dataPacket($pk);
     $player->addEntityMotion($this->getId(), $this->motionX, $this->motionY, $this->motionZ);
     parent::spawnTo($player);
 }
예제 #9
0
 public static function refreshNPCEquipments(Player $p, StatueModel $npc)
 {
     $slots = [];
     $slots[0] = $npc->armorHelmet;
     $slots[1] = $npc->armorChestplate;
     $slots[2] = $npc->armorLegging;
     $slots[3] = $npc->armorChestplate;
     $p->addEntityMotion(1, $p->motionX, $p->motionY, $p->motionZ);
 }