BiomeLocator 5.46.0
Finds the closest biome of a type for /locate biome. Worlds made by the vanilla generator are searched from the climate noise on an async worker without generating chunks (up to BiomeSearch::DEFAULT_RADIUS blocks); worlds of other generators can only be searched in their loaded chunks.
Biome names may be Bedrock ids ("mesa", "roofed_forest") or Java Edition ids ("badlands", "dark_forest"), with or without the "minecraft:" prefix.
Methods
getBedrockBiomeNames()
public static function getBedrockBiomeNames() : arrayBedrock biome names (the client suggests them for /locate biome).
getKnownBiomeNames()
public static function getKnownBiomeNames() : arrayEvery biome name /locate biome understands (Bedrock and Java Edition ids), for command suggestions.
locate()
public static function locate(\pocketmine\world\World $world, string $biome, \pocketmine\math\Vector3 $origin, \Closure $onCompletion, int $radius = \pocketmine\world\locate\BiomeSearch::DEFAULT_RADIUS, int $timeoutSeconds = 0) : boolStarts searching the closest biome named $biome from $origin. Returns false if no biome has that name; otherwise $onCompletion is called with the block position found (null if none), either right away or when the async search finishes ($failed = true if the search crashed, $timedOut = true if it gave up after $timeoutSeconds). Vanilla worlds are searched on the LocateWorkerPool, not on the server's async pool, which generates chunks.
resolveBiomeName()
public static function resolveBiomeName(string $name) : ?arrayReturns the Java Edition biome ids and the Bedrock biome ids named by the given name, or null if no biome has that name.
searchLoadedChunks()
public static function searchLoadedChunks(\pocketmine\world\World $world, array $bedrockIds, \pocketmine\math\Vector3 $origin, int $radius = \pocketmine\world\locate\BiomeSearch::DEFAULT_RADIUS) : ?\pocketmine\math\Vector3Closest position (horizontally) in the world's loaded chunks whose biome is one of $bedrockIds, sampled every 4 blocks at the origin's height and every BiomeSearch::DEFAULT_VERTICAL_STEP blocks above and below.
