public function getZombie(Position $pos, $maxHealth = 20, $health = 20) { $chunk = $pos->level->getChunk($pos->x >> 4, $pos->z >> 4, false); $nbt = $this->getNBT(); $zo = new Zombie($chunk, $nbt); $zo->setPosition($pos); $zo->setMaxHealth($maxHealth); $zo->setHealth($health); return $zo; }
/** * @param Position $pos 出生位置坐标(世界) * @param int $maxHealth 最高血量 * @param int $health 血量 * 出生一只僵尸在某坐标 */ public function spawnZombie(Position $pos, $maxHealth = 20, $health = 20) { $chunk = $pos->level->getChunk($pos->x >> 4, $pos->z >> 4, false); $nbt = $this->getNBT(); $zo = new Zombie($chunk, $nbt); $zo->setPosition($pos); $zo->setMaxHealth($maxHealth); $zo->setHealth($health); $zo->spawnToAll(); //$this->getLogger()->info("生成了一只僵尸"); }