LightArray: hide constants ZERO and FIFTEEN from the API

this makes it easier to implement this in C++ with the same API. Since the C++ version doesn't use strings, these constants aren't needed anyway.
This commit is contained in:
Dylan K. Taylor 2020-09-08 15:13:58 +01:00
parent 01f8116cdd
commit 0fd3d91038
3 changed files with 6 additions and 6 deletions

View File

@ -56,10 +56,10 @@ class EmptySubChunk implements SubChunkInterface{
}
public function getBlockLightArray() : LightArray{
return new LightArray(LightArray::ZERO);
return LightArray::fill(0);
}
public function getBlockSkyLightArray() : LightArray{
return new LightArray(LightArray::FIFTEEN);
return LightArray::fill(15);
}
}

View File

@ -39,8 +39,8 @@ if(!defined(__NAMESPACE__ . '\FIFTEEN_NIBBLE_ARRAY')){
final class LightArray{
public const ZERO = ZERO_NIBBLE_ARRAY;
public const FIFTEEN = FIFTEEN_NIBBLE_ARRAY;
private const ZERO = ZERO_NIBBLE_ARRAY;
private const FIFTEEN = FIFTEEN_NIBBLE_ARRAY;
/** @var string */
private $data;

View File

@ -46,8 +46,8 @@ class SubChunk implements SubChunkInterface{
$this->defaultBlock = $default;
$this->blockLayers = $blocks;
$this->skyLight = $skyLight ?? new LightArray(LightArray::FIFTEEN);
$this->blockLight = $blockLight ?? new LightArray(LightArray::ZERO);
$this->skyLight = $skyLight ?? LightArray::fill(15);
$this->blockLight = $blockLight ?? LightArray::fill(0);
}
public function isEmptyAuthoritative() : bool{