eliminate remaining empty() usages

This commit is contained in:
Dylan K. Taylor
2020-02-07 21:46:16 +00:00
parent 1ffabbb567
commit aac7da6c96
22 changed files with 40 additions and 30 deletions

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\world\format;
use function array_values;
use function count;
class SubChunk implements SubChunkInterface{
/** @var int */
@ -55,18 +56,18 @@ class SubChunk implements SubChunkInterface{
}
public function isEmptyFast() : bool{
return empty($this->blockLayers);
return count($this->blockLayers) === 0;
}
public function getFullBlock(int $x, int $y, int $z) : int{
if(empty($this->blockLayers)){
if(count($this->blockLayers) === 0){
return $this->defaultBlock;
}
return $this->blockLayers[0]->get($x, $y, $z);
}
public function setFullBlock(int $x, int $y, int $z, int $block) : void{
if(empty($this->blockLayers)){
if(count($this->blockLayers) === 0){
$this->blockLayers[] = new PalettedBlockArray($this->defaultBlock);
}
$this->blockLayers[0]->set($x, $y, $z, $block);
@ -80,7 +81,7 @@ class SubChunk implements SubChunkInterface{
}
public function getHighestBlockAt(int $x, int $z) : int{
if(empty($this->blockLayers)){
if(count($this->blockLayers) === 0){
return -1;
}
for($y = 15; $y >= 0; --$y){