Chunk: remove all proxy APIs to lighting information

these aren't used by internals and they shouldn't be used by plugins either.
This commit is contained in:
Dylan K. Taylor 2020-10-29 12:10:41 +00:00
parent ddc0f137e7
commit 3e1263eb79
2 changed files with 2 additions and 64 deletions

View File

@ -1826,7 +1826,7 @@ class World implements ChunkManager{
* @return int 0-15
*/
public function getBlockSkyLightAt(int $x, int $y, int $z) : int{
return $this->getOrLoadChunk($x >> 4, $z >> 4, true)->getBlockSkyLight($x & 0x0f, $y, $z & 0x0f);
return $this->getOrLoadChunk($x >> 4, $z >> 4, true)->getSubChunk($y >> 4)->getBlockSkyLightArray()->get($x & 0x0f, $y & 0xf, $z & 0x0f);
}
/**
@ -1835,7 +1835,7 @@ class World implements ChunkManager{
* @return int 0-15
*/
public function getBlockLightAt(int $x, int $y, int $z) : int{
return $this->getOrLoadChunk($x >> 4, $z >> 4, true)->getBlockLight($x & 0x0f, $y, $z & 0x0f);
return $this->getOrLoadChunk($x >> 4, $z >> 4, true)->getSubChunk($y >> 4)->getBlockLightArray()->get($x & 0x0f, $y & 0xf, $z & 0x0f);
}
public function getBiomeId(int $x, int $z) : int{

View File

@ -156,68 +156,6 @@ class Chunk{
$this->dirtyFlags |= self::DIRTY_FLAG_TERRAIN;
}
/**
* Returns the sky light level at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y 0-255
* @param int $z 0-15
*
* @return int 0-15
*/
public function getBlockSkyLight(int $x, int $y, int $z) : int{
return $this->getSubChunk($y >> 4)->getBlockSkyLightArray()->get($x & 0xf, $y & 0x0f, $z & 0xf);
}
/**
* Sets the sky light level at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y 0-255
* @param int $z 0-15
* @param int $level 0-15
*/
public function setBlockSkyLight(int $x, int $y, int $z, int $level) : void{
$this->getWritableSubChunk($y >> 4)->getBlockSkyLightArray()->set($x & 0xf, $y & 0x0f, $z & 0xf, $level);
}
public function setAllBlockSkyLight(int $level) : void{
for($y = $this->subChunks->count() - 1; $y >= 0; --$y){
$this->getWritableSubChunk($y)->setBlockSkyLightArray(LightArray::fill($level));
}
}
/**
* Returns the block light level at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y 0-255
* @param int $z 0-15
*
* @return int 0-15
*/
public function getBlockLight(int $x, int $y, int $z) : int{
return $this->getSubChunk($y >> 4)->getBlockLightArray()->get($x & 0xf, $y & 0x0f, $z & 0xf);
}
/**
* Sets the block light level at the specified chunk block coordinates
*
* @param int $x 0-15
* @param int $y 0-255
* @param int $z 0-15
* @param int $level 0-15
*/
public function setBlockLight(int $x, int $y, int $z, int $level) : void{
$this->getWritableSubChunk($y >> 4)->getBlockLightArray()->set($x & 0xf, $y & 0x0f, $z & 0xf, $level);
}
public function setAllBlockLight(int $level) : void{
for($y = $this->subChunks->count() - 1; $y >= 0; --$y){
$this->getWritableSubChunk($y)->setBlockLightArray(LightArray::fill($level));
}
}
/**
* Returns the Y coordinate of the highest non-air block at the specified X/Z chunk block coordinates
*