Inheritance: extends Monster, implements pocketmine\entity\Explosive
Ejemplo n.º 1
0
 public function spawnTo(Player $player)
 {
     $pk = $this->addEntityDataPacket($player);
     $pk->type = Creeper::NETWORK_ID;
     $player->dataPacket($pk);
     parent::spawnTo($player);
 }
Ejemplo n.º 2
0
 /**
  * @param Position $pos 出生位置坐标(世界)
  * @param int      $maxHealth 最高血量
  * @param int      $health 血量
  *                            出生一只苦力怕在某坐标
  */
 public function spawnCreeper(Position $pos, $maxHealth = 20, $health = 20)
 {
     $chunk = $pos->level->getChunk($pos->x >> 4, $pos->z >> 4, false);
     $nbt = $this->getNBT();
     $zo = new Creeper($chunk, $nbt);
     $zo->setPosition($pos);
     $zo->setMaxHealth($maxHealth);
     $zo->setHealth($health);
     $zo->spawnToAll();
     //$this->getLogger()->info("生成了一只苦力怕");
 }