Skip to content

AsyncStructureLocator 5.46.0 ​

interface · pocketmine\world\generator\structure\AsyncStructureLocator · source

Extends StructureLocator

A StructureLocator whose searches can be slow (seconds), so /locate structure runs them off the main thread through findNearestAsync() instead of calling findNearest().

Methods ​

findNearestAsync() ​

php
public function findNearestAsync(\pocketmine\world\World $world, string $structureId, \pocketmine\math\Vector3 $from, int $radiusChunks, bool $newChunksOnly, int $timeoutSeconds, \Closure $onCompletion) : void

Like findNearest(), but the result is passed to $onCompletion later, on the main thread: the position found (or null), $failed = true if the search crashed, $timedOut = true if it gave up after $timeoutSeconds.

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