mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Throw exception when an invalid chunk is set as the parent of a Tile/Entity
This commit is contained in:
parent
e97139919a
commit
7d8a961374
@ -147,6 +147,10 @@ abstract class Entity extends Position implements Metadatable{
|
||||
|
||||
|
||||
public function __construct(Chunk $chunk, Compound $nbt){
|
||||
if($chunk->getLevel() === null){
|
||||
throw new \Exception("Invalid garbage Chunk given to Entity");
|
||||
}
|
||||
|
||||
$this->id = Entity::$entityCount++;
|
||||
$this->justCreated = true;
|
||||
$this->namedtag = $nbt;
|
||||
|
@ -27,6 +27,7 @@ namespace pocketmine\tile;
|
||||
|
||||
use pocketmine\event\Timings;
|
||||
use pocketmine\level\format\Chunk;
|
||||
use pocketmine\level\format\LevelProvider;
|
||||
use pocketmine\level\Position;
|
||||
use pocketmine\nbt\tag\Compound;
|
||||
|
||||
@ -62,6 +63,10 @@ abstract class Tile extends Position{
|
||||
public $tickTimer;
|
||||
|
||||
public function __construct(Chunk $chunk, Compound $nbt){
|
||||
if($chunk->getLevel() === null){
|
||||
throw new \Exception("Invalid garbage Chunk given to Tile");
|
||||
}
|
||||
|
||||
$this->server = $chunk->getLevel()->getLevel()->getServer();
|
||||
$this->chunk = $chunk;
|
||||
$this->setLevel($chunk->getLevel()->getLevel(), true); //Strong reference
|
||||
|
Loading…
x
Reference in New Issue
Block a user