mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Generator works!
This commit is contained in:
@ -21,6 +21,7 @@
|
||||
|
||||
namespace pocketmine\level\generator\biome;
|
||||
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\level\ChunkManager;
|
||||
use pocketmine\level\generator\normal\biome\BeachBiome;
|
||||
use pocketmine\level\generator\normal\biome\DesertBiome;
|
||||
@ -58,6 +59,11 @@ abstract class Biome{
|
||||
/** @var Populator[] */
|
||||
private $populators = [];
|
||||
|
||||
private $minElevation;
|
||||
private $maxElevation;
|
||||
|
||||
private $groundCover = [];
|
||||
|
||||
protected static function register($id, Biome $biome){
|
||||
self::$biomes[(int) $id] = $biome;
|
||||
$biome->setId((int) $id);
|
||||
@ -116,4 +122,31 @@ abstract class Biome{
|
||||
}
|
||||
|
||||
public abstract function getName();
|
||||
|
||||
public function getMinElevation(){
|
||||
return $this->minElevation;
|
||||
}
|
||||
|
||||
public function getMaxElevation(){
|
||||
return $this->maxElevation;
|
||||
}
|
||||
|
||||
public function setElevation($min, $max){
|
||||
$this->minElevation = $min;
|
||||
$this->maxElevation = $max;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Block[]
|
||||
*/
|
||||
public function getGroundCover(){
|
||||
return $this->groundCover;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Block[] $covers
|
||||
*/
|
||||
public function setGroundCover(array $covers){
|
||||
$this->groundCover = $covers;
|
||||
}
|
||||
}
|
@ -42,7 +42,7 @@ class BiomeSelector{
|
||||
public function __construct(Random $random, Biome $fallback){
|
||||
$this->fallback = $fallback;
|
||||
$this->temperature = new Simplex($random, 1, 0.004, 0.5, 2);
|
||||
$this->rainfall = new Simplex($random, 1, 0.004, 0.5, 2);
|
||||
$this->rainfall = new Simplex($random, 2, 0.004, 0.5, 2);
|
||||
}
|
||||
|
||||
public function addBiome(Biome $biome, $start, $end){
|
||||
@ -58,8 +58,6 @@ class BiomeSelector{
|
||||
*/
|
||||
public function pickBiome($x, $z){
|
||||
|
||||
return Biome::getBiome(Biome::PLAINS);
|
||||
|
||||
//$temperature = $this->temperature->noise2D($x, $z);
|
||||
$rainfall = $this->rainfall->noise2D($x, $z);
|
||||
|
||||
@ -70,11 +68,15 @@ class BiomeSelector{
|
||||
}elseif($rainfall > 0.6){
|
||||
return Biome::getBiome(Biome::BEACH);
|
||||
}elseif($rainfall > 0.2){
|
||||
return Biome::getBiome(Biome::PLAINS);
|
||||
}elseif($rainfall > -0.3){
|
||||
return Biome::getBiome(Biome::FOREST);
|
||||
}else{
|
||||
}elseif($rainfall > -0.3){
|
||||
return Biome::getBiome(Biome::PLAINS);
|
||||
}elseif($rainfall > -0.6){
|
||||
return Biome::getBiome(Biome::DESERT);
|
||||
}elseif($rainfall > -0.7){
|
||||
return Biome::getBiome(Biome::BEACH);
|
||||
}else{
|
||||
return Biome::getBiome(Biome::OCEAN);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user