mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
biome id should be fixed
This commit is contained in:
parent
6dd8685db3
commit
2518ab67cb
4 changed files with 12 additions and 11 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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))){
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
<?php
|
||||
|
||||
//from HellGenerator for PocketMine mcpe 0.11 by 星云
|
||||
//from HellGenerator for PocketMine mcpe 0.11 by ж<EFBFBD>џдє‘
|
||||
|
||||
class HellGenerator implements NewLevelGenerator{
|
||||
|
||||
/** @var Populator[] */
|
||||
private $populators = [];
|
||||
/** @var ChunkManager */
|
||||
private $level;
|
||||
/** @var Random */
|
||||
private $random;
|
||||
|
|
@ -18,10 +17,9 @@ class HellGenerator implements NewLevelGenerator{
|
|||
|
||||
/** @var Populator[] */
|
||||
private $generationPopulators = [];
|
||||
/** @var Simplex */
|
||||
private $noiseBase;
|
||||
|
||||
private static $GAUSSIAN_KERNEL = null;
|
||||
private static $GAUSSIAN_KERNEL = null;
|
||||
private static $SMOOTH_SIZE = 2;
|
||||
|
||||
public function __construct(array $options = []){
|
||||
|
|
@ -79,7 +77,6 @@ class HellGenerator implements NewLevelGenerator{
|
|||
$this->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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue