diff --git a/src/API/LevelAPI.php b/src/API/LevelAPI.php index 00d30bd0..afbda4b1 100644 --- a/src/API/LevelAPI.php +++ b/src/API/LevelAPI.php @@ -144,6 +144,7 @@ class LevelAPI{ ConsoleAPI::warn("You should not use OLD world type."); break; case "HELL": + case "NETHER": $generator = new HellGenerator(); break; default: diff --git a/src/pmf/PMFLevel.php b/src/pmf/PMFLevel.php index 3ff149d3..b183643b 100644 --- a/src/pmf/PMFLevel.php +++ b/src/pmf/PMFLevel.php @@ -201,7 +201,9 @@ class PMFLevel extends PMF{ return ord($this->chunkInfo[$index][0][$aX + ($aZ << 4)]); } - + public function setBiomeIdArrayForChunk($x, $z, $biomeIds){ + $this->chunkInfo[$this->getIndex($x, $z)][0] = $biomeIds; + } public function setBiomeId($x, $z, $id){ $X = $x >> 4; $Z = $z >> 4; @@ -255,7 +257,9 @@ class PMFLevel extends PMF{ $chunk = @gzopen($this->getChunkPath($X, $Z), "wb" . PMF_LEVEL_DEFLATE_LEVEL); $bitmap = 0; $biomedata = $this->chunkInfo[$index][0]; - if(strlen($biomedata) < 256) $biomedata = str_repeat("\x01", 256); + if(strlen($biomedata) < 256){ + $biomedata = str_repeat("\x01", 256); + } gzwrite($chunk, $biomedata); for($Y = 0; $Y < $this->levelData["height"]; ++$Y){ if($this->chunks[$index][$Y] !== false and ((isset($this->chunkChange[$index][$Y]) and $this->chunkChange[$index][$Y] === 0) or !$this->isMiniChunkEmpty($X, $Z, $Y))){ diff --git a/src/world/generator/HellGenerator.php b/src/world/generator/HellGenerator.php index f6d2dd64..b149f7b9 100644 --- a/src/world/generator/HellGenerator.php +++ b/src/world/generator/HellGenerator.php @@ -1,12 +1,11 @@ random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed()); $noise = ExperimentalGenerator::getFastNoise3D($this->noiseBase, 16, 128, 16, 4, 8, 4, $chunkX * 16, 0, $chunkZ * 16); - for($chunkY = 0; $chunkY < 8; ++$chunkY){ $chunk = ""; $startY = $chunkY << 4; @@ -108,17 +105,16 @@ class HellGenerator implements NewLevelGenerator{ $chunk .= "\x00"; } } - $chunk .= str_repeat(chr(BIOME_HELL), 16); //biome + $chunk .= str_repeat("\x00", 16); //meta $chunk .= $lightChunk; //blocklight $chunk .= str_repeat("\x00", 16); //skylight - $lightChunk = ""; //$chunk .= "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; //light //$chunk .= "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; //more light } } $this->level->setMiniChunk($chunkX, $chunkZ, $chunkY, $chunk); } - + $this->level->level->setBiomeIdArrayForChunk($chunkX, $chunkZ, str_repeat(chr(BIOME_HELL), 256)); foreach($this->generationPopulators as $populator){ $populator->populate($this->level, $chunkX, $chunkZ, $this->random); } diff --git a/src/world/generator/NormalGenerator.php b/src/world/generator/NormalGenerator.php index 9c54ff6d..ef6897d1 100644 --- a/src/world/generator/NormalGenerator.php +++ b/src/world/generator/NormalGenerator.php @@ -68,7 +68,6 @@ class NormalGenerator implements NewLevelGenerator{ $base = array(); for($z = 0; $z < 16; ++$z){ for($x = 0; $x < 16; ++$x){ - $this->level->level->setBiomeId($x + ($chunkX << 4), $z + ($chunkZ << 4), BIOME_PLAINS); $i = ($z << 4) + $x; $hills[$i] = $this->noiseHills->noise3D($x + ($chunkX << 4), 0, $z + ($chunkZ << 4), 0.11, 12, true); $patches[$i] = $this->noisePatches->noise2D($x + ($chunkX << 4), $z + ($chunkZ << 4), 0.03, 16, true); @@ -135,6 +134,7 @@ 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, str_repeat(chr(BIOME_PLAINS), 256)); $this->level->setMiniChunk($chunkX, $chunkZ, $chunkY, $chunk); }