|
| getLight (int $x, int $y, int $z) |
|
| setLight (int $x, int $y, int $z, int $level) |
|
| computeRemoveLight (int $x, int $y, int $z, int $oldAdjacentLevel) |
|
| computeSpreadLight (int $x, int $y, int $z, int $newAdjacentLevel) |
|
◆ __construct()
__construct |
( |
Level |
$level | ) |
|
42 $this->removalQueue = new \SplQueue();
43 $this->spreadQueue = new \SplQueue();
◆ addRemoveNode()
addRemoveNode |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z, |
|
|
int |
$oldLight |
|
) |
| |
53 $this->spreadQueue->enqueue([$x, $y, $z, $oldLight]);
◆ addSpreadNode()
addSpreadNode |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z |
|
) |
| |
48 $this->spreadQueue->enqueue([$x, $y, $z]);
◆ computeRemoveLight()
computeRemoveLight |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z, |
|
|
int |
$oldAdjacentLevel |
|
) |
| |
|
protected |
122 $current = $this->
getLight($x, $y, $z);
123 if ($current !== 0 and $current < $oldAdjacentLevel) {
126 $this->removalVisited[$index] =
true;
128 $this->removalQueue->enqueue([$x, $y, $z, $current]);
131 } elseif ($current >= $oldAdjacentLevel) {
133 $this->spreadVisited[$index] =
true;
134 $this->spreadQueue->enqueue([$x, $y, $z]);
◆ computeSpreadLight()
computeSpreadLight |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z, |
|
|
int |
$newAdjacentLevel |
|
) |
| |
|
protected |
141 $current = $this->
getLight($x, $y, $z);
142 $potentialLight = $newAdjacentLevel -
Block::$lightFilter[$this->level->getBlockIdAt($x, $y, $z)];
143 if ($current < $potentialLight) {
144 $this->
setLight($x, $y, $z, $potentialLight);
146 $this->spreadVisited[$index] =
true;
147 if ($potentialLight > 1) {
148 $this->spreadQueue->enqueue([$x, $y, $z]);
◆ execute()
80 while (!$this->removalQueue->isEmpty()) {
81 list($x, $y, $z, $oldAdjacentLight) = $this->removalQueue->dequeue();
90 foreach ($points as list($cx, $cy, $cz)) {
97 while (!$this->spreadQueue->isEmpty()) {
98 list($x, $y, $z) = $this->spreadQueue->dequeue();
99 $newAdjacentLight = $this->
getLight($x, $y, $z);
100 if ($newAdjacentLight <= 0) {
111 foreach ($points as list($cx, $cy, $cz)) {
◆ getLight()
getLight |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z |
|
) |
| |
|
abstractprotected |
◆ setAndUpdateLight()
setAndUpdateLight |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z, |
|
|
int |
$newLevel |
|
) |
| |
62 if (isset($this->spreadVisited[$index =
Level::blockHash($x, $y, $z)]) or isset($this->removalVisited[$index])) {
63 throw new \InvalidArgumentException(
"Already have a visit ready for this block");
65 $oldLevel = $this->
getLight($x, $y, $z);
66 if ($oldLevel !== $newLevel) {
67 $this->
setLight($x, $y, $z, $newLevel);
68 if ($oldLevel < $newLevel) {
69 $this->spreadVisited[$index] =
true;
70 $this->spreadQueue->enqueue([$x, $y, $z]);
72 $this->removalVisited[$index] =
true;
73 $this->removalQueue->enqueue([$x, $y, $z, $oldLevel]);
◆ setLight()
setLight |
( |
int |
$x, |
|
|
int |
$y, |
|
|
int |
$z, |
|
|
int |
$level |
|
) |
| |
|
abstractprotected |
◆ $level
◆ $removalQueue
◆ $removalVisited
◆ $spreadQueue
◆ $spreadVisited
The documentation for this class was generated from the following file:
- src/pocketmine/level/LightUpdate.php