From 284910734fc4326a170cce54efa2289bd56b063d Mon Sep 17 00:00:00 2001 From: GameHerobrine Date: Sat, 2 Dec 2023 14:16:27 +0300 Subject: [PATCH] fixed superflat --- src/world/generator/NormalGenerator.php | 2 +- src/world/generator/SuperflatGenerator.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/world/generator/NormalGenerator.php b/src/world/generator/NormalGenerator.php index c800abe1..836b0dbc 100644 --- a/src/world/generator/NormalGenerator.php +++ b/src/world/generator/NormalGenerator.php @@ -151,9 +151,9 @@ class NormalGenerator implements NewLevelGenerator{ $chunk .= "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; //skylight/light } } - $this->level->level->setBiomeIdArrayForChunk($chunkX, $chunkZ, $biomes); $this->level->setMiniChunk($chunkX, $chunkZ, $chunkY, $chunk); } + $this->level->level->setBiomeIdArrayForChunk($chunkX, $chunkZ, $biomes); if(self::HIDDEN_FEATURES) $this->caveGenerator->generate($this->level, $chunkX, $chunkZ); //TODO speedup } diff --git a/src/world/generator/SuperflatGenerator.php b/src/world/generator/SuperflatGenerator.php index 59590690..87691e1a 100644 --- a/src/world/generator/SuperflatGenerator.php +++ b/src/world/generator/SuperflatGenerator.php @@ -7,7 +7,7 @@ require_once("LevelGenerator.php"); class SuperflatGenerator implements LevelGenerator{ private $level, $random, $structure, $chunks, $options, $floorLevel, $populators = []; - + public $preset; public function __construct(array $options = []){ $this->preset = "2;7,59x1,3x3,2;1;spawn(radius=10 block=89),decoration(treecount=80 grasscount=45)"; $this->options = $options; @@ -78,9 +78,9 @@ class SuperflatGenerator implements LevelGenerator{ $metas = ""; for($y = $startY; $y < $endY; ++$y){ $blocks .= chr($this->structure[$y]->getID()); - $metas .= substr(dechex($this->structure[$y]->getMetadata()), -1); + $metas .= chr($this->structure[$y]->getMetadata()); } - $this->chunks[$Y] .= $blocks . hex2bin($metas) . "\x00\x00\x00\x00\x00\x00\x00\x00"; + $this->chunks[$Y] .= $blocks . $metas . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; } } } @@ -111,6 +111,7 @@ class SuperflatGenerator implements LevelGenerator{ for($Y = 0; $Y < 8; ++$Y){ $this->level->setMiniChunk($chunkX, $chunkZ, $Y, $this->chunks[$Y]); } + $this->level->level->setBiomeIdArrayForChunk($chunkX, $chunkZ, str_repeat(chr(BIOME_PLAINS), 256)); } public function populateChunk($chunkX, $chunkZ){