VanillaStructureLocator 5.46.0
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()
public static function createStructureManager(string $generatorClass, int $seed, string $options) : ?\pocketmine\world\generator\vanilla\structure\StructureManagerBuilds 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()
public static function forget(\pocketmine\world\World $world) : voidForgets the cached generator of a world (e.g. when it is unloaded).
getStructureIds()
public static function getStructureIds(\pocketmine\world\World $world) : arrayIds of the structures that can generate in the world (implemented, enabled, possible in its biomes).
getStructureManager()
public static function getStructureManager(\pocketmine\world\World $world) : ?\pocketmine\world\generator\vanilla\structure\StructureManagerThe structures of a world, or null if it is not a vanilla world or has structures disabled.
locate()
public static function locate(\pocketmine\world\World $world, string $structure, int $x, int $z, int $radius = 100) : ?arrayLike 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.
