예제 #1
0
 public function onClose(Player $who)
 {
     $pk = new ContainerClosePacket();
     $pk->windowid = $who->getWindowId($this);
     $who->dataPacket($pk);
     parent::onClose($who);
 }
예제 #2
0
 public function send()
 {
     $pk = new UpdateAttributePacket();
     $pk->maxValue = $this->getMaxValue();
     $pk->minValue = $this->getMinValue();
     $pk->value = $this->currentValue;
     $pk->name = $this->getName();
     $pk->entityId = 0;
     $pk->encode();
     $this->player->dataPacket($pk);
 }
예제 #3
0
 public function spawnTo(Player $player)
 {
     $pk = new AddPaintingPacket();
     $pk->eid = $this->getId();
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->direction = $this->getDirection();
     $pk->title = $this->motive;
     $player->dataPacket($pk);
     parent::spawnTo($player);
 }
예제 #4
0
 public function spawnTo(Player $player)
 {
     if ($this->closed) {
         return false;
     }
     $nbt = new NBT(NBT::LITTLE_ENDIAN);
     $nbt->setData($this->getSpawnCompound());
     $pk = new BlockEntityDataPacket();
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->namedtag = $nbt->write();
     $player->dataPacket($pk);
     return true;
 }
예제 #5
0
 public function despawnFrom(Player $player)
 {
     if (isset($this->hasSpawned[$player->getLoaderId()])) {
         $pk = new RemovePlayerPacket();
         $pk->eid = $this->getId();
         $pk->clientId = $this->getUniqueId();
         $player->dataPacket($pk);
         unset($this->hasSpawned[$player->getLoaderId()]);
     }
 }
예제 #6
0
 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->speedX = $this->motionX;
     $pk->speedY = $this->motionY;
     $pk->speedZ = $this->motionZ;
     $pk->item = $this->getItem();
     $player->dataPacket($pk);
     $this->sendData($player);
     parent::spawnTo($player);
 }