Second biome generator iteration

This commit is contained in:
Shoghi Cervantes 2015-01-08 01:05:05 +01:00
parent a76be6cf38
commit a893174473
No known key found for this signature in database
GPG Key ID: 78464DB0A7837F89
17 changed files with 728 additions and 26 deletions

View File

@ -54,11 +54,12 @@ use pocketmine\level\format\anvil\Anvil;
use pocketmine\level\format\leveldb\LevelDB;
use pocketmine\level\format\LevelProviderManager;
use pocketmine\level\format\mcregion\McRegion;
use pocketmine\level\generator\biome\Biome;
use pocketmine\level\generator\Flat;
use pocketmine\level\generator\GenerationInstanceManager;
use pocketmine\level\generator\GenerationRequestManager;
use pocketmine\level\generator\Generator;
use pocketmine\level\generator\Normal;
use pocketmine\level\generator\normal\Normal;
use pocketmine\level\Level;
use pocketmine\metadata\EntityMetadataStore;
use pocketmine\metadata\LevelMetadataStore;
@ -1603,6 +1604,7 @@ class Server{
InventoryType::init();
Block::init();
Item::init();
Biome::init();
TextWrapper::init();
$this->craftingManager = new CraftingManager();

View File

@ -25,6 +25,7 @@
namespace pocketmine\level\generator;
use pocketmine\level\generator\noise\Noise;
use pocketmine\level\generator\normal\Normal;
use pocketmine\utils\Random;
abstract class Generator{
@ -196,12 +197,12 @@ abstract class Generator{
$nz = (int) ($zz / $zSamplingRate) * $zSamplingRate;
$ny = (int) ($yy / $ySamplingRate) * $ySamplingRate;
$noiseArray[$xx][$zz][$yy] = Noise::trilinearLerp(
$xx, $yy, $zz, $noiseArray[$nx][$nz][$ny], $noiseArray[$nx][$nz][$ny + $ySamplingRate],
$noiseArray[$nx][$nz + $zSamplingRate][$ny], $noiseArray[$nx][$nz + $zSamplingRate][$ny + $ySamplingRate],
$noiseArray[$nx + $xSamplingRate][$nz][$ny], $noiseArray[$nx + $xSamplingRate][$nz][$ny + $ySamplingRate],
$noiseArray[$nx + $xSamplingRate][$nz + $zSamplingRate][$ny],
$noiseArray[$nx + $xSamplingRate][$nz + $zSamplingRate][$ny + $ySamplingRate],
$nx, $nx + $zSamplingRate, $ny, $ny + $ySamplingRate, $nz, $nz + $zSamplingRate
$xx, $yy, $zz, $noiseArray[$nx][$nz][$ny], $noiseArray[$nx][$nz][$nny = $ny + $ySamplingRate],
$noiseArray[$nx][$nnz = $nz + $zSamplingRate][$ny], $noiseArray[$nx][$nnz][$nny],
$noiseArray[$nnx = $nx + $xSamplingRate][$nz][$ny], $noiseArray[$nnx][$nz][$nny],
$noiseArray[$nnx][$nnz][$ny],
$noiseArray[$nnx][$nnz][$nny],
$nx, $nnx, $ny, $nny, $nz, $nnz
);
}
}

View File

@ -0,0 +1,123 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\biome;
use pocketmine\level\ChunkManager;
use pocketmine\level\generator\normal\biome\BeachBiome;
use pocketmine\level\generator\normal\biome\DesertBiome;
use pocketmine\level\generator\normal\biome\ForestBiome;
use pocketmine\level\generator\normal\biome\MountainsBiome;
use pocketmine\level\generator\normal\biome\OceanBiome;
use pocketmine\level\generator\normal\biome\PlainBiome;
use pocketmine\level\generator\normal\biome\RiverBiome;
use pocketmine\level\generator\normal\biome\SmallMountainsBiome;
use pocketmine\level\generator\populator\Populator;
use pocketmine\utils\Random;
abstract class Biome{
const OCEAN = 0;
const PLAINS = 1;
const DESERT = 2;
const MOUNTAINS = 3;
const FOREST = 4;
const RIVER = 7;
const BEACH = 16;
const SMALL_MOUNTAINS = 20;
const MAX_BIOMES = 256;
/** @var Biome[] */
private static $biomes = [];
private static $setup = false;
private $id;
private $registered = false;
/** @var Populator[] */
private $populators = [];
protected static function register($id, Biome $biome){
self::$biomes[(int) $id] = $biome;
$biome->setId((int) $id);
}
public static function init(){
if(self::$setup === false){
self::$setup = true;
self::register(self::OCEAN, new OceanBiome());
self::register(self::PLAINS, new PlainBiome());
self::register(self::DESERT, new DesertBiome());
self::register(self::MOUNTAINS, new MountainsBiome());
self::register(self::FOREST, new ForestBiome());
self::register(self::RIVER, new RiverBiome());
self::register(self::BEACH, new BeachBiome());
self::register(self::SMALL_MOUNTAINS, new SmallMountainsBiome());
}
}
/**
* @param $id
*
* @return Biome
*/
public static function getBiome($id){
return isset(self::$biomes[$id]) ? self::$biomes[$id] : null;
}
public function clearPopulators(){
$this->populators = [];
}
public function addPopulator(Populator $populator){
$this->populators[] = $populator;
}
public function populateChunk(ChunkManager $level, $chunkX, $chunkZ, Random $random){
foreach($this->populators as $populator){
$populator->populate($level, $chunkX, $chunkZ, $random);
}
}
public function getPopulators(){
return $this->populators;
}
public function setId($id){
if(!$this->registered){
$this->registered = true;
$this->id = $id;
}
}
public function getId(){
return $this->id;
}
public abstract function getName();
}

View File

@ -0,0 +1,78 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\biome;
use pocketmine\level\generator\noise\Simplex;
use pocketmine\utils\Random;
class BiomeSelector{
/** @var Biome */
private $fallback;
/** @var Simplex */
private $temperature;
/** @var Simplex */
private $rainfall;
/** @var Biome[] */
private $biomes = [];
private $select = [];
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);
}
public function addBiome(Biome $biome, $start, $end){
$this->biomes[$biome->getId()] = $biome;
$this->select[$biome->getId()] = [$biome->getId(), $start, $end];
}
/**
* @param $x
* @param $z
*
* @return Biome
*/
public function pickBiome($x, $z){
//$temperature = $this->temperature->noise2D($x, $z);
$rainfall = $this->rainfall->noise2D($x, $z);
if($rainfall > 0.9){
return Biome::getBiome(Biome::OCEAN);
}elseif($rainfall > 0.7){
return Biome::getBiome(Biome::RIVER);
}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{
return Biome::getBiome(Biome::DESERT);
}
}
}

View File

@ -55,19 +55,35 @@ abstract class Noise{
}
public static function bilinearLerp($x, $y, $q00, $q01, $q10, $q11, $x1, $x2, $y1, $y2){
$q0 = self::linearLerp($x, $x1, $x2, $q00, $q10);
$q1 = self::linearLerp($x, $x1, $x2, $q01, $q11);
return self::linearLerp($y, $y1, $y2, $q0, $q1);
$dx1 = (($x2 - $x) / ($x2 - $x1));
$dx2 = (($x - $x1) / ($x2 - $x1));
return (($y2 - $y) / ($y2 - $y1)) * (
$dx1 * $q00 + $dx2 * $q10
) + (($y - $y1) / ($y2 - $y1)) * (
$dx1 * $q01 + $dx2 * $q11
);
}
public static function trilinearLerp($x, $y, $z, $q000, $q001, $q010, $q011, $q100, $q101, $q110, $q111, $x1, $x2, $y1, $y2, $z1, $z2) {
$q00 = self::linearLerp($x, $x1, $x2, $q000, $q100);
$q01 = self::linearLerp($x, $x1, $x2, $q010, $q110);
$q10 = self::linearLerp($x, $x1, $x2, $q001, $q101);
$q11 = self::linearLerp($x, $x1, $x2, $q011, $q111);
$q0 = self::linearLerp($y, $y1, $y2, $q00, $q10);
$q1 = self::linearLerp($y, $y1, $y2, $q01, $q11);
return self::linearLerp($z, $z1, $z2, $q0, $q1);
$dx1 = (($x2 - $x) / ($x2 - $x1));
$dx2 = (($x - $x1) / ($x2 - $x1));
$dy1 = (($y2 - $y) / ($y2 - $y1));
$dy2 = (($y - $y1) / ($y2 - $y1));
return (($z2 - $z) / ($z2 - $z1)) * (
$dy1 * (
$dx1 * $q000 + $dx2 * $q100
) + $dy2 * (
$dx1 * $q001 + $dx2 * $q101
)
) + (($z - $z1) / ($z2 - $z1)) * (
$dy1 * (
$dx1 * $q010 + $dx2 * $q110
) + $dy2 * (
$dx1 * $q011 + $dx2 * $q111
)
);
}
public static function grad($hash, $x, $y, $z){

View File

@ -19,7 +19,7 @@
*
*/
namespace pocketmine\level\generator;
namespace pocketmine\level\generator\normal;
use pocketmine\block\Block;
use pocketmine\block\CoalOre;
@ -30,13 +30,19 @@ use pocketmine\block\Gravel;
use pocketmine\block\IronOre;
use pocketmine\block\LapisOre;
use pocketmine\block\RedstoneOre;
use pocketmine\level\generator\biome\Biome;
use pocketmine\level\generator\biome\BiomeSelector;
use pocketmine\level\generator\GenerationChunkManager;
use pocketmine\level\generator\Generator;
use pocketmine\level\generator\noise\Perlin;
use pocketmine\level\generator\noise\Simplex;
use pocketmine\level\generator\normal\biome\NormalBiome;
use pocketmine\level\generator\object\OreType;
use pocketmine\level\generator\populator\Ore;
use pocketmine\level\generator\populator\Populator;
use pocketmine\level\generator\populator\TallGrass;
use pocketmine\level\generator\populator\Tree;
use pocketmine\level\Level;
use pocketmine\math\Vector3 as Vector3;
use pocketmine\utils\Random;
@ -53,6 +59,9 @@ class Normal extends Generator{
/** @var Simplex */
private $noiseBase;
/** @var BiomeSelector */
private $selector;
private static $GAUSSIAN_KERNEL = null;
private static $SMOOTH_SIZE = 2;
@ -88,6 +97,8 @@ class Normal extends Generator{
$this->random = $random;
$this->random->setSeed($this->level->getSeed());
$this->noiseBase = new Simplex($this->random, 16, 0.012, 0.5, 2);
$this->random->setSeed($this->level->getSeed());
$this->selector = new BiomeSelector($this->random, Biome::getBiome(Biome::OCEAN));
$ores = new Ore();
@ -121,11 +132,11 @@ class Normal extends Generator{
$start = microtime(true);
$noise = Generator::getFastNoise3D($this->noiseBase, 16, 128, 16, 4, 16, 4, $chunkX * 16, 0, $chunkZ * 16);
$noise = Generator::getFastNoise3D($this->noiseBase, 16, 128, 16, 8, 8, 8, $chunkX * 16, 0, $chunkZ * 16);
$chunk = $this->level->getChunk($chunkX, $chunkZ);
var_dump((microtime(true) - $start) * 1000);
$biomeCache = [];
for($x = 0; $x < 16; ++$x){
for($z = 0; $z < 16; ++$z){
@ -133,10 +144,21 @@ class Normal extends Generator{
$maxSum = 0;
$weightSum = 0;
//TODO: biome things
$minSum = 63;
$maxSum = 127;
$weightSum += 1;
for($sx = -self::$SMOOTH_SIZE; $sx <= self::$SMOOTH_SIZE; ++$sx){
for($sz = -self::$SMOOTH_SIZE; $sz <= self::$SMOOTH_SIZE; ++$sz){
if(isset($biomeCache[$index = (($chunkX * 16 + $x + $sx * 16) >> 2) . ":" . (($chunkZ * 16 + $z + $sz * 16) >> 2)])){
$adjacent = $biomeCache[$index];
}else{
$adjacent = $this->selector->pickBiome($chunkX * 16 + $x + $sx * 16, $chunkZ * 16 + $z + $sz * 16);
$biomeCache[$index] = $adjacent;
}
/** @var NormalBiome $adjacent */
$weight = self::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE][$sz + self::$SMOOTH_SIZE];
$minSum += $adjacent->getMinElevation() * $weight;
$maxSum += $adjacent->getMaxElevation() * $weight;
$weightSum += $weight;
}
}
$minElevation = $minSum / $weightSum;
$smoothHeight = ($maxSum / $weightSum - $minElevation) / 2;
@ -154,10 +176,14 @@ class Normal extends Generator{
if($y <= $this->waterHeight){
$chunk->setBlockId($x, $y, $z, Block::STILL_WATER);
}
$chunk->setBlockSkyLight($x, $y, $z, 15);
}
}
}
}
var_dump((microtime(true) - $start) * 1000);
}
public function populateChunk($chunkX, $chunkZ){

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\normal\biome;
class BeachBiome extends GrassyBiome{
public function __construct(){
parent::__construct();
$this->setElevation(62, 65);
}
public function getName(){
return "Beach";
}
}

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\normal\biome;
class DesertBiome extends GrassyBiome{
public function __construct(){
parent::__construct();
$this->setElevation(63, 74);
}
public function getName(){
return "Desert";
}
}

View File

@ -0,0 +1,47 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\normal\biome;
use pocketmine\level\generator\populator\TallGrass;
use pocketmine\level\generator\populator\Tree;
class ForestBiome extends GrassyBiome{
public function __construct(){
parent::__construct();
$trees = new Tree();
$trees->setBaseAmount(5);
$this->addPopulator($trees);
$tallGrass = new TallGrass();
$tallGrass->setBaseAmount(3);
$this->addPopulator($tallGrass);
$this->setElevation(63, 81);
}
public function getName(){
return "Forest";
}
}

View File

@ -0,0 +1,37 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\normal\biome;
use pocketmine\block\Block;
abstract class GrassyBiome extends NormalBiome{
public function __construct(){
$this->setGroundCover([
Block::get(Block::GRASS, 0),
Block::get(Block::DIRT, 0),
Block::get(Block::DIRT, 0),
Block::get(Block::DIRT, 0),
Block::get(Block::DIRT, 0),
]);
}
}

View File

@ -0,0 +1,49 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\normal\biome;
use pocketmine\level\generator\populator\TallGrass;
use pocketmine\level\generator\populator\Tree;
class MountainsBiome extends GrassyBiome{
public function __construct(){
parent::__construct();
$trees = new Tree();
$trees->setBaseAmount(1);
$this->addPopulator($trees);
$tallGrass = new TallGrass();
$tallGrass->setBaseAmount(1);
$this->addPopulator($tallGrass);
//TODO: add emerald
$this->setElevation(63, 127);
}
public function getName(){
return "Mountains";
}
}

View File

@ -0,0 +1,53 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\normal\biome;
use pocketmine\level\generator\biome\Biome;
abstract class NormalBiome extends Biome{
private $minElevation;
private $maxElevation;
private $groundCover = [];
public function getMinElevation(){
return $this->minElevation;
}
public function getMaxElevation(){
return $this->maxElevation;
}
public function setElevation($min, $max){
$this->minElevation = $min;
$this->maxElevation = $max;
}
public function getGroundCover(){
return $this->groundCover;
}
public function setGroundCover(array $covers){
$this->groundCover = $covers;
}
}

View File

@ -0,0 +1,42 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\normal\biome;
use pocketmine\level\generator\populator\TallGrass;
class OceanBiome extends GrassyBiome{
public function __construct(){
parent::__construct();
$tallGrass = new TallGrass();
$tallGrass->setBaseAmount(5);
$this->addPopulator($tallGrass);
$this->setElevation(46, 58);
}
public function getName(){
return "Ocean";
}
}

View File

@ -0,0 +1,42 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\normal\biome;
use pocketmine\level\generator\populator\TallGrass;
class PlainBiome extends GrassyBiome{
public function __construct(){
parent::__construct();
$tallGrass = new TallGrass();
$tallGrass->setBaseAmount(5);
$this->addPopulator($tallGrass);
$this->setElevation(63, 74);
}
public function getName(){
return "Plains";
}
}

View File

@ -0,0 +1,42 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\normal\biome;
use pocketmine\level\generator\populator\TallGrass;
class RiverBiome extends GrassyBiome{
public function __construct(){
parent::__construct();
$tallGrass = new TallGrass();
$tallGrass->setBaseAmount(5);
$this->addPopulator($tallGrass);
$this->setElevation(58, 62);
}
public function getName(){
return "River";
}
}

View File

@ -0,0 +1,36 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\normal\biome;
use pocketmine\block\Block;
abstract class SandyBiome extends NormalBiome{
public function __construct(){
$this->setGroundCover([
Block::get(Block::SAND, 0),
Block::get(Block::SANDSTONE, 0),
Block::get(Block::SANDSTONE, 0),
Block::get(Block::SANDSTONE, 0),
]);
}
}

View File

@ -0,0 +1,38 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\level\generator\normal\biome;
use pocketmine\level\generator\populator\TallGrass;
use pocketmine\level\generator\populator\Tree;
class SmallMountainsBiome extends MountainsBiome{
public function __construct(){
parent::__construct();
$this->setElevation(63, 97);
}
public function getName(){
return "Small Mountains";
}
}