Inheritance: extends Populator
コード例 #1
0
ファイル: Nether.php プロジェクト: ClearSkyTeam/ClearSky
 public function init(ChunkManager $level, Random $random)
 {
     $this->level = $level;
     $this->random = $random;
     $this->random->setSeed($this->level->getSeed());
     $this->noiseBase = new Simplex($this->random, 4, 1 / 4, 1 / 64);
     $this->random->setSeed($this->level->getSeed());
     $ores = new Ore();
     $ores->setOreTypes([new OreType(new QuartzOre(), 20, 8, 0, 64), new OreType(new Lava(), 1, 1, 0, 128)]);
     $this->populators[] = $ores;
 }
コード例 #2
0
ファイル: Flat.php プロジェクト: boybook/PocketMine-MP
 public function __construct(array $options = [])
 {
     $this->preset = "2;7,2x3,2;1;";
     //$this->preset = "2;7,59x1,3x3,2;1;spawn(radius=10 block=89),decoration(treecount=80 grasscount=45)";
     $this->options = $options;
     if (isset($this->options["decoration"])) {
         $ores = new Ore();
         $ores->setOreTypes([new object\OreType(new CoalOre(), 20, 16, 0, 128), new object\OreType(new IronOre(), 20, 8, 0, 64), new object\OreType(new RedstoneOre(), 8, 7, 0, 16), new object\OreType(new LapisOre(), 1, 6, 0, 32), new object\OreType(new GoldOre(), 2, 8, 0, 32), new object\OreType(new DiamondOre(), 1, 7, 0, 16), new object\OreType(new Dirt(), 20, 32, 0, 128), new object\OreType(new Gravel(), 10, 16, 0, 128)]);
         $this->populators[] = $ores;
     }
     /*if(isset($this->options["mineshaft"])){
     			$this->populators[] = new MineshaftPopulator(isset($this->options["mineshaft"]["chance"]) ? floatval($this->options["mineshaft"]["chance"]) : 0.01);
     		}*/
 }
コード例 #3
0
ファイル: Normal.php プロジェクト: hlogeon/PocketMineJs-MP
 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;
 }
コード例 #4
0
ファイル: Normal.php プロジェクト: Creeperface01/ImagicalMine
 public function init(ChunkManager $level, Random $random)
 {
     $this->level = $level;
     $this->random = $random;
     $this->random->setSeed($this->level->getSeed());
     $this->noiseBase = new Simplex($this->random, 4, 1 / 4, 1 / 32);
     $this->random->setSeed($this->level->getSeed());
     $this->selector = new BiomeSelector($this->random, function ($temperature, $rainfall) {
         if ($rainfall < 0.25) {
             if ($temperature < 0.7) {
                 return Biome::OCEAN;
             } elseif ($temperature < 0.85) {
                 return Biome::RIVER;
             } else {
                 return Biome::SWAMP;
             }
         } elseif ($rainfall < 0.6) {
             if ($temperature < 0.25) {
                 return Biome::ICE_PLAINS;
             } elseif ($temperature < 0.75) {
                 return Biome::PLAINS;
             } else {
                 return Biome::DESERT;
             }
         } elseif ($rainfall < 0.8) {
             if ($temperature < 0.25) {
                 return Biome::TAIGA;
             } elseif ($temperature < 0.75) {
                 return Biome::FOREST;
             } else {
                 return Biome::BIRCH_FOREST;
             }
         } else {
             if ($temperature < 0.25) {
                 return Biome::MOUNTAINS;
             } elseif ($temperature < 0.7) {
                 return Biome::SMALL_MOUNTAINS;
             } else {
                 return Biome::RIVER;
             }
         }
     }, Biome::getBiome(Biome::OCEAN));
     $this->selector->addBiome(Biome::getBiome(Biome::OCEAN));
     $this->selector->addBiome(Biome::getBiome(Biome::PLAINS));
     $this->selector->addBiome(Biome::getBiome(Biome::DESERT));
     $this->selector->addBiome(Biome::getBiome(Biome::MOUNTAINS));
     $this->selector->addBiome(Biome::getBiome(Biome::FOREST));
     $this->selector->addBiome(Biome::getBiome(Biome::TAIGA));
     $this->selector->addBiome(Biome::getBiome(Biome::SWAMP));
     $this->selector->addBiome(Biome::getBiome(Biome::RIVER));
     $this->selector->addBiome(Biome::getBiome(Biome::ICE_PLAINS));
     $this->selector->addBiome(Biome::getBiome(Biome::SMALL_MOUNTAINS));
     $this->selector->addBiome(Biome::getBiome(Biome::BIRCH_FOREST));
     $this->selector->recalculate();
     $cover = new GroundCover();
     $this->generationPopulators[] = $cover;
     $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 Stone(Stone::GRANITE), 20, 32, 0, 128), new OreType(new Stone(Stone::DIORITE), 20, 32, 0, 128), new OreType(new Stone(Stone::ANDESITE), 20, 32, 0, 128), new OreType(new Gravel(), 10, 16, 0, 128)]);
     $this->populators[] = $ores;
 }
コード例 #5
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;
         }
     }
 }
コード例 #6
0
ファイル: Nether.php プロジェクト: PepbookPvP/Genisys
 public function init(ChunkManager $level, Random $random)
 {
     $this->level = $level;
     $this->random = $random;
     $this->random->setSeed($this->level->getSeed());
     $this->noiseBase = new Simplex($this->random, 4, 1 / 4, 1 / 64);
     $this->random->setSeed($this->level->getSeed());
     $ores = new Ore();
     $ores->setOreTypes([new OreType(new Glowstone(), 15, 13, 118, 128), new OreType(new NetherQuartzOre(), 18, 12, 0, 128)]);
     $this->populators[] = $ores;
 }