Documentation

SubChunk
in package

Table of Contents

COORD_BIT_SIZE  = 4
COORD_MASK  = ~(~0 << self::COORD_BIT_SIZE)
EDGE_LENGTH  = 1 << self::COORD_BIT_SIZE
$blockLayers  : array<string|int, PalettedBlockArray>
$blockLight  : LightArray|null
$emptyBlockId  : int
$skyLight  : LightArray|null
__clone()  : mixed
__construct()  : mixed
SubChunk constructor.
__debugInfo()  : array<string|int, mixed>
collectGarbage()  : void
getBlockLayers()  : array<string|int, PalettedBlockArray>
getBlockLightArray()  : LightArray
getBlockSkyLightArray()  : LightArray
getEmptyBlockId()  : int
Returns the block used as the default. This is assumed to refer to air.
getFullBlock()  : int
getHighestBlockAt()  : int|null
isEmptyAuthoritative()  : bool
Returns whether this subchunk contains any non-air blocks.
isEmptyFast()  : bool
Returns a non-authoritative bool to indicate whether the chunk contains any blocks.
setBlockLightArray()  : void
setBlockSkyLightArray()  : void
setFullBlock()  : void

Constants

COORD_BIT_SIZE

public mixed COORD_BIT_SIZE = 4

COORD_MASK

public mixed COORD_MASK = ~(~0 << self::COORD_BIT_SIZE)

EDGE_LENGTH

public mixed EDGE_LENGTH = 1 << self::COORD_BIT_SIZE

Properties

$blockLayers

private array<string|int, PalettedBlockArray> $blockLayers

$blockLight

private LightArray|null $blockLight

$skyLight

private LightArray|null $skyLight

Methods

__clone()

public __clone() : mixed
Return values
mixed

__construct()

SubChunk constructor.

public __construct(int $emptyBlockId, array<string|int, PalettedBlockArray$blocks[, LightArray|null $skyLight = null ][, LightArray|null $blockLight = null ]) : mixed
Parameters
$emptyBlockId : int
$blocks : array<string|int, PalettedBlockArray>
$skyLight : LightArray|null = null
$blockLight : LightArray|null = null
Return values
mixed

__debugInfo()

public __debugInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

collectGarbage()

public collectGarbage() : void
Return values
void

getBlockLayers()

public getBlockLayers() : array<string|int, PalettedBlockArray>
Return values
array<string|int, PalettedBlockArray>

getBlockLightArray()

public getBlockLightArray() : LightArray
Return values
LightArray

getBlockSkyLightArray()

public getBlockSkyLightArray() : LightArray
Return values
LightArray

getEmptyBlockId()

Returns the block used as the default. This is assumed to refer to air.

public getEmptyBlockId() : int

If all the blocks in a subchunk layer are equal to this block, the layer is assumed to be empty.

Return values
int

getFullBlock()

public getFullBlock(int $x, int $y, int $z) : int
Parameters
$x : int
$y : int
$z : int
Return values
int

getHighestBlockAt()

public getHighestBlockAt(int $x, int $z) : int|null
Parameters
$x : int
$z : int
Return values
int|null

isEmptyAuthoritative()

Returns whether this subchunk contains any non-air blocks.

public isEmptyAuthoritative() : bool

This function will do a slow check, usually by garbage collecting first. This is typically useful for disk saving.

Return values
bool

isEmptyFast()

Returns a non-authoritative bool to indicate whether the chunk contains any blocks.

public isEmptyFast() : bool

This may report non-empty erroneously if the chunk has been modified and not garbage-collected.

Return values
bool

setBlockLightArray()

public setBlockLightArray(LightArray $data) : void
Parameters
$data : LightArray
Return values
void

setBlockSkyLightArray()

public setBlockSkyLightArray(LightArray $data) : void
Parameters
$data : LightArray
Return values
void

setFullBlock()

public setFullBlock(int $x, int $y, int $z, int $block) : void
Parameters
$x : int
$y : int
$z : int
$block : int
Return values
void

Search results