mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
Updated Normal generator
This commit is contained in:
parent
109b6dbf44
commit
b6ef52e89c
@ -1361,9 +1361,9 @@ class Server{
|
||||
LevelProviderManager::addProvider($this, "pocketmine\\level\\format\\anvil\\Anvil");
|
||||
|
||||
|
||||
//Generator::addGenerator("pocketmine\\level\\generator\\Flat", "flat");
|
||||
//Generator::addGenerator("pocketmine\\level\\generator\\Normal", "normal");
|
||||
//Generator::addGenerator("pocketmine\\level\\generator\\Normal", "default");
|
||||
Generator::addGenerator("pocketmine\\level\\generator\\Flat", "flat");
|
||||
Generator::addGenerator("pocketmine\\level\\generator\\Normal", "normal");
|
||||
Generator::addGenerator("pocketmine\\level\\generator\\Normal", "default");
|
||||
|
||||
if($this->getDefaultLevel() === null){
|
||||
$default = $this->getConfigString("level-name", "world");
|
||||
|
@ -122,9 +122,11 @@ class GenerationChunkManager implements ChunkManager{
|
||||
|
||||
protected function requestChunk($chunkX, $chunkZ){
|
||||
$chunk = $this->manager->requestChunk($this->levelID, $chunkX, $chunkZ);
|
||||
$this->chunks[Level::chunkHash($chunkX, $chunkZ)] = $chunk;
|
||||
|
||||
return $chunk;
|
||||
$this->chunks[$index = Level::chunkHash($chunkX, $chunkZ)] = $chunk;
|
||||
if(!$chunk->isGenerated()){
|
||||
$this->generateChunk($chunkX, $chunkZ);
|
||||
}
|
||||
return $this->chunks[$index];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,8 +44,7 @@ abstract class Generator{
|
||||
return Generator::$list[$name];
|
||||
}
|
||||
|
||||
//return "pocketmine\\level\\generator\\Normal";
|
||||
return "pocketmine\\level\\generator\\Flat";
|
||||
return "pocketmine\\level\\generator\\Normal";
|
||||
}
|
||||
|
||||
public static function getGeneratorName($class){
|
||||
|
@ -29,6 +29,7 @@ use pocketmine\block\Gravel;
|
||||
use pocketmine\block\IronOre;
|
||||
use pocketmine\block\LapisOre;
|
||||
use pocketmine\block\RedstoneOre;
|
||||
use pocketmine\item\Block;
|
||||
use pocketmine\level\generator\noise\Simplex;
|
||||
use pocketmine\level\generator\object\OreType;
|
||||
use pocketmine\level\generator\populator\Ore;
|
||||
@ -119,8 +120,9 @@ class Normal extends Generator{
|
||||
}
|
||||
}
|
||||
|
||||
$chunk = $this->level->getChunk($chunkX, $chunkZ);
|
||||
|
||||
for($chunkY = 0; $chunkY < 8; ++$chunkY){
|
||||
$chunk = "";
|
||||
$startY = $chunkY << 4;
|
||||
$endY = $startY + 16;
|
||||
for($z = 0; $z < 16; ++$z){
|
||||
@ -132,47 +134,44 @@ class Normal extends Generator{
|
||||
for($y = $startY; $y < $endY; ++$y){
|
||||
$diff = $height - $y;
|
||||
if($y <= 4 and ($y === 0 or $this->random->nextFloat() < 0.75)){
|
||||
$chunk .= "\x07"; //bedrock
|
||||
$chunk->setBlockId($x, $y, $z, Block::BEDROCK);
|
||||
}elseif($diff > 2){
|
||||
$chunk .= "\x01"; //stone
|
||||
$chunk->setBlockId($x, $y, $z, Block::STONE);
|
||||
}elseif($diff > 0){
|
||||
if($patches[$i] > 0.7){
|
||||
$chunk .= "\x01"; //stone
|
||||
$chunk->setBlockId($x, $y, $z, Block::STONE);
|
||||
}elseif($patches[$i] < -0.8){
|
||||
$chunk .= "\x0d"; //gravel
|
||||
$chunk->setBlockId($x, $y, $z, Block::GRAVEL);
|
||||
}else{
|
||||
$chunk .= "\x03"; //dirt
|
||||
$chunk->setBlockId($x, $y, $z, Block::DIRT);
|
||||
}
|
||||
}elseif($y <= $this->waterHeight){
|
||||
if(($this->waterHeight - $y) <= 1 and $diff === 0){
|
||||
$chunk .= "\x0c"; //sand
|
||||
$chunk->setBlockId($x, $y, $z, Block::SAND);
|
||||
}elseif($diff === 0){
|
||||
if($patchesSmall[$i] > 0.3){
|
||||
$chunk .= "\x0d"; //gravel
|
||||
$chunk->setBlockId($x, $y, $z, Block::GRAVEL);
|
||||
}elseif($patchesSmall[$i] < -0.45){
|
||||
$chunk .= "\x0c"; //sand
|
||||
$chunk->setBlockId($x, $y, $z, Block::SAND);
|
||||
}else{
|
||||
$chunk .= "\x03"; //dirt
|
||||
$chunk->setBlockId($x, $y, $z, Block::DIRT);
|
||||
}
|
||||
}else{
|
||||
$chunk .= "\x09"; //still_water
|
||||
$chunk->setBlockId($x, $y, $z, Block::STILL_WATER);
|
||||
}
|
||||
}elseif($diff === 0){
|
||||
if($patches[$i] > 0.7){
|
||||
$chunk .= "\x01"; //stone
|
||||
$chunk->setBlockId($x, $y, $z, Block::STONE);
|
||||
}elseif($patches[$i] < -0.8){
|
||||
$chunk .= "\x0d"; //gravel
|
||||
$chunk->setBlockId($x, $y, $z, Block::GRAVEL);
|
||||
}else{
|
||||
$chunk .= "\x02"; //grass
|
||||
}
|
||||
}else{
|
||||
$chunk .= "\x00";
|
||||
$chunk->setBlockId($x, $y, $z, Block::GRASS);
|
||||
}
|
||||
}
|
||||
$chunk .= "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$this->level->setMiniChunk($chunkX, $chunkZ, $chunkY, $chunk);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -80,7 +80,8 @@ class Ore{
|
||||
$sizeZ *= $sizeZ;
|
||||
|
||||
if(($sizeX + $sizeY + $sizeZ) < 1 and $level->getBlockIdAt($x, $y, $z) === 1){
|
||||
$level->setBlockIdAt($x, $y, $z, $this->type->material);
|
||||
$level->setBlockIdAt($x, $y, $z, $this->type->material->getID());
|
||||
$level->setBlockDataAt($x, $y, $z, $this->type->material->getDamage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user