SkyLightUpdate
extends LightUpdate
in package
Table of Contents
- ADJACENTS = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]]
- $lightFilters : SplFixedArray|array<string|int, int>
- $subChunkExplorer : SubChunkExplorer
- $updateNodes : array<string|int, array<string|int, int>>
- $directSkyLightBlockers : SplFixedArray|array<string|int, bool>
- __construct() : mixed
- execute() : int
- recalculateChunk() : int
- Scans for all light sources in the target chunk and adds them to the propagation queue.
- recalculateNode() : void
- setAndUpdateLight() : void
- computeRemoveLight() : void
- computeSpreadLight() : void
- getCurrentLightArray() : LightArray
- getEffectiveLight() : int
- getHighestAdjacentLight() : int
- prepareNodes() : LightPropagationContext
- recalculateHeightMap() : HeightArray
- Recalculates the heightmap for the whole chunk.
- recalculateHeightMapColumn() : int
- Recalculates the heightmap for the block column at the specified X/Z chunk coordinates
Constants
ADJACENTS
private
mixed
ADJACENTS
= [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]]
Properties
$lightFilters
protected
SplFixedArray|array<string|int, int>
$lightFilters
Tags
$subChunkExplorer
protected
SubChunkExplorer
$subChunkExplorer
$updateNodes
protected
array<string|int, array<string|int, int>>
$updateNodes
= []
blockhash => [x, y, z, new light level]
Tags
$directSkyLightBlockers
private
SplFixedArray|array<string|int, bool>
$directSkyLightBlockers
Tags
Methods
__construct()
public
__construct(SubChunkExplorer $subChunkExplorer, SplFixedArray|array<string|int, int> $lightFilters, SplFixedArray|array<string|int, bool> $directSkyLightBlockers) : mixed
Parameters
- $subChunkExplorer : SubChunkExplorer
- $lightFilters : SplFixedArray|array<string|int, int>
- $directSkyLightBlockers : SplFixedArray|array<string|int, bool>
Tags
Return values
mixed —execute()
public
execute() : int
Return values
int —recalculateChunk()
Scans for all light sources in the target chunk and adds them to the propagation queue.
public
recalculateChunk(int $chunkX, int $chunkZ) : int
This erases preexisting light in the chunk.
Parameters
- $chunkX : int
- $chunkZ : int
Return values
int —recalculateNode()
public
recalculateNode(int $x, int $y, int $z) : void
Parameters
- $x : int
- $y : int
- $z : int
Return values
void —setAndUpdateLight()
public
setAndUpdateLight(int $x, int $y, int $z, int $newLevel) : void
Parameters
- $x : int
- $y : int
- $z : int
- $newLevel : int
Return values
void —computeRemoveLight()
protected
computeRemoveLight(int $x, int $y, int $z, int $oldAdjacentLevel, LightPropagationContext $context) : void
Parameters
- $x : int
- $y : int
- $z : int
- $oldAdjacentLevel : int
- $context : LightPropagationContext
Return values
void —computeSpreadLight()
protected
computeSpreadLight(int $x, int $y, int $z, int $newAdjacentLevel, LightPropagationContext $context) : void
Parameters
- $x : int
- $y : int
- $z : int
- $newAdjacentLevel : int
- $context : LightPropagationContext
Return values
void —getCurrentLightArray()
protected
getCurrentLightArray() : LightArray
Return values
LightArray —getEffectiveLight()
protected
getEffectiveLight(int $x, int $y, int $z) : int
Parameters
- $x : int
- $y : int
- $z : int
Return values
int —getHighestAdjacentLight()
protected
getHighestAdjacentLight(int $x, int $y, int $z) : int
Parameters
- $x : int
- $y : int
- $z : int
Return values
int —prepareNodes()
private
prepareNodes() : LightPropagationContext
Return values
LightPropagationContext —recalculateHeightMap()
Recalculates the heightmap for the whole chunk.
private
static recalculateHeightMap(Chunk $chunk, SplFixedArray|array<string|int, bool> $directSkyLightBlockers) : HeightArray
Parameters
- $chunk : Chunk
- $directSkyLightBlockers : SplFixedArray|array<string|int, bool>
Tags
Return values
HeightArray —recalculateHeightMapColumn()
Recalculates the heightmap for the block column at the specified X/Z chunk coordinates
private
static recalculateHeightMapColumn(Chunk $chunk, int $x, int $z, SplFixedArray|array<string|int, bool> $directSkyLightBlockers) : int
Parameters
- $chunk : Chunk
- $x : int
-
0-15
- $z : int
-
0-15
- $directSkyLightBlockers : SplFixedArray|array<string|int, bool>
Tags
Return values
int —New calculated heightmap value (0-256 inclusive)