mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Fixed PMFLevel bugs, crashes and weird methods
This commit is contained in:
@ -26,7 +26,6 @@ class Level{
|
||||
public function __construct(PMFLevel $level, Config $entities, Config $tiles, Config $blockUpdates, $name){
|
||||
$this->server = ServerAPI::request();
|
||||
$this->level = $level;
|
||||
$level->level = $this;
|
||||
$this->level->level = $this;
|
||||
$this->entities = $entities;
|
||||
$this->tiles = $tiles;
|
||||
@ -151,17 +150,19 @@ class Level{
|
||||
++$this->level->isGenerating;
|
||||
$this->generator->generateChunk($X, $Z);
|
||||
--$this->level->isGenerating;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function populateChunk($X, $Z){
|
||||
$this->generator->populateChunk($X, $Z);
|
||||
$this->level->setPopulated($X, $Z);
|
||||
$this->generator->populateChunk($X, $Z);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function __destruct(){
|
||||
if(isset($this->level)){
|
||||
$this->save(false, false);
|
||||
$this->level->close();
|
||||
$this->level->closeLevel();
|
||||
unset($this->level);
|
||||
}
|
||||
}
|
||||
|
@ -51,12 +51,11 @@ class WorldGenerator{
|
||||
//Generate 4 chunks for spawning players
|
||||
for($Z = 7; $Z <= 8; ++$Z){
|
||||
for($X = 7; $X <= 8; ++$X){
|
||||
$this->level->level->generateChunk($X, $Z);
|
||||
$this->level->level->loadChunk($X, $Z);
|
||||
}
|
||||
}
|
||||
|
||||
$this->level->setSpawn($this->generator->getSpawn());
|
||||
$this->level->save(true, true);
|
||||
}
|
||||
|
||||
public function close(){
|
||||
|
Reference in New Issue
Block a user