Inheritance: extends Entity, implements Rideable
Exemplo n.º 1
0
 public function kill()
 {
     parent::kill();
     foreach ($this->getDrops() as $item) {
         $this->getLevel()->dropItem($this, $item);
     }
 }
Exemplo n.º 2
0
 public function spawnTo(Player $player)
 {
     $pk = $this->addEntityDataPacket($player);
     $pk->type = self::NETWORK_ID;
     $player->dataPacket($pk);
     parent::spawnTo($player);
 }
Exemplo n.º 3
0
 public function attack($damage, EntityDamageEvent $source)
 {
     parent::attack($damage, $source);
     if (!$source->isCancelled()) {
         $pk = new EntityEventPacket();
         $pk->eid = $this->id;
         $pk->event = EntityEventPacket::HURT_ANIMATION;
         foreach ($this->getLevel()->getPlayers() as $player) {
             $player->dataPacket($pk);
         }
     }
 }
Exemplo n.º 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);
 }
Exemplo n.º 5
0
 public function spawnTo(Player $player)
 {
     $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->speedX = 0;
     $pk->speedY = 0;
     $pk->speedZ = 0;
     $pk->yaw = 0;
     $pk->pitch = 0;
     $pk->metadata = $this->dataProperties;
     $player->dataPacket($pk);
     parent::spawnTo($player);
 }