BlockLightUpdate
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>>
- $lightEmitters : SplFixedArray|array<string|int, int>
- __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
- scanForLightEmittingBlocks() : int
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
$lightEmitters
private
SplFixedArray|array<string|int, int>
$lightEmitters
Tags
Methods
__construct()
public
__construct(SubChunkExplorer $subChunkExplorer, SplFixedArray|array<string|int, int> $lightFilters, SplFixedArray|array<string|int, int> $lightEmitters) : mixed
Parameters
- $subChunkExplorer : SubChunkExplorer
- $lightFilters : SplFixedArray|array<string|int, int>
- $lightEmitters : SplFixedArray|array<string|int, int>
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 —scanForLightEmittingBlocks()
private
scanForLightEmittingBlocks(SubChunk $subChunk, int $baseX, int $baseY, int $baseZ) : int
Parameters
- $subChunk : SubChunk
- $baseX : int
- $baseY : int
- $baseZ : int