StructureLocator 5.46.0
Finds generated (or to-be-generated) structures for /locate structure. A structure generator implements this and registers it in StructureLocators, for a generator name (every world of that generator) or for one world.
Both methods are called on the main thread while a player waits for the command, so they must be reasonably fast and must not generate chunks: compute the structure positions from the seed (structure placement grids) and check the biome from the generator's biome source rather than from chunks. Locators whose searches can take longer should implement AsyncStructureLocator, whose searches /locate runs off the main thread.
Methods
findNearest()
public function findNearest(\pocketmine\world\World $world, string $structureId, \pocketmine\math\Vector3 $from, int $radiusChunks, bool $newChunksOnly) : ?\pocketmine\math\Vector3Returns the position of the structure of the given type closest to $from within $radiusChunks chunks (horizontally), or null if there is none. The Y coordinate may be a guess (the command shows "y?" like Bedrock).
getStructureIds()
public function getStructureIds() : arrayStructure ids this locator can find, lowercase without namespace, using the Bedrock /locate names where they exist (e.g. "village", "stronghold", "fortress", "monument", "mansion", "ruined_portal", "end_city").
