Chunk
Constants
COORD_BIT_SIZE
public const COORD_BIT_SIZE = \pocketmine\world\format\SubChunk::COORD_BIT_SIZECOORD_MASK
public const COORD_MASK = \pocketmine\world\format\SubChunk::COORD_MASKDIRTY_FLAGS_ALL
public const DIRTY_FLAGS_ALL = ~0DIRTY_FLAGS_NONE
public const DIRTY_FLAGS_NONE = 0DIRTY_FLAG_BIOMES
public const DIRTY_FLAG_BIOMES = 1 << 3DIRTY_FLAG_BLOCKS
public const DIRTY_FLAG_BLOCKS = 1 << 0EDGE_LENGTH
public const EDGE_LENGTH = \pocketmine\world\format\SubChunk::EDGE_LENGTHMAX_SUBCHUNKS
public const MAX_SUBCHUNKS = self::MAX_SUBCHUNK_INDEX - self::MIN_SUBCHUNK_INDEX + 1MAX_SUBCHUNK_INDEX
public const MAX_SUBCHUNK_INDEX = 19MIN_SUBCHUNK_INDEX
public const MIN_SUBCHUNK_INDEX = -4PENDING_ENTITY_IDENTIFIER 5.46.0
public const PENDING_ENTITY_IDENTIFIER = "identifier"Pending entity data: Bedrock entity identifier (string).
PENDING_ENTITY_POS 5.46.0
public const PENDING_ENTITY_POS = "Pos"Pending entity data: position in the world (list of 3 doubles).
PENDING_ENTITY_ROTATION 5.46.0
public const PENDING_ENTITY_ROTATION = "Rotation"Pending entity data: yaw and pitch (list of 2 floats, optional).
Properties
$heightMap protected
protected \pocketmine\world\format\HeightArray $heightMap$lightPopulated protected
protected ?bool $lightPopulated$subChunks protected
protected \SplFixedArray $subChunks$terrainPopulated protected
protected bool $terrainPopulated$tiles protected
protected array $tilesMethods
__clone()
public function __clone()__construct()
public function __construct(array $subChunks, bool $terrainPopulated)addPendingEntityNBT() 5.46.0
public function addPendingEntityNBT(\pocketmine\nbt\tag\CompoundTag $nbt) : voidAdds an entity that is spawned when the chunk is set in a world (World::setChunk()), the way world generators (which run without a world) add the mobs of generated structures (villagers, iron golems...). The tag holds the Bedrock entity identifier (Chunk::PENDING_ENTITY_IDENTIFIER), the world position (Chunk::PENDING_ENTITY_POS) and optionally the rotation (Chunk::PENDING_ENTITY_ROTATION). Entities PocketMine-MP cannot create are skipped.
addPendingTileNBT() 5.46.0
public function addPendingTileNBT(\pocketmine\nbt\tag\CompoundTag $nbt) : voidAdds block entity data that becomes a tile when the chunk is set in a world (World::setChunk()). This is how world generators, which run without a world and cannot create tiles, give blocks their data (dungeon chests, spawners, bee nests...). The tag is the tile's saved data: it must hold the tile id and the world coordinates of a block of this chunk. A pending tile at the same position is replaced.
addTile()
public function addTile(\pocketmine\block\tile\Tile $tile) : voidblockHash()
public static function blockHash(int $x, int $y, int $z) : intHashes the given chunk block coordinates into a single integer.
clearPendingEntityNBT() 5.46.0
public function clearPendingEntityNBT() : voidclearPendingTileNBT() 5.46.0
public function clearPendingTileNBT() : voidclearTerrainDirtyFlags()
public function clearTerrainDirtyFlags() : voidcollectGarbage()
public function collectGarbage() : voidDisposes of empty subchunks and frees data where possible
getBiomeId()
public function getBiomeId(int $x, int $y, int $z) : intReturns the biome ID at the specified X/Z chunk block coordinates
getBlockStateId()
public function getBlockStateId(int $x, int $y, int $z) : intReturns the internal ID of the blockstate at the given coordinates.
getHeight()
public function getHeight() : intReturns the chunk height in count of subchunks.
getHeightMap()
public function getHeightMap(int $x, int $z) : intReturns the heightmap value at the specified X/Z chunk block coordinates
getHeightMapArray()
public function getHeightMapArray() : arraygetHighestBlockAt()
public function getHighestBlockAt(int $x, int $z) : ?intReturns the Y coordinate of the highest non-air block at the specified X/Z chunk block coordinates
getPendingEntityNBT() 5.46.0
public function getPendingEntityNBT() : arraygetPendingTileNBT() 5.46.0
public function getPendingTileNBT() : arraygetPendingTileNBTAt() 5.46.0
public function getPendingTileNBTAt(int $x, int $y, int $z) : ?\pocketmine\nbt\tag\CompoundTagReturns the pending block entity data at the given chunk block coordinates, or null.
getSubChunk()
public function getSubChunk(int $y) : \pocketmine\world\format\SubChunkgetSubChunks()
public function getSubChunks() : arraygetTerrainDirtyFlag()
public function getTerrainDirtyFlag(int $flag) : boolgetTerrainDirtyFlags()
public function getTerrainDirtyFlags() : intgetTile()
public function getTile(int $x, int $y, int $z) : ?\pocketmine\block\tile\TileReturns the tile at the specified chunk block coordinates, or null if no tile exists.
getTiles()
public function getTiles() : arrayisLightPopulated()
public function isLightPopulated() : ?boolisPopulated()
public function isPopulated() : boolisTerrainDirty()
public function isTerrainDirty() : boolonUnload()
public function onUnload() : voidCalled when the chunk is unloaded, closing entities and tiles.
removePendingTileNBT() 5.46.0
public function removePendingTileNBT(int $x, int $y, int $z) : voidRemoves the pending block entity data at the given chunk block coordinates, if any.
removeTile()
public function removeTile(\pocketmine\block\tile\Tile $tile) : voidsetBiomeId()
public function setBiomeId(int $x, int $y, int $z, int $biomeId) : voidSets the biome ID at the specified X/Z chunk block coordinates
setBlockStateId()
public function setBlockStateId(int $x, int $y, int $z, int $block) : voidSets the blockstate at the given coordinate by internal ID.
setHeightMap()
public function setHeightMap(int $x, int $z, int $value) : voidReturns the heightmap value at the specified X/Z chunk block coordinates
setHeightMapArray()
public function setHeightMapArray(array $values) : voidsetLightPopulated()
public function setLightPopulated(?bool $value = true) : voidsetPopulated()
public function setPopulated(bool $value = true) : voidsetSubChunk()
public function setSubChunk(int $y, ?\pocketmine\world\format\SubChunk $subChunk) : voidSets a subchunk in the chunk index
setTerrainDirty()
public function setTerrainDirty() : voidsetTerrainDirtyFlag()
public function setTerrainDirtyFlag(int $flag, bool $value) : void