StructureManager 5.46.0
The structures of one generator (dimension): where structure starts are (placement + start generation, a pure function of the seed so every worker thread agrees), and their placement chunk by chunk during decoration (vanilla's STRUCTURE_STARTS / STRUCTURE_REFERENCES statuses and the structure part of applyBiomeDecoration()).
Starts are computed on demand and kept in a bounded cache; nothing is shared between threads.
Properties
$env
public readonly \pocketmine\world\generator\vanilla\structure\StructureEnvironment $env$startsComputed
public int $startsComputedMethods
__construct()
public function __construct(\pocketmine\world\generator\vanilla\structure\StructureEnvironment $env, string $positionMode = \pocketmine\world\generator\vanilla\structure\placement\BedrockStructurePlacements::MODE_BEDROCK, array $disabled = [], array $dimensionBiomes = [])getBeardifier()
public function getBeardifier(int $chunkX, int $chunkZ) : ?\pocketmine\world\generator\vanilla\structure\BeardifierThe terrain adaptation of the structures referenced by a chunk (Beardifier.forStructuresInChunk()), for the terrain filler, or null if there is none. Starts are computed if needed (from the terrain without adaptation, like vanilla's STRUCTURE_STARTS before NOISE).
getPlacement()
public function getPlacement(string $setId) : ?\pocketmine\world\generator\vanilla\structure\placement\StructurePlacementgetPlacements()
public function getPlacements() : arraygetSetStructures()
public function getSetStructures(string $setId) : arraygetStart()
public function getStart(string $setId, int $chunkX, int $chunkZ) : ?\pocketmine\world\generator\vanilla\structure\StructureStartThe start of a structure set in a chunk, or null (ChunkGenerator.createStructures() for one set).
getStartsAffecting()
public function getStartsAffecting(int $chunkX, int $chunkZ, bool $adaptingOnly = false) : arrayThe starts whose bounding box touches the chunk (vanilla's structure references of the chunk).
hasStructureChunkInRange()
public function hasStructureChunkInRange(string $setId, int $chunkX, int $chunkZ, int $range) : boolChunkGeneratorStructureState.hasStructureChunkInRange()
isStructureChunk()
public function isStructureChunk(string $setId, int $chunkX, int $chunkZ) : boolStructurePlacement.isStructureChunk() for a set (cached).
locate()
public function locate(string $structure, int $x, int $z, int $radius = 100, ?int $maxChunks = null, ?\Closure $accept = null, ?int $deadlineNs = null) : ?arrayFinds a start of a structure (an id, a pattern like "village_*", or a structure set id) around a block position like Java Edition's /locate (ChunkGenerator.getNearestGeneratedStructure()): placement chunks are searched ring by ring of spacing-sized regions, up to $radius rings, and the first start found in a ring is the candidate of its set; the nearest candidate of all sets wins. Returns [structure id, start chunk x, start chunk z, locate x, locate y, locate z] or null.
With $maxChunks, the number of rings of each set is derived from that distance in chunks instead (rounded up to whole regions; ring-placed starts farther than that are skipped). $accept, if given, filters starts by their start chunk (e.g. only chunks that are not generated yet). $deadlineNs (an hrtime() value) bounds the time spent: past it a LocateTimeoutException is thrown.
placeStep()
public function placeStep(\pocketmine\world\generator\vanilla\structure\StructurePlaceContext $c, array $starts, int $step, int $chunkX, int $chunkZ, int $decorationSeed, \pocketmine\world\generator\vanilla\feature\FeatureRandom $random) : voidPlaces the structures of a decoration step in a chunk (before the step's features), like ChunkGenerator.applyBiomeDecoration(): each structure gets the random setFeatureSeed(decorationSeed, index, step).
tryGenerate()
public function tryGenerate(\pocketmine\world\generator\vanilla\structure\StructureDefinition $structure, int $chunkX, int $chunkZ) : ?\pocketmine\world\generator\vanilla\structure\StructureStartStructure.generate(): finds the generation point, checks its biome and builds the pieces.
