FeatureLevel 5.46.0
The decoration region (vanilla's WorldGenRegion for the FEATURES step): the 3x3 chunks around the decorated chunk, read and written as Java block states. Blocks written by features are remembered as Java states, so later reads see exactly what was written (the Bedrock mapping is lossy for a few properties, e.g. leaf distance); other blocks are mapped back from the PocketMine states.
Heightmaps are computed from the current blocks on first use and kept up to date on writes, like vanilla's chunk heightmaps (Heightmap.update()).
Constants
MOTION_BLOCKING
public const MOTION_BLOCKING = 4MOTION_BLOCKING_NO_LEAVES
public const MOTION_BLOCKING_NO_LEAVES = 5OCEAN_FLOOR
public const OCEAN_FLOOR = 3OCEAN_FLOOR_WG
public const OCEAN_FLOOR_WG = 2SIZE
public const SIZE = 48WORLD_SURFACE
public const WORLD_SURFACE = 1WORLD_SURFACE_WG
public const WORLD_SURFACE_WG = 0Properties
$biomes
public readonly \pocketmine\world\generator\vanilla\feature\FeatureBiomes $biomes$blocks
public readonly \pocketmine\world\generator\vanilla\feature\block\JavaBlocks $blocks$centerChunkX
public int $centerChunkX$centerChunkZ
public int $centerChunkZ$height
public readonly int $height$logWrites
public bool $logWritesWhether writes are logged in $writeLog (the native decoration mirrors the region and needs the writes made on the PHP side).
$maxY
public readonly int $maxY$minX
public int $minX$minY
public readonly int $minY$minZ
public int $minZ$regionRandom
public ?\pocketmine\world\generator\vanilla\random\RandomSource $regionRandomPositional random of this region (WorldGenRegion.getRandom()), set by the decorator.
$seaLevel
public readonly int $seaLevel$seed
public readonly int $seed$terrainHeightProvider
public ?\Closure $terrainHeightProvider$writeLog
public array $writeLogLogged writes: key, Java state pairs (key bit 31: written by setPmState(), which does not update heightmaps).
Methods
__construct()
public function __construct(\pocketmine\world\generator\vanilla\feature\block\JavaBlocks $blocks, int $minY, int $height, int $seaLevel, int $seed, \pocketmine\world\generator\vanilla\feature\FeatureBiomes $biomes)addEntity()
public function addEntity(int $x, int $z, \pocketmine\nbt\tag\CompoundTag $nbt) : boolAdds an entity to spawn with the chunk of its position (Chunk::addPendingEntityNBT()). Returns false if the position is outside the region.
applyNativeWrites()
public function applyNativeWrites(array $keys, array $states, array $blockEntities = []) : voidApplies writes made by the native decoration (which already applied them to its own copy of the region): each one exactly like setState(), without logging.
begin()
public function begin(\pocketmine\world\ChunkManager $world, int $chunkX, int $chunkZ) : voidensureCanWrite()
public function ensureCanWrite(int $x, int $y, int $z) : boolWhether a block can be written (inside the 3x3 chunks and the build height), WorldGenRegion.ensureCanWrite().
finish()
public function finish() : voidMarks the modified chunks as dirty, so PocketMine sends them back from the worker.
getBiome()
public function getBiome(int $x, int $y, int $z) : intgetHeight()
public function getHeight(int $type, int $x, int $z) : intFirst free y above the highest block matching the heightmap type (vanilla's getHeight()).
getKnownTerrainHeights()
public function getKnownTerrainHeights() : arrayTerrain heightmaps computed so far in this decoration, by region chunk index.
getRegionChunk()
public function getRegionChunk(int $dx, int $dz) : \pocketmine\world\format\ChunkIndex of the chunk at the given offset from the centre chunk (dx, dz in -1..1).
getRegionSubChunk()
public function getRegionSubChunk(int $chunkIndex, int $section) : \pocketmine\world\format\SubChunkSection of a chunk of the region (chunk index (dx + 1) * 3 + dz + 1, section 0 = minY).
getState()
public function getState(int $x, int $y, int $z) : intisEmptyBlock()
public function isEmptyBlock(int $x, int $y, int $z) : boolisInRegion()
public function isInRegion(int $x, int $z) : boolisInsideBuildHeight()
public function isInsideBuildHeight(int $y) : boolisOutsideBuildHeight()
public function isOutsideBuildHeight(int $y) : boolisWaterAt()
public function isWaterAt(int $x, int $y, int $z) : boolsetBlockEntity()
public function setBlockEntity(int $x, int $y, int $z, \pocketmine\nbt\tag\CompoundTag $nbt) : boolGives the block at a position its block entity data (a tile's saved data, created when the chunk reaches the world, see Chunk::addPendingTileNBT()). Returns false if the position cannot be written.
setPmState()
public function setPmState(int $x, int $y, int $z, int $pmState) : boolSets a Bedrock-only block (a PocketMine state id with no Java block state, e.g. an item frame, which is an entity in Java). Later reads of the position see the Java state the Bedrock state maps back to. Heightmaps are not updated (only meant for blocks without collision). Returns false if the position cannot be written.
setState()
public function setState(int $x, int $y, int $z, int $state) : boolSets a block (WorldGenRegion.setBlock()). Returns false if the position cannot be written.
setTerrainHeights()
public function setTerrainHeights(int $chunkIndex, array $heights) : voidSets the terrain heightmaps of a chunk of the region (computed by the native decoration).
terrainHeightsOf()
public function terrainHeightsOf(int $chunkIndex) : arrayTerrain heightmaps (WORLD_SURFACE_WG, OCEAN_FLOOR_WG) of a chunk of the region (index (dx + 1) * 3 + dz + 1), computed on first use and then kept for the rest of the decoration.
