From c9fdb66c785b51e4b826017ee6d0cdbead92a084 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 10 Jul 2017 18:14:13 +0100 Subject: [PATCH] Made flat-world generation faster and less stupid No need to set blocks which are obviously already going to be air >_> --- src/pocketmine/level/generator/Flat.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/pocketmine/level/generator/Flat.php b/src/pocketmine/level/generator/Flat.php index 1e83974b7..73080e4ba 100644 --- a/src/pocketmine/level/generator/Flat.php +++ b/src/pocketmine/level/generator/Flat.php @@ -112,24 +112,18 @@ class Flat extends Generator{ $this->floorLevel = $y = count($this->structure); - for(; $y < 0xFF; ++$y){ - $this->structure[$y] = [0, 0]; - } - - $this->chunk = clone $this->level->getChunk($chunkX, $chunkZ); $this->chunk->setGenerated(); for($Z = 0; $Z < 16; ++$Z){ for($X = 0; $X < 16; ++$X){ $this->chunk->setBiomeId($X, $Z, $biome); - for($y = 0; $y < 128; ++$y){ + for($y = 0; $y < 256 and isset($this->structure[$y]); ++$y){ $this->chunk->setBlock($X, $y, $Z, ...$this->structure[$y]); } } } - preg_match_all('#(([0-9a-z_]{1,})\(?([0-9a-z_ =:]{0,})\)?),?#', $options, $matches); foreach($matches[2] as $i => $option){ $params = true;