Skip to content

ClimateBiomeTree 5.46.0 ​

final class · pocketmine\world\generator\vanilla\biome\ClimateBiomeTree · source

Multi-noise biome lookup: nearest climate parameter point in vanilla's R-tree (7 dimensions: temperature, humidity, continentalness, erosion, depth, weirdness, offset), with targets quantized to 1/10000 like vanilla.

The tree is built from the biome parameter points with vanilla's algorithm (same node layout), so ties are resolved in the same order. Nodes are stored in flat int arrays for the search loop.

Methods ​

__construct() ​

php
public function __construct(array $tree)

buildTree() ​

php
public static function buildTree(array $points) : array

Builds the search tree exactly as vanilla's Climate.RTree does (same buckets and child order, so that equal distances resolve to the same biome): nodes are returned in the layout accepted by the constructor.

fromData() ​

php
public static function fromData(\pocketmine\world\generator\vanilla\WorldgenData $data, string $dimension = "overworld") : self

Uses the tree saved by VanillaDataFetcher when there is one, otherwise builds it from the biome parameters.

getBiomeNames() ​

php
public function getBiomeNames() : array

getSingleBiome() ​

php
public function getSingleBiome() : ?int

Returns the biome index if the tree has a single biome (see single()), null otherwise.

quantize() ​

php
public static function quantize(float $value) : int

Vanilla quantization: (long) ((float) value * 10000.0F)

readParameterPoints() ​

php
public static function readParameterPoints(array $report) : array

Reads the biome parameter points from the data generator's biome_parameters report: {"biomes": [{"biome": id, "parameters": {temperature, humidity, continentalness, erosion, depth, weirdness, offset}}]} where each parameter is a number or a [min, max] pair (unquantized). Order is preserved: it decides ties.

php
public function search(int $temperature, int $humidity, int $continentalness, int $erosion, int $depth, int $weirdness) : int

Returns the biome index (see getBiomeNames()) closest to the quantized target.

searchIsolated() ​

php
public function searchIsolated(int $temperature, int $humidity, int $continentalness, int $erosion, int $depth, int $weirdness) : int

Like search(), but without the last-result hint and without changing it: the result never depends on earlier searches (vanilla's hint only changes which of several equally close biomes wins).

single() ​

php
public static function single(string $biome) : self

A tree with a single biome (every search returns it), for dimensions without a multi-noise biome source.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.