added all genisys biomes

This commit is contained in:
GameHerobrine 2023-03-07 21:20:25 +03:00
parent 8df552c372
commit 7052af0609
11 changed files with 151 additions and 2 deletions

View file

@ -134,6 +134,8 @@ require_once(FILE_PATH . "/src/world/generator/LevelGenerator.php");
require_once(FILE_PATH . "/src/world/generator/biome/Biome.php");
require_once(FILE_PATH . "/src/world/generator/biome/BiomeSelector.php");
require_once(FILE_PATH . "/src/world/generator/biome/biomes/BiomeWithGrass.php");
require_once(FILE_PATH . "/src/world/generator/biome/biomes/BiomeWithSand.php");
require_once(FILE_PATH . "/src/world/generator/biome/biomes/BiomeWithSnow.php");
require_once(FILE_PATH . "/src/world/generator/biome/biomes/BiomeExtremeHills.php");
require_all(FILE_PATH . "src/");

View file

@ -49,6 +49,13 @@ abstract class Biome{
BiomeSelector::registerBiome(new BiomePlains(BIOME_PLAINS, "Plains"));
BiomeSelector::registerBiome(new BiomeExtremeHillsEdge(BIOME_EXTREME_HILLS_EDGE, "Extreme Hills Edge"));
BiomeSelector::registerBiome(new BiomeRiver(BIOME_RIVER, "River"));
BiomeSelector::registerBiome(new BiomeOcean(BIOME_OCEAN, "Ocean"));
BiomeSelector::registerBiome(new BiomeSwamp(BIOME_SWAMP, "Swamp"));
BiomeSelector::registerBiome(new BiomeIcePlains(BIOME_ICE_PLAINS, "Ice Plains"));
BiomeSelector::registerBiome(new BiomeDesert(BIOME_DESERT, "Desert"));
BiomeSelector::registerBiome(new BiomeTaiga(BIOME_TAIGA, "Taiga"));
BiomeSelector::registerBiome(new BiomeForest(BIOME_FOREST, "Forest"));
BiomeSelector::registerBiome(new BiomeForest(BIOME_BIRCH_FOREST, "Birch Forest"));
}
private static $initialized = false;

View file

@ -45,8 +45,30 @@ class BiomeSelector
}
public function getBiomeTR($t, $r){
if($r < 0.60){
return BIOME_PLAINS;
if($r < 0.25){
if($t < 0.7){
return BIOME_OCEAN;
}else if($t < 0.85){
return BIOME_RIVER;
}else{
return BIOME_SWAMP;
}
}else if($r < 0.60){
if($t < 0.25){
return BIOME_ICE_PLAINS;
}else if($t < 0.75){
return BIOME_PLAINS;
}else{
return BIOME_DESERT;
}
}else if($r < 0.80){
if($t < 0.25){
return BIOME_TAIGA;
}else if($t < 0.75){
return BIOME_FOREST;
}else{
return BIOME_BIRCH_FOREST;
}
}else{
if($t < 0.25){
return BIOME_EXTREME_HILLS;

View file

@ -0,0 +1,10 @@
<?php
class BiomeDesert extends BiomeWithSand
{
public function __construct($id, $name){
parent::__construct($id, $name);
$this->setMinMax(63, 74);
}
}

View file

@ -0,0 +1,11 @@
<?php
class BiomeForest extends BiomeWithGrass
{
public function __construct($id, $name){ //TODO tree populators
parent::__construct($id, $name);
$this->setMinMax(63, 81);
}
}

View file

@ -0,0 +1,11 @@
<?php
class BiomeIcePlains extends BiomeWithSnow
{
public function __construct($id, $name){
parent::__construct($id, $name);
$this->setMinMax(63, 74);
}
}

View file

@ -0,0 +1,11 @@
<?php
class BiomeOcean extends BiomeWithGrass
{
public function __construct($id, $name){
parent::__construct($id, $name);
//TODO pop sugarcane, tallgrass
$this->setMinMax(46, 68);
}
}

View file

@ -0,0 +1,20 @@
<?php
class BiomeSwamp extends BiomeWithGrass
{
public function __construct($id, $name){ //TODO more beautiful?
parent::__construct($id, $name);
/*$flower = new Flower();
$flower->setBaseAmount(8);
$flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_BLUE_ORCHID]);
$this->addPopulator($flower);
$lilypad = new LilyPad();
$lilypad->setBaseAmount(4);
$this->addPopulator($lilypad);
*/
$this->setMinMax(62, 63);
}
}

View file

@ -0,0 +1,17 @@
<?php
class BiomeTaiga extends BiomeWithSnow
{
public function __construct($id, $name){
parent::__construct($id, $name);
$this->setMinMax(63, 81);
$this->setTopBlocks([
[PODZOL, 0],
[DIRT, 0],
[DIRT, 0],
[DIRT, 0],
]);
}
}

View file

@ -0,0 +1,21 @@
<?php
class BiomeWithSand extends Biome
{
public function __construct($id, $name){
parent::__construct($id, $name);
$this->setMinMax(63, 81);
$this->setTopBlocks([
[SAND, 0],
[SAND, 0],
[SAND, 0],
[SAND, 0],
[SANDSTONE, 0],
[SANDSTONE, 0],
[SANDSTONE, 0],
[SANDSTONE, 0],
]);
$this->setFillerBlock(STONE);
}
}

View file

@ -0,0 +1,17 @@
<?php
class BiomeWithSnow extends Biome
{
public function __construct($id, $name){
parent::__construct($id, $name);
$this->setTopBlocks([
[SNOW_LAYER, 0],
[GRASS, 0],
[DIRT, 0],
[DIRT, 0],
[DIRT, 0],
]);
$this->setFillerBlock(STONE);
}
}