PocketMine-MP 5.23.3 git-f7687af337d001ddbcc47b8e773f014a33faa662
Loading...
Searching...
No Matches
Biome.php
1<?php
2
3/*
4 *
5 * ____ _ _ __ __ _ __ __ ____
6 * | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
7 * | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
8 * | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
9 * |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * @author PocketMine Team
17 * @link http://www.pocketmine.net/
18 *
19 *
20 */
21
22declare(strict_types=1);
23
24namespace pocketmine\world\biome;
25
30
31abstract class Biome{
32
33 public const MAX_BIOMES = 256;
34
35 private int $id;
36 private bool $registered = false;
37
39 private array $populators = [];
40
41 private int $minElevation;
42 private int $maxElevation;
43
45 private array $groundCover = [];
46
47 protected float $rainfall = 0.5;
48 protected float $temperature = 0.5;
49
50 public function clearPopulators() : void{
51 $this->populators = [];
52 }
53
54 public function addPopulator(Populator $populator) : void{
55 $this->populators[] = $populator;
56 }
57
58 public function populateChunk(ChunkManager $world, int $chunkX, int $chunkZ, Random $random) : void{
59 foreach($this->populators as $populator){
60 $populator->populate($world, $chunkX, $chunkZ, $random);
61 }
62 }
63
67 public function getPopulators() : array{
68 return $this->populators;
69 }
70
71 public function setId(int $id) : void{
72 if(!$this->registered){
73 $this->registered = true;
74 $this->id = $id;
75 }
76 }
77
78 public function getId() : int{
79 return $this->id;
80 }
81
82 abstract public function getName() : string;
83
84 public function getMinElevation() : int{
85 return $this->minElevation;
86 }
87
88 public function getMaxElevation() : int{
89 return $this->maxElevation;
90 }
91
92 public function setElevation(int $min, int $max) : void{
93 $this->minElevation = $min;
94 $this->maxElevation = $max;
95 }
96
100 public function getGroundCover() : array{
101 return $this->groundCover;
102 }
103
107 public function setGroundCover(array $covers) : void{
108 $this->groundCover = $covers;
109 }
110
111 public function getTemperature() : float{
112 return $this->temperature;
113 }
114
115 public function getRainfall() : float{
116 return $this->rainfall;
117 }
118}
setGroundCover(array $covers)
Definition Biome.php:107