Ejemplo n.º 1
0
 public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random)
 {
     if ($random->nextRange(0, $this->waterOdd) === 0) {
         $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 16);
         $y = $random->nextBoundedInt(128);
         $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 16);
         $pond = new \BukkitPE\level\generator\object\Pond($random, new Water());
         if ($pond->canPlaceObject($level, $x, $y, $z)) {
             $pond->placeObject($level, $x, $y, $z);
         }
     }
 }
Ejemplo n.º 2
0
 public static function growGrass(ChunkManager $level, Vector3 $pos, Random $random, $count = 15, $radius = 10)
 {
     $arr = [[Block::DANDELION, 0], [Block::POPPY, 0], [Block::TALL_GRASS, 1], [Block::TALL_GRASS, 1], [Block::TALL_GRASS, 1], [Block::TALL_GRASS, 1]];
     $arrC = count($arr) - 1;
     for ($c = 0; $c < $count; ++$c) {
         $x = $random->nextRange($pos->x - $radius, $pos->x + $radius);
         $z = $random->nextRange($pos->z - $radius, $pos->z + $radius);
         if ($level->getBlockIdAt($x, $pos->y + 1, $z) === Block::AIR and $level->getBlockIdAt($x, $pos->y, $z) === Block::GRASS) {
             $t = $arr[$random->nextRange(0, $arrC)];
             $level->setBlockIdAt($x, $pos->y + 1, $z, $t[0]);
             $level->setBlockDataAt($x, $pos->y + 1, $z, $t[1]);
         }
     }
 }
Ejemplo n.º 3
0
 public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random)
 {
     $this->level = $level;
     $amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount;
     for ($i = 0; $i < $amount; ++$i) {
         $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15);
         $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15);
         $y = $this->getHighestWorkableBlock($x, $z);
         if ($y === -1) {
             continue;
         }
         ObjectTree::growTree($this->level, $x, $y, $z, $random, $this->type);
     }
 }
Ejemplo n.º 4
0
 public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random)
 {
     foreach ($this->oreTypes as $type) {
         $ore = new ObjectOre($random, $type);
         for ($i = 0; $i < $ore->type->clusterCount; ++$i) {
             $x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15);
             $y = $random->nextRange($ore->type->minHeight, $ore->type->maxHeight);
             $z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15);
             if ($ore->canPlaceObject($level, $x, $y, $z)) {
                 $ore->placeObject($level, $x, $y, $z);
             }
         }
     }
 }
Ejemplo n.º 5
0
 public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random)
 {
     $this->level = $level;
     $amount = $random->nextRange(0, $this->randomAmount + 1) + $this->baseAmount;
     for ($i = 0; $i < $amount; ++$i) {
         $x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);
         $z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);
         $y = $this->getHighestWorkableBlock($x, $z);
         if ($y !== -1 and $this->canTallGrassStay($x, $y, $z)) {
             $this->level->setBlockIdAt($x, $y, $z, Block::TALL_GRASS);
             $this->level->setBlockDataAt($x, $y, $z, 1);
         }
     }
 }
Ejemplo n.º 6
0
 public function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random)
 {
     if ($random->nextRange(0, self::$ODD) === 0) {
         //$mineshaft = new Mineshaft($random);
     }
 }