PocketMine-MP 5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
Loading...
Searching...
No Matches
pocketmine\world\format\Chunk Class Reference
+ Collaboration diagram for pocketmine\world\format\Chunk:

Public Member Functions

 __construct (array $subChunks, bool $terrainPopulated)
 
 __clone ()
 
 addTile (Tile $tile)
 
 clearTerrainDirtyFlags ()
 
 collectGarbage ()
 
 getBiomeId (int $x, int $y, int $z)
 
 getBlockStateId (int $x, int $y, int $z)
 
 getHeight ()
 
 getHeightMap (int $x, int $z)
 
 getHeightMapArray ()
 
 getHighestBlockAt (int $x, int $z)
 
 getSubChunk (int $y)
 
 getSubChunks ()
 
 getTerrainDirtyFlag (int $flag)
 
 getTerrainDirtyFlags ()
 
 getTile (int $x, int $y, int $z)
 
 getTiles ()
 
 isLightPopulated ()
 
 isPopulated ()
 
 isTerrainDirty ()
 
 onUnload ()
 
 removeTile (Tile $tile)
 
 setBiomeId (int $x, int $y, int $z, int $biomeId)
 
 setBlockStateId (int $x, int $y, int $z, int $block)
 
 setHeightMap (int $x, int $z, int $value)
 
 setHeightMapArray (array $values)
 
 setLightPopulated (?bool $value=true)
 
 setPopulated (bool $value=true)
 
 setSubChunk (int $y, ?SubChunk $subChunk)
 
 setTerrainDirty ()
 
 setTerrainDirtyFlag (int $flag, bool $value)
 

Static Public Member Functions

static blockHash (int $x, int $y, int $z)
 

Public Attributes

const COORD_BIT_SIZE = SubChunk::COORD_BIT_SIZE
 
const COORD_MASK = SubChunk::COORD_MASK
 
const DIRTY_FLAG_BIOMES = 1 << 3
 
const DIRTY_FLAG_BLOCKS = 1 << 0
 
const DIRTY_FLAGS_ALL = ~0
 
const DIRTY_FLAGS_NONE = 0
 
const EDGE_LENGTH = SubChunk::EDGE_LENGTH
 
const MAX_SUBCHUNK_INDEX = 19
 
const MAX_SUBCHUNKS = self::MAX_SUBCHUNK_INDEX - self::MIN_SUBCHUNK_INDEX + 1
 
const MIN_SUBCHUNK_INDEX = -4
 

Protected Attributes

HeightArray $heightMap
 
bool $lightPopulated = false
 
SplFixedArray $subChunks
 
bool $terrainPopulated = false
 
array $tiles = []
 

Detailed Description

Definition at line 34 of file Chunk.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\world\format\Chunk::__construct ( array $subChunks,
bool $terrainPopulated )
Parameters
SubChunk[]$subChunks

Definition at line 68 of file Chunk.php.

Member Function Documentation

◆ __clone()

pocketmine\world\format\Chunk::__clone ( )

Definition at line 320 of file Chunk.php.

◆ addTile()

pocketmine\world\format\Chunk::addTile ( Tile $tile)

Definition at line 194 of file Chunk.php.

◆ blockHash()

static pocketmine\world\format\Chunk::blockHash ( int $x,
int $y,
int $z )
static

Hashes the given chunk block coordinates into a single integer.

Parameters
int$x0-15
int$ydependent on the height of the world
int$z0-15

Definition at line 335 of file Chunk.php.

◆ clearTerrainDirtyFlags()

pocketmine\world\format\Chunk::clearTerrainDirtyFlags ( )

Definition at line 276 of file Chunk.php.

◆ collectGarbage()

pocketmine\world\format\Chunk::collectGarbage ( )

Disposes of empty subchunks and frees data where possible

Definition at line 314 of file Chunk.php.

◆ getBiomeId()

pocketmine\world\format\Chunk::getBiomeId ( int $x,
int $y,
int $z )

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

Parameters
int$x0-15
int$ydependent on the height of the world
int$z0-15
See also
BiomeIds

Definition at line 158 of file Chunk.php.

◆ getBlockStateId()

pocketmine\world\format\Chunk::getBlockStateId ( int $x,
int $y,
int $z )

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

Parameters
int$x0-15
int$ydependent on the height of the world
int$z0-15
Returns
int the blockstate ID of the given block

Definition at line 98 of file Chunk.php.

◆ getHeight()

pocketmine\world\format\Chunk::getHeight ( )

Returns the chunk height in count of subchunks.

Definition at line 85 of file Chunk.php.

◆ getHeightMap()

pocketmine\world\format\Chunk::getHeightMap ( int $x,
int $z )

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

Parameters
int$x0-15
int$z0-15

Definition at line 135 of file Chunk.php.

◆ getHeightMapArray()

pocketmine\world\format\Chunk::getHeightMapArray ( )
Returns
int[]

Definition at line 241 of file Chunk.php.

◆ getHighestBlockAt()

pocketmine\world\format\Chunk::getHighestBlockAt ( int $x,
int $z )

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

Parameters
int$x0-15
int$z0-15
Returns
int|null the Y coordinate, or null if there are no blocks in the column

Definition at line 118 of file Chunk.php.

Referenced by pocketmine\world\World\getHighestBlockAt().

+ Here is the caller graph for this function:

◆ getSubChunk()

pocketmine\world\format\Chunk::getSubChunk ( int $y)

Definition at line 280 of file Chunk.php.

◆ getSubChunks()

pocketmine\world\format\Chunk::getSubChunks ( )
Returns
SubChunk[] @phpstan-return array<int, SubChunk>

Definition at line 303 of file Chunk.php.

◆ getTerrainDirtyFlag()

pocketmine\world\format\Chunk::getTerrainDirtyFlag ( int $flag)

Definition at line 256 of file Chunk.php.

◆ getTerrainDirtyFlags()

pocketmine\world\format\Chunk::getTerrainDirtyFlags ( )

Definition at line 260 of file Chunk.php.

◆ getTile()

pocketmine\world\format\Chunk::getTile ( int $x,
int $y,
int $z )

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

Parameters
int$x0-15
int$ydependent on the height of the world
int$z0-15

Definition at line 225 of file Chunk.php.

◆ getTiles()

pocketmine\world\format\Chunk::getTiles ( )
Returns
Tile[]

Definition at line 214 of file Chunk.php.

◆ isLightPopulated()

pocketmine\world\format\Chunk::isLightPopulated ( )

Definition at line 177 of file Chunk.php.

◆ isPopulated()

pocketmine\world\format\Chunk::isPopulated ( )

Definition at line 185 of file Chunk.php.

◆ isTerrainDirty()

pocketmine\world\format\Chunk::isTerrainDirty ( )

Definition at line 252 of file Chunk.php.

◆ onUnload()

pocketmine\world\format\Chunk::onUnload ( )

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

Definition at line 232 of file Chunk.php.

◆ removeTile()

pocketmine\world\format\Chunk::removeTile ( Tile $tile)

Definition at line 206 of file Chunk.php.

◆ setBiomeId()

pocketmine\world\format\Chunk::setBiomeId ( int $x,
int $y,
int $z,
int $biomeId )

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

Parameters
int$x0-15
int$ydependent on the height of the world
int$z0-15
int$biomeIdA valid biome ID
See also
BiomeIds

Definition at line 172 of file Chunk.php.

◆ setBlockStateId()

pocketmine\world\format\Chunk::setBlockStateId ( int $x,
int $y,
int $z,
int $block )

Sets the blockstate at the given coordinate by internal ID.

Definition at line 105 of file Chunk.php.

◆ setHeightMap()

pocketmine\world\format\Chunk::setHeightMap ( int $x,
int $z,
int $value )

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

Parameters
int$x0-15
int$z0-15

Definition at line 145 of file Chunk.php.

◆ setHeightMapArray()

pocketmine\world\format\Chunk::setHeightMapArray ( array $values)
Parameters
int[]$values

Definition at line 248 of file Chunk.php.

◆ setLightPopulated()

pocketmine\world\format\Chunk::setLightPopulated ( ?bool $value = true)

Definition at line 181 of file Chunk.php.

◆ setPopulated()

pocketmine\world\format\Chunk::setPopulated ( bool $value = true)

Definition at line 189 of file Chunk.php.

◆ setSubChunk()

pocketmine\world\format\Chunk::setSubChunk ( int $y,
?SubChunk $subChunk )

Sets a subchunk in the chunk index

Definition at line 290 of file Chunk.php.

◆ setTerrainDirty()

pocketmine\world\format\Chunk::setTerrainDirty ( )

Definition at line 272 of file Chunk.php.

◆ setTerrainDirtyFlag()

pocketmine\world\format\Chunk::setTerrainDirtyFlag ( int $flag,
bool $value )

Definition at line 264 of file Chunk.php.

Member Data Documentation

◆ $heightMap

HeightArray pocketmine\world\format\Chunk::$heightMap
protected

Definition at line 63 of file Chunk.php.

◆ $lightPopulated

bool pocketmine\world\format\Chunk::$lightPopulated = false
protected

Definition at line 51 of file Chunk.php.

◆ $subChunks

SplFixedArray pocketmine\world\format\Chunk::$subChunks
protected

Definition at line 58 of file Chunk.php.

◆ $terrainPopulated

bool pocketmine\world\format\Chunk::$terrainPopulated = false
protected

Definition at line 52 of file Chunk.php.

◆ $tiles

array pocketmine\world\format\Chunk::$tiles = []
protected

Definition at line 61 of file Chunk.php.

◆ COORD_BIT_SIZE

const pocketmine\world\format\Chunk::COORD_BIT_SIZE = SubChunk::COORD_BIT_SIZE

Definition at line 46 of file Chunk.php.

◆ COORD_MASK

const pocketmine\world\format\Chunk::COORD_MASK = SubChunk::COORD_MASK

Definition at line 47 of file Chunk.php.

◆ DIRTY_FLAG_BIOMES

const pocketmine\world\format\Chunk::DIRTY_FLAG_BIOMES = 1 << 3

Definition at line 36 of file Chunk.php.

◆ DIRTY_FLAG_BLOCKS

const pocketmine\world\format\Chunk::DIRTY_FLAG_BLOCKS = 1 << 0

Definition at line 35 of file Chunk.php.

◆ DIRTY_FLAGS_ALL

const pocketmine\world\format\Chunk::DIRTY_FLAGS_ALL = ~0

Definition at line 38 of file Chunk.php.

◆ DIRTY_FLAGS_NONE

const pocketmine\world\format\Chunk::DIRTY_FLAGS_NONE = 0

Definition at line 39 of file Chunk.php.

◆ EDGE_LENGTH

const pocketmine\world\format\Chunk::EDGE_LENGTH = SubChunk::EDGE_LENGTH

Definition at line 45 of file Chunk.php.

◆ MAX_SUBCHUNK_INDEX

const pocketmine\world\format\Chunk::MAX_SUBCHUNK_INDEX = 19

Definition at line 42 of file Chunk.php.

◆ MAX_SUBCHUNKS

const pocketmine\world\format\Chunk::MAX_SUBCHUNKS = self::MAX_SUBCHUNK_INDEX - self::MIN_SUBCHUNK_INDEX + 1

Definition at line 43 of file Chunk.php.

◆ MIN_SUBCHUNK_INDEX

const pocketmine\world\format\Chunk::MIN_SUBCHUNK_INDEX = -4

Definition at line 41 of file Chunk.php.


The documentation for this class was generated from the following file: