Fixed PMFLevel bugs, crashes and weird methods

This commit is contained in:
Shoghi Cervantes
2014-02-14 13:17:05 +01:00
parent c1251a25bd
commit 63f4f87d37
4 changed files with 26 additions and 40 deletions

View File

@ -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);
}
}

View File

@ -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(){