diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index c8f85de3c..71d081c50 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -316,7 +316,7 @@ class Item{ const WOODEN_DOOR = 324; const BUCKET = 325; - const MINECART = 329; + const MINECART = 328; const IRON_DOOR = 330; const REDSTONE = 331; @@ -656,4 +656,4 @@ class Item{ return $this->id === $item->getId() and ($checkDamage === false or $this->getDamage() === $item->getDamage()); } -} \ No newline at end of file +} diff --git a/src/pocketmine/level/generator/Flat.php b/src/pocketmine/level/generator/Flat.php index 82ce07fba..cd2071538 100644 --- a/src/pocketmine/level/generator/Flat.php +++ b/src/pocketmine/level/generator/Flat.php @@ -60,6 +60,7 @@ class Flat extends Generator{ $this->preset = "2;7,2x3,2;1;"; //$this->preset = "2;7,59x1,3x3,2;1;spawn(radius=10 block=89),decoration(treecount=80 grasscount=45)"; $this->options = $options; + $this->chunk = null; if(isset($this->options["decoration"])){ $ores = new Ore(); @@ -81,7 +82,7 @@ class Flat extends Generator{ }*/ } - protected function parsePreset($preset){ + protected function parsePreset($preset, $chunkX, $chunkZ){ $this->preset = $preset; $preset = explode(";", $preset); $version = (int) $preset[0]; @@ -107,11 +108,7 @@ class Flat extends Generator{ } - $chunk = $this->level->getChunk(0, 0); - if($chunk === null){ - return; - } - $this->chunk = clone $chunk; + $this->chunk = clone $this->level->getChunk($chunkX, $chunkZ); $this->chunk->setGenerated(); for($Z = 0; $Z < 16; ++$Z){ @@ -145,15 +142,24 @@ class Flat extends Generator{ $this->level = $level; $this->random = $random; + /* + // Commented out : We want to delay this if(isset($this->options["preset"]) and $this->options["preset"] != ""){ $this->parsePreset($this->options["preset"]); }else{ $this->parsePreset($this->preset); } - + */ } public function generateChunk($chunkX, $chunkZ){ + if($this->chunk === null) { + if(isset($this->options["preset"]) and $this->options["preset"] != ""){ + $this->parsePreset($this->options["preset"], $chunkX, $chunkZ); + }else{ + $this->parsePreset($this->preset, $chunkX, $chunkZ); + } + } $chunk = clone $this->chunk; $chunk->setX($chunkX); $chunk->setZ($chunkZ); @@ -171,4 +177,4 @@ class Flat extends Generator{ public function getSpawn(){ return new Vector3(128, $this->floorLevel, 128); } -} \ No newline at end of file +}