mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +00:00
fixed weird tall grass generation
This commit is contained in:
parent
94687419cb
commit
0b28ed8042
2 changed files with 6 additions and 16 deletions
|
|
@ -107,7 +107,7 @@ class ExperimentalGenerator implements NewLevelGenerator{
|
||||||
$noiseArray = ExperimentalGenerator::getFastNoise3D($this->noiseBase, 16, 128, 16, 4, 8, 4, $chunkX * 16, 0, $chunkZ * 16);
|
$noiseArray = ExperimentalGenerator::getFastNoise3D($this->noiseBase, 16, 128, 16, 4, 8, 4, $chunkX * 16, 0, $chunkZ * 16);
|
||||||
|
|
||||||
$biomeCache = [];
|
$biomeCache = [];
|
||||||
$t = microtime(true);
|
|
||||||
for($chunkY = 0; $chunkY < 8; ++$chunkY){
|
for($chunkY = 0; $chunkY < 8; ++$chunkY){
|
||||||
$chunk = "";
|
$chunk = "";
|
||||||
$startY = $chunkY << 4;
|
$startY = $chunkY << 4;
|
||||||
|
|
@ -144,7 +144,7 @@ class ExperimentalGenerator implements NewLevelGenerator{
|
||||||
$minSum /= $weightSum;
|
$minSum /= $weightSum;
|
||||||
$maxSum /= $weightSum;
|
$maxSum /= $weightSum;
|
||||||
for($y = $startY; $y < $endY; ++$y){
|
for($y = $startY; $y < $endY; ++$y){
|
||||||
if($y === 0){
|
if($y == 0){
|
||||||
$chunk .= "\x07";
|
$chunk .= "\x07";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -154,13 +154,6 @@ class ExperimentalGenerator implements NewLevelGenerator{
|
||||||
$noiseAdjustment = ($noiseAdjustment < (0.4 + ($distAboveCaveLevel / 10))) ? $noiseAdjustment : (0.4 + ($distAboveCaveLevel / 10)); //min($noiseAdjustment, 0.4 + ($distAboveCaveLevel / 10));
|
$noiseAdjustment = ($noiseAdjustment < (0.4 + ($distAboveCaveLevel / 10))) ? $noiseAdjustment : (0.4 + ($distAboveCaveLevel / 10)); //min($noiseAdjustment, 0.4 + ($distAboveCaveLevel / 10));
|
||||||
$noiseValue = $noiseArray[$x][$z][$y] + $noiseAdjustment;
|
$noiseValue = $noiseArray[$x][$z][$y] + $noiseAdjustment;
|
||||||
$chunk .= (($noiseValue > 0) ? "\x01" : (($y <= $this->waterHeight) ? "\x09" : "\x00"));
|
$chunk .= (($noiseValue > 0) ? "\x01" : (($y <= $this->waterHeight) ? "\x09" : "\x00"));
|
||||||
/*if($noiseValue > 0){
|
|
||||||
$chunk .= "\x01";
|
|
||||||
}elseif($y <= $this->waterHeight){
|
|
||||||
$chunk .= "\x09";
|
|
||||||
}else{
|
|
||||||
$chunk .= "\x00";
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
$chunk .= "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
|
$chunk .= "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||||
//$chunk .= str_repeat("\xff", 16);
|
//$chunk .= str_repeat("\xff", 16);
|
||||||
|
|
|
||||||
|
|
@ -59,16 +59,13 @@ class TallGrassPopulator extends Populator{
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getHighestWorkableBlock($x, $z){
|
private function getHighestWorkableBlock($x, $z){
|
||||||
|
|
||||||
for($y = 128; $y > 0; --$y){
|
for($y = 128; $y > 0; --$y){
|
||||||
$b = $this->level->level->getBlockID($x, $y, $z);
|
$b = $this->level->level->getBlockID($x, $y, $z);
|
||||||
if($b !== DIRT and $b !== GRASS){
|
if($b == GRASS){
|
||||||
if(--$y <= 0){
|
return $y + 1;
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ++$y;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue