Skip to content

Chunk ​

class · pocketmine\world\format\Chunk · source

Constants ​

COORD_BIT_SIZE ​

php
public const COORD_BIT_SIZE = \pocketmine\world\format\SubChunk::COORD_BIT_SIZE

COORD_MASK ​

php
public const COORD_MASK = \pocketmine\world\format\SubChunk::COORD_MASK

DIRTY_FLAGS_ALL ​

php
public const DIRTY_FLAGS_ALL = ~0

DIRTY_FLAGS_NONE ​

php
public const DIRTY_FLAGS_NONE = 0

DIRTY_FLAG_BIOMES ​

php
public const DIRTY_FLAG_BIOMES = 1 << 3

DIRTY_FLAG_BLOCKS ​

php
public const DIRTY_FLAG_BLOCKS = 1 << 0

EDGE_LENGTH ​

php
public const EDGE_LENGTH = \pocketmine\world\format\SubChunk::EDGE_LENGTH

MAX_SUBCHUNKS ​

php
public const MAX_SUBCHUNKS = self::MAX_SUBCHUNK_INDEX - self::MIN_SUBCHUNK_INDEX + 1

MAX_SUBCHUNK_INDEX ​

php
public const MAX_SUBCHUNK_INDEX = 19

MIN_SUBCHUNK_INDEX ​

php
public const MIN_SUBCHUNK_INDEX = -4

PENDING_ENTITY_IDENTIFIER 5.46.0 ​

php
public const PENDING_ENTITY_IDENTIFIER = "identifier"

Pending entity data: Bedrock entity identifier (string).

PENDING_ENTITY_POS 5.46.0 ​

php
public const PENDING_ENTITY_POS = "Pos"

Pending entity data: position in the world (list of 3 doubles).

PENDING_ENTITY_ROTATION 5.46.0 ​

php
public const PENDING_ENTITY_ROTATION = "Rotation"

Pending entity data: yaw and pitch (list of 2 floats, optional).

Properties ​

$heightMap protected ​

php
protected \pocketmine\world\format\HeightArray $heightMap

$lightPopulated protected ​

php
protected ?bool $lightPopulated

$subChunks protected ​

php
protected \SplFixedArray $subChunks

$terrainPopulated protected ​

php
protected bool $terrainPopulated

$tiles protected ​

php
protected array $tiles

Methods ​

__clone() ​

php
public function __clone()

__construct() ​

php
public function __construct(array $subChunks, bool $terrainPopulated)

addPendingEntityNBT() 5.46.0 ​

php
public function addPendingEntityNBT(\pocketmine\nbt\tag\CompoundTag $nbt) : void

Adds 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 ​

php
public function addPendingTileNBT(\pocketmine\nbt\tag\CompoundTag $nbt) : void

Adds 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() ​

php
public function addTile(\pocketmine\block\tile\Tile $tile) : void

blockHash() ​

php
public static function blockHash(int $x, int $y, int $z) : int

Hashes the given chunk block coordinates into a single integer.

clearPendingEntityNBT() 5.46.0 ​

php
public function clearPendingEntityNBT() : void

clearPendingTileNBT() 5.46.0 ​

php
public function clearPendingTileNBT() : void

clearTerrainDirtyFlags() ​

php
public function clearTerrainDirtyFlags() : void

collectGarbage() ​

php
public function collectGarbage() : void

Disposes of empty subchunks and frees data where possible

getBiomeId() ​

php
public function getBiomeId(int $x, int $y, int $z) : int

Returns the biome ID at the specified X/Z chunk block coordinates

getBlockStateId() ​

php
public function getBlockStateId(int $x, int $y, int $z) : int

Returns the internal ID of the blockstate at the given coordinates.

getHeight() ​

php
public function getHeight() : int

Returns the chunk height in count of subchunks.

getHeightMap() ​

php
public function getHeightMap(int $x, int $z) : int

Returns the heightmap value at the specified X/Z chunk block coordinates

getHeightMapArray() ​

php
public function getHeightMapArray() : array

getHighestBlockAt() ​

php
public function getHighestBlockAt(int $x, int $z) : ?int

Returns the Y coordinate of the highest non-air block at the specified X/Z chunk block coordinates

getPendingEntityNBT() 5.46.0 ​

php
public function getPendingEntityNBT() : array

getPendingTileNBT() 5.46.0 ​

php
public function getPendingTileNBT() : array

getPendingTileNBTAt() 5.46.0 ​

php
public function getPendingTileNBTAt(int $x, int $y, int $z) : ?\pocketmine\nbt\tag\CompoundTag

Returns the pending block entity data at the given chunk block coordinates, or null.

getSubChunk() ​

php
public function getSubChunk(int $y) : \pocketmine\world\format\SubChunk

getSubChunks() ​

php
public function getSubChunks() : array

getTerrainDirtyFlag() ​

php
public function getTerrainDirtyFlag(int $flag) : bool

getTerrainDirtyFlags() ​

php
public function getTerrainDirtyFlags() : int

getTile() ​

php
public function getTile(int $x, int $y, int $z) : ?\pocketmine\block\tile\Tile

Returns the tile at the specified chunk block coordinates, or null if no tile exists.

getTiles() ​

php
public function getTiles() : array

isLightPopulated() ​

php
public function isLightPopulated() : ?bool

isPopulated() ​

php
public function isPopulated() : bool

isTerrainDirty() ​

php
public function isTerrainDirty() : bool

onUnload() ​

php
public function onUnload() : void

Called when the chunk is unloaded, closing entities and tiles.

removePendingTileNBT() 5.46.0 ​

php
public function removePendingTileNBT(int $x, int $y, int $z) : void

Removes the pending block entity data at the given chunk block coordinates, if any.

removeTile() ​

php
public function removeTile(\pocketmine\block\tile\Tile $tile) : void

setBiomeId() ​

php
public function setBiomeId(int $x, int $y, int $z, int $biomeId) : void

Sets the biome ID at the specified X/Z chunk block coordinates

setBlockStateId() ​

php
public function setBlockStateId(int $x, int $y, int $z, int $block) : void

Sets the blockstate at the given coordinate by internal ID.

setHeightMap() ​

php
public function setHeightMap(int $x, int $z, int $value) : void

Returns the heightmap value at the specified X/Z chunk block coordinates

setHeightMapArray() ​

php
public function setHeightMapArray(array $values) : void

setLightPopulated() ​

php
public function setLightPopulated(?bool $value = true) : void

setPopulated() ​

php
public function setPopulated(bool $value = true) : void

setSubChunk() ​

php
public function setSubChunk(int $y, ?\pocketmine\world\format\SubChunk $subChunk) : void

Sets a subchunk in the chunk index

setTerrainDirty() ​

php
public function setTerrainDirty() : void

setTerrainDirtyFlag() ​

php
public function setTerrainDirtyFlag(int $flag, bool $value) : void

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