Inheritance: extends Populator
Beispiel #1
0
 public function __construct()
 {
     parent::__construct();
     $sugarcane = new Sugarcane();
     $sugarcane->setBaseAmount(6);
     $tallGrass = new TallGrass();
     $tallGrass->setBaseAmount(25);
     $waterPit = new WaterPit();
     $waterPit->setBaseAmount(9999);
     $lilyPad = new LilyPad();
     $lilyPad->setBaseAmount(8);
     $flower = new Flower();
     $flower->setBaseAmount(2);
     $flower->addType([Block::DANDELION, 0]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_POPPY]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_AZURE_BLUET]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_RED_TULIP]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_ORANGE_TULIP]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_WHITE_TULIP]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_PINK_TULIP]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_OXEYE_DAISY]);
     $this->addPopulator($sugarcane);
     $this->addPopulator($tallGrass);
     $this->addPopulator($flower);
     $this->addPopulator($waterPit);
     $this->addPopulator($lilyPad);
     $this->setElevation(61, 68);
     $this->temperature = 0.8;
     $this->rainfall = 0.4;
 }
 public function __construct()
 {
     parent::__construct();
     $tallGrass = new TallGrass();
     $tallGrass->setBaseAmount(5);
     $this->addPopulator($tallGrass);
     $this->setElevation(63, 74);
     $this->temperature = 0.05;
     $this->rainfall = 0.8;
 }
Beispiel #3
0
 public function __construct()
 {
     parent::__construct();
     $this->setGroundCover([Block::get(Block::DIRT, 0), Block::get(Block::DIRT, 0), Block::get(Block::DIRT, 0), Block::get(Block::DIRT, 0), Block::get(Block::DIRT, 0)]);
     $tallGrass = new TallGrass();
     $tallGrass->setBaseAmount(5);
     $this->addPopulator($tallGrass);
     $this->setElevation(46, 68);
     $this->temperature = 0.5;
     $this->rainfall = 0.5;
 }
 public function __construct()
 {
     parent::__construct();
     $trees = new Tree(Sapling::SPRUCE);
     $trees->setBaseAmount(10);
     $this->addPopulator($trees);
     $tallGrass = new TallGrass();
     $tallGrass->setBaseAmount(1);
     $this->addPopulator($tallGrass);
     $this->setElevation(63, 81);
     $this->temperature = 0.05;
     $this->rainfall = 0.8;
 }
Beispiel #5
0
 public function __construct()
 {
     parent::__construct();
     $sugarcane = new Sugarcane();
     $sugarcane->setBaseAmount(6);
     $tallGrass = new TallGrass();
     $tallGrass->setBaseAmount(5);
     $this->addPopulator($sugarcane);
     $this->addPopulator($tallGrass);
     $this->setElevation(46, 68);
     $this->temperature = 0.5;
     $this->rainfall = 0.5;
 }
 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);
     $this->temperature = 0.4;
     $this->rainfall = 0.5;
 }
Beispiel #7
0
 public function __construct()
 {
     parent::__construct();
     $tallGrass = new TallGrass();
     $tallGrass->setBaseAmount(12);
     $waterPit = new WaterPit();
     $waterPit->setBaseAmount(9999);
     $lilyPad = new LilyPad();
     $lilyPad->setBaseAmount(8);
     $this->addPopulator($tallGrass);
     $this->addPopulator($waterPit);
     $this->addPopulator($lilyPad);
     $this->setElevation(61, 68);
     $this->temperature = 0.8;
     $this->rainfall = 0.4;
 }
Beispiel #8
0
 public function __construct($type = self::TYPE_NORMAL)
 {
     parent::__construct();
     $this->type = $type;
     $trees = new Tree($type === self::TYPE_BIRCH ? Sapling::BIRCH : Sapling::OAK);
     $trees->setBaseAmount(5);
     $this->addPopulator($trees);
     $tallGrass = new TallGrass();
     $tallGrass->setBaseAmount(3);
     $this->addPopulator($tallGrass);
     $this->setElevation(63, 81);
     if ($type === self::TYPE_BIRCH) {
         $this->temperature = 0.5;
         $this->rainfall = 0.5;
     } else {
         $this->temperature = 0.7;
         $this->temperature = 0.8;
     }
 }
Beispiel #9
0
 public function init(GenerationChunkManager $level, Random $random)
 {
     $this->level = $level;
     $this->random = $random;
     $this->random->setSeed($this->level->getSeed());
     $this->noiseHills = new Simplex($this->random, 3, 0.1, 12);
     $this->noiseBase = new Simplex($this->random, 16, 0.6, 16);
     $ores = new Ore();
     $ores->setOreTypes([new OreType(new CoalOre(), 20, 16, 0, 128), new OreType(new IronOre(), 20, 8, 0, 64), new OreType(new RedstoneOre(), 8, 7, 0, 16), new OreType(new LapisOre(), 1, 6, 0, 32), new OreType(new GoldOre(), 2, 8, 0, 32), new OreType(new DiamondOre(), 1, 7, 0, 16), new OreType(new Dirt(), 20, 32, 0, 128), new OreType(new Gravel(), 10, 16, 0, 128)]);
     $this->populators[] = $ores;
     $trees = new Tree();
     $trees->setBaseAmount(1);
     $trees->setRandomAmount(1);
     $this->populators[] = $trees;
     $tallGrass = new TallGrass();
     $tallGrass->setBaseAmount(5);
     $tallGrass->setRandomAmount(0);
     $this->populators[] = $tallGrass;
 }
 public function __construct()
 {
     parent::__construct();
     $tallGrass = new TallGrass();
     $tallGrass->setBaseAmount(12);
     $flower = new Flower();
     $flower->setBaseAmount(2);
     $flower->addType([Block::DANDELION, 0]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_POPPY]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_AZURE_BLUET]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_RED_TULIP]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_ORANGE_TULIP]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_WHITE_TULIP]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_PINK_TULIP]);
     $flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_OXEYE_DAISY]);
     $this->addPopulator($tallGrass);
     $this->addPopulator($flower);
     $this->setElevation(63, 74);
     $this->temperature = 0.8;
     $this->rainfall = 0.4;
 }
Beispiel #11
0
 public function init(GenerationChunkManager $level, Random $random)
 {
     $this->level = $level;
     $this->random = $random;
     $this->random->setSeed($this->level->getSeed());
     $this->noiseHills = new Simplex($this->random, 3, 0.1, 12);
     $this->noiseBase = new Simplex($this->random, 16, 0.6, 16);
     $this->parsePreset($this->preset);
     if (isset($this->cfg["decoration"])) {
         $ores = new Ore();
         $ores->setOreTypes([new OreType(new CoalOre(), 20, 16, 0, 128), new OreType(new IronOre(), 20, 8, 0, 64), new OreType(new RedstoneOre(), 8, 7, 0, 16), new OreType(new LapisOre(), 1, 6, 0, 32), new OreType(new GoldOre(), 2, 8, 0, 32), new OreType(new DiamondOre(), 1, 7, 0, 16), new OreType(new Dirt(), 20, 32, 0, 128), new OreType(new Gravel(), 10, 16, 0, 128)]);
         $this->populators[] = $ores;
         if (isset($this->cfg["decoration"]["treecount"])) {
             $tc = explode(":", $this->cfg["decoration"]["treecount"]);
             if (!isset($tc[0])) {
                 $tc[0] = 0;
             }
             if (!isset($tc[1])) {
                 $tc[0] = 0;
             }
             if ($tc[0] != 0 && $tc[1] != 0) {
                 $trees = new Tree();
                 $trees->setBaseAmount($tc[0]);
                 $trees->setRandomAmount($tc[1]);
                 $this->populators[] = $trees;
             }
         }
         if (isset($this->cfg["decoration"]["grasscount"])) {
             $tc = explode(":", $this->cfg["decoration"]["grasscount"]);
             if (!isset($tc[0])) {
                 $tc[0] = 0;
             }
             if (!isset($tc[1])) {
                 $tc[0] = 0;
             }
             if ($tc[0] != 0 && $tc[1] != 0) {
                 $tallGrass = new TallGrass();
                 $tallGrass->setBaseAmount($tc[0]);
                 $tallGrass->setRandomAmount($tc[1]);
                 $this->populators[] = $tallGrass;
             }
         }
         if (isset($this->cfg["decoration"]["desertplant"])) {
             $tc = explode(":", $this->cfg["decoration"]["desertplant"]);
             if (!isset($tc[0])) {
                 $tc[0] = 0;
             }
             if (!isset($tc[1])) {
                 $tc[0] = 0;
             }
             if ($tc[0] != 0 && $tc[1] != 0) {
                 $cacti = new DesertPlant();
                 $cacti->setBaseAmount($tc[0]);
                 $cacti->setRandomAmount($tc[1]);
                 $this->populators[] = $cacti;
             }
         }
     }
     if (isset($this->cfg["dsq"])) {
         $dsq = $this->cfg["dsq"];
     } else {
         $dsq = array();
     }
     // Define some suitable defaults
     $min = isset($dsq["min"]) ? intval($dsq["min"]) : 32;
     $max = isset($dsq["max"]) ? intval($dsq["max"]) : 120;
     if ($min > $max) {
         list($min, $max) = array($max, $min);
     }
     //$this->waterLevel = isset($dsq["water"])?
     //intval($dsq["water"]):$min+($max-$min)/3;
     //$off = floatval(isset($dsq["off"]) ? intval($dsq["off"]) : 100);
     $this->waterBlock = isset($dsq["waterblock"]) ? intval($dsq["waterblock"]) : Block::STILL_WATER;
     //$this->dotsz = floatval(isset($dsq["dotsz"]) ? $dsq["dotsz"] : 0.9);
     //$this->dotoff= array('x'=>intval((1.0-$this->dotsz)*$this->rnd()
     //*self::DSQ_SIZE),
     //'y'=>intval((1.0-$this->dotsz)*$this->rnd()
     //*self::DSQ_SIZE));
     //$fn = isset($dsq["fn"]) ? $dsq["fn"] : "linear";
     //$fndat = explode(":",isset($dsq["fdat"]) ? $dsq["fdat"] : 1);
     // Strata map...
     $this->strata = array();
     if (isset($dsq["strata"])) {
         $strata = explode(":", $dsq["strata"]);
     } else {
         $strata = array();
     }
     $i = 0;
     for ($y = 0; $y < 128; ++$y) {
         if (isset($strata[$i])) {
             if ($strata[$i] > $y) {
                 $this->strata[$y] = $i;
             } else {
                 $this->strata[$y] = ++$i;
             }
         } else {
             $this->strata[$y] = $i;
         }
     }
 }