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