Clean up terminology around block state IDs and their handling

This commit is contained in:
Dylan K. Taylor
2023-01-25 18:53:11 +00:00
parent 2f469ef4a0
commit 0a3ecfdae9
30 changed files with 81 additions and 78 deletions

View File

@ -93,15 +93,15 @@ class Chunk{
*
* @return int bitmap, (id << 4) | meta
*/
public function getFullBlock(int $x, int $y, int $z) : int{
return $this->getSubChunk($y >> SubChunk::COORD_BIT_SIZE)->getFullBlock($x, $y & SubChunk::COORD_MASK, $z);
public function getBlockStateId(int $x, int $y, int $z) : int{
return $this->getSubChunk($y >> SubChunk::COORD_BIT_SIZE)->getBlockStateId($x, $y & SubChunk::COORD_MASK, $z);
}
/**
* Sets the blockstate at the given coordinate by internal ID.
*/
public function setFullBlock(int $x, int $y, int $z, int $block) : void{
$this->getSubChunk($y >> SubChunk::COORD_BIT_SIZE)->setFullBlock($x, $y & SubChunk::COORD_MASK, $z, $block);
public function setBlockStateId(int $x, int $y, int $z, int $block) : void{
$this->getSubChunk($y >> SubChunk::COORD_BIT_SIZE)->setBlockStateId($x, $y & SubChunk::COORD_MASK, $z, $block);
$this->terrainDirtyFlags |= self::DIRTY_FLAG_BLOCKS;
}

View File

@ -69,14 +69,14 @@ class SubChunk{
*/
public function getEmptyBlockId() : int{ return $this->emptyBlockId; }
public function getFullBlock(int $x, int $y, int $z) : int{
public function getBlockStateId(int $x, int $y, int $z) : int{
if(count($this->blockLayers) === 0){
return $this->emptyBlockId;
}
return $this->blockLayers[0]->get($x, $y, $z);
}
public function setFullBlock(int $x, int $y, int $z, int $block) : void{
public function setBlockStateId(int $x, int $y, int $z, int $block) : void{
if(count($this->blockLayers) === 0){
$this->blockLayers[] = new PalettedBlockArray($this->emptyBlockId);
}