Skip to content

VanillaStructureLocator 5.46.0 ​

final class · pocketmine\world\generator\vanilla\structure\VanillaStructureLocator · source

Finds structures of vanilla worlds from the main thread, without generating chunks (for a /locate-like command or plugins): structure positions are a pure function of the seed, so the world's generator settings are enough.

The first query of a world builds a generator for it (a second or two); later queries reuse it. Structure starts still need the terrain heights of their area, computed by the terrain core (fast with the native core).

Methods ​

createStructureManager() ​

php
public static function createStructureManager(string $generatorClass, int $seed, string $options) : ?\pocketmine\world\generator\vanilla\structure\StructureManager

Builds the structure manager of a vanilla generator class with the given settings, or returns null for other generators, invalid options or disabled structures. Usable on any thread (e.g. a /locate worker).

forget() ​

php
public static function forget(\pocketmine\world\World $world) : void

Forgets the cached generator of a world (e.g. when it is unloaded).

getStructureIds() ​

php
public static function getStructureIds(\pocketmine\world\World $world) : array

Ids of the structures that can generate in the world (implemented, enabled, possible in its biomes).

getStructureManager() ​

php
public static function getStructureManager(\pocketmine\world\World $world) : ?\pocketmine\world\generator\vanilla\structure\StructureManager

The structures of a world, or null if it is not a vanilla world or has structures disabled.

locate() ​

php
public static function locate(\pocketmine\world\World $world, string $structure, int $x, int $z, int $radius = 100) : ?array

Like Java Edition's /locate structure: a structure id ("village_plains"), a pattern ("village_*") or a structure set id, searched from a block position. Returns [structure id, start chunk x, start chunk z, x, y, z] (the position /locate reports, y being 0 or the set's locate offset) or null.

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