コード例 #1
0
ファイル: Squid.php プロジェクト: ianju/PocketMine-MP
 public function attack($damage, EntityDamageEvent $source)
 {
     parent::attack($damage, $source);
     if ($source->isCancelled()) {
         return;
     }
     if ($source instanceof EntityDamageByEntityEvent) {
         $this->swimSpeed = mt_rand(150, 350) / 2000;
         $e = $source->getDamager();
         $this->swimDirection = (new Vector3($this->x - $e->x, $this->y - $e->y, $this->z - $e->z))->normalize();
         $pk = new EntityEventPacket();
         $pk->eid = $this->getId();
         $pk->event = EntityEventPacket::SQUID_INK_CLOUD;
         Server::broadcastPacket($this->hasSpawned, $pk);
     }
 }
コード例 #2
0
ファイル: Squid.php プロジェクト: Edwardthedog2/Steadfast2
 public function attack($damage, EntityDamageEvent $source)
 {
     parent::attack($damage, $source);
     if ($source->isCancelled()) {
         return;
     }
     if ($source instanceof EntityDamageByEntityEvent) {
         $this->swimSpeed = \mt_rand(150, 350) / 2000;
         $e = $source->getDamager();
         $this->swimDirection = (new Vector3($this->x - $e->x, $this->y - $e->y, $this->z - $e->z))->normalize();
         $pk = new EntityEventPacket();
         $pk->eid = $this->getId();
         $pk->event = 15;
         Server::broadcastPacket($this->hasSpawned, $pk->setChannel(Network::CHANNEL_WORLD_EVENTS));
     }
 }