public function close() { if ($this->closed === false) { $this->closed = true; unset($this->level->updateTiles[$this->id]); if ($this->chunk instanceof FullChunk) { $this->chunk->removeTile($this); } if (($level = $this->getLevel()) instanceof Level) { $level->removeTile($this); } } }
public function close() { if (!$this->closed) { $this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this)); $this->closed = true; if ($this->chunk !== null) { $this->chunk->removeEntity($this); } if ($this->level instanceof Level) { $this->level->removeEntity($this); } $this->despawnFromAll(); } }
public function close() { if (!$this->closed) { $this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this)); $this->closed = true; unset($this->level->updateEntities[$this->id]); if ($this->chunk instanceof FullChunk) { $this->chunk->removeEntity($this); } if ($this->level instanceof Level) { $this->level->removeEntity($this); } $this->despawnFromAll(); } }
protected function switchLevel(Level $targetLevel) { if ($this->closed) { return false; } if ($this->isValid()) { $this->server->getPluginManager()->callEvent($ev = new EntityLevelChangeEvent($this, $this->level, $targetLevel)); if ($ev->isCancelled()) { return false; } $this->level->removeEntity($this); if ($this->chunk !== null) { $this->chunk->removeEntity($this); } $this->despawnFromAll(); } $this->setLevel($targetLevel); $this->level->addEntity($this); $this->chunk = null; return true; }
public function generateChunk($x, $z) { $this->setChunk($x, $z, Chunk::getEmptyChunk($x, $z, $this->provider)); }
public function close() { if (!$this->closed) { $this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this)); $this->closed = true; $this->despawnFromAll(); //Unlink Entity if ($this->isLinked()) { $this->unlinkEntity(); } if ($this->chunk !== null) { $this->chunk->removeEntity($this); } if ($this->level !== null) { $this->level->removeEntity($this); } } }
public function generateChunk($x, $z, $force = false) { $this->setChunk($x, $z, Chunk::getEmptyChunk($x, $z, $this->provider)); return true; }
public function close() { if (!$this->closed) { $this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this)); $this->closed = true; $this->despawnFromAll(); if ($this->linkedType != 0) { $this->linkedEntity->setLinked(0, $this); } if ($this->chunk !== null) { $this->chunk->removeEntity($this); } if ($this->level !== null) { $this->level->removeEntity($this); } } if ($this->getLevel()->getServer()->redstoneEnabled) { /** @var \pocketmine\block\PressurePlate $block **/ foreach ($this->activatedPressurePlates as $key => $block) { $block->checkActivation(); } } }