mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-18 09:24:05 +00:00
SubChunk: get rid of dead light getters and setters
these were here for fast access, but that fast access path now goes through getBlock(Sky)LightArray() instead.
This commit is contained in:
parent
c1212eab8e
commit
4264923f4f
@ -202,7 +202,7 @@ class Chunk{
|
|||||||
* @return int 0-15
|
* @return int 0-15
|
||||||
*/
|
*/
|
||||||
public function getBlockSkyLight(int $x, int $y, int $z) : int{
|
public function getBlockSkyLight(int $x, int $y, int $z) : int{
|
||||||
return $this->getSubChunk($y >> 4)->getBlockSkyLight($x, $y & 0x0f, $z);
|
return $this->getSubChunk($y >> 4)->getBlockSkyLightArray()->get($x & 0xf, $y & 0x0f, $z & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -214,7 +214,7 @@ class Chunk{
|
|||||||
* @param int $level 0-15
|
* @param int $level 0-15
|
||||||
*/
|
*/
|
||||||
public function setBlockSkyLight(int $x, int $y, int $z, int $level) : void{
|
public function setBlockSkyLight(int $x, int $y, int $z, int $level) : void{
|
||||||
$this->getSubChunk($y >> 4, true)->setBlockSkyLight($x, $y & 0x0f, $z, $level);
|
$this->getSubChunk($y >> 4, true)->getBlockSkyLightArray()->set($x & 0xf, $y & 0x0f, $z & 0xf, $level);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -238,7 +238,7 @@ class Chunk{
|
|||||||
* @return int 0-15
|
* @return int 0-15
|
||||||
*/
|
*/
|
||||||
public function getBlockLight(int $x, int $y, int $z) : int{
|
public function getBlockLight(int $x, int $y, int $z) : int{
|
||||||
return $this->getSubChunk($y >> 4)->getBlockLight($x, $y & 0x0f, $z);
|
return $this->getSubChunk($y >> 4)->getBlockLightArray()->get($x & 0xf, $y & 0x0f, $z & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -250,7 +250,7 @@ class Chunk{
|
|||||||
* @param int $level 0-15
|
* @param int $level 0-15
|
||||||
*/
|
*/
|
||||||
public function setBlockLight(int $x, int $y, int $z, int $level) : void{
|
public function setBlockLight(int $x, int $y, int $z, int $level) : void{
|
||||||
$this->getSubChunk($y >> 4, true)->setBlockLight($x, $y & 0x0f, $z, $level);
|
$this->getSubChunk($y >> 4, true)->getBlockLightArray()->set($x & 0xf, $y & 0x0f, $z & 0xf, $level);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,22 +51,6 @@ class EmptySubChunk implements SubChunkInterface{
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBlockLight(int $x, int $y, int $z) : int{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setBlockLight(int $x, int $y, int $z, int $level) : bool{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBlockSkyLight(int $x, int $y, int $z) : int{
|
|
||||||
return 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setBlockSkyLight(int $x, int $y, int $z, int $level) : bool{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getHighestBlockAt(int $x, int $z) : int{
|
public function getHighestBlockAt(int $x, int $z) : int{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -90,26 +90,6 @@ class SubChunk implements SubChunkInterface{
|
|||||||
return $this->blockLayers;
|
return $this->blockLayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBlockLight(int $x, int $y, int $z) : int{
|
|
||||||
return $this->blockLight->get($x, $y, $z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setBlockLight(int $x, int $y, int $z, int $level) : bool{
|
|
||||||
$this->blockLight->set($x, $y, $z, $level);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getBlockSkyLight(int $x, int $y, int $z) : int{
|
|
||||||
return $this->skyLight->get($x, $y, $z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setBlockSkyLight(int $x, int $y, int $z, int $level) : bool{
|
|
||||||
$this->skyLight->set($x, $y, $z, $level);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getHighestBlockAt(int $x, int $z) : int{
|
public function getHighestBlockAt(int $x, int $z) : int{
|
||||||
if(empty($this->blockLayers)){
|
if(empty($this->blockLayers)){
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -54,44 +54,6 @@ interface SubChunkInterface{
|
|||||||
*/
|
*/
|
||||||
public function getBlockLayers() : array;
|
public function getBlockLayers() : array;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $x
|
|
||||||
* @param int $y
|
|
||||||
* @param int $z
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getBlockLight(int $x, int $y, int $z) : int;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $x
|
|
||||||
* @param int $y
|
|
||||||
* @param int $z
|
|
||||||
* @param int $level
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function setBlockLight(int $x, int $y, int $z, int $level) : bool;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $x
|
|
||||||
* @param int $y
|
|
||||||
* @param int $z
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getBlockSkyLight(int $x, int $y, int $z) : int;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $x
|
|
||||||
* @param int $y
|
|
||||||
* @param int $z
|
|
||||||
* @param int $level
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function setBlockSkyLight(int $x, int $y, int $z, int $level) : bool;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int $x
|
* @param int $x
|
||||||
* @param int $z
|
* @param int $z
|
||||||
|
Loading…
x
Reference in New Issue
Block a user