mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Fixed crash on tile unloading
This commit is contained in:
@ -1048,7 +1048,9 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
if($this->chunk instanceof FullChunk){
|
if($this->chunk instanceof FullChunk){
|
||||||
$this->chunk->removeEntity($this);
|
$this->chunk->removeEntity($this);
|
||||||
}
|
}
|
||||||
$this->getLevel()->removeEntity($this);
|
if(($level = $this->getLevel()) instanceof Level){
|
||||||
|
$level->removeEntity($this);
|
||||||
|
}
|
||||||
$this->despawnFromAll();
|
$this->despawnFromAll();
|
||||||
$this->level->release();
|
$this->level->release();
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ use pocketmine\event\Timings;
|
|||||||
use pocketmine\level\format\Chunk;
|
use pocketmine\level\format\Chunk;
|
||||||
use pocketmine\level\format\FullChunk;
|
use pocketmine\level\format\FullChunk;
|
||||||
use pocketmine\level\format\LevelProvider;
|
use pocketmine\level\format\LevelProvider;
|
||||||
|
use pocketmine\level\Level;
|
||||||
use pocketmine\level\Position;
|
use pocketmine\level\Position;
|
||||||
use pocketmine\nbt\tag\Compound;
|
use pocketmine\nbt\tag\Compound;
|
||||||
|
|
||||||
@ -111,8 +112,12 @@ abstract class Tile extends Position{
|
|||||||
if($this->closed === false){
|
if($this->closed === false){
|
||||||
$this->closed = true;
|
$this->closed = true;
|
||||||
unset(Tile::$needUpdate[$this->id]);
|
unset(Tile::$needUpdate[$this->id]);
|
||||||
$this->getLevel()->removeTile($this);
|
if($this->chunk instanceof FullChunk){
|
||||||
$this->chunk->removeTile($this);
|
$this->chunk->removeTile($this);
|
||||||
|
}
|
||||||
|
if(($level = $this->getLevel()) instanceof Level){
|
||||||
|
$level->removeTile($this);
|
||||||
|
}
|
||||||
$this->level->release();
|
$this->level->release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user