pocketmine\level\generator\biome\Biome::addPopulator PHP Method

addPopulator() public method

public addPopulator ( Populator $populator )
$populator pocketmine\level\generator\populator\Populator
    public function addPopulator(Populator $populator)
    {
        $this->populators[] = $populator;
    }

Usage Example

Example #1
0
 protected static function register($id, Biome $biome)
 {
     self::$biomes[(int) $id] = $biome;
     $biome->setId((int) $id);
     $biome->grassColor = self::generateBiomeColor($biome->getTemperature(), $biome->getRainfall());
     $flowerPopFound = false;
     foreach ($biome->getPopulators() as $populator) {
         if ($populator instanceof Flower) {
             $flowerPopFound = true;
             break;
         }
     }
     if ($flowerPopFound === false) {
         $flower = new Flower();
         $biome->addPopulator($flower);
     }
 }