Made flat-world generation faster and less stupid

No need to set blocks which are obviously already going to be air >_>
This commit is contained in:
Dylan K. Taylor 2017-07-10 18:14:13 +01:00
parent 8a28dfa64d
commit c9fdb66c78

View File

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