◆ __construct()
__construct |
( |
Random |
$random, |
|
|
callable |
$lookup, |
|
|
Biome |
$fallback |
|
) |
| |
45 $this->fallback = $fallback;
46 $this->lookup = $lookup;
47 $this->temperature =
new Simplex($random, 2, 1 / 16, 1 / 512);
48 $this->rainfall =
new Simplex($random, 2, 1 / 16, 1 / 512);
◆ addBiome()
62 $this->biomes[$biome->getId()] = $biome;
◆ getRainfall()
70 return ($this->rainfall->noise2D($x, $z,
true) + 1) / 2;
◆ getTemperature()
getTemperature |
( |
|
$x, |
|
|
|
$z |
|
) |
| |
66 return ($this->temperature->noise2D($x, $z,
true) + 1) / 2;
◆ pickBiome()
- Parameters
-
- Returns
- Biome
81 $rainfall = (int) ($this->
getRainfall($x, $z) * 63);
83 $biomeId = $this->map[$temperature + ($rainfall << 6)];
84 return isset($this->biomes[$biomeId]) ? $this->biomes[$biomeId] : $this->fallback;
◆ recalculate()
52 $this->map = new \SplFixedArray(64 * 64);
54 for($i = 0; $i < 64; ++$i){
55 for($j = 0; $j < 64; ++$j){
56 $this->map[$i + ($j << 6)] = call_user_func($this->lookup, $i / 63, $j / 63);
The documentation for this class was generated from the following file:
- src/pocketmine/level/generator/biome/BiomeSelector.php