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

@ -79,7 +79,7 @@ abstract class BaseRail extends Flowable{
}
protected function writeStateToMeta() : int{
if(empty($this->connections)){
if(count($this->connections) === 0){
return BlockLegacyMetadata::RAIL_STRAIGHT_NORTH_SOUTH;
}
return $this->getMetaForState($this->connections);

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
use function count;
class Fence extends Transparent{
/** @var bool[] facing => dummy */
@ -80,7 +81,7 @@ class Fence extends Transparent{
->trim(Facing::SOUTH, $connectSouth ? 0 : $inset);
}
if(empty($bbs)){
if(count($bbs) === 0){
//centre post AABB (only needed if not connected on any axis - other BBs overlapping will do this if any connections are made)
return [
AxisAlignedBB::one()

View File

@ -25,6 +25,7 @@ namespace pocketmine\block;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
use function count;
class Thin extends Transparent{
/** @var bool[] facing => dummy */
@ -71,7 +72,7 @@ class Thin extends Transparent{
$bbs[] = $bb;
}
if(empty($bbs)){
if(count($bbs) === 0){
//centre post AABB (only needed if not connected on any axis - other BBs overlapping will do this if any connections are made)
return [
AxisAlignedBB::one()->contract($inset, 0, $inset)

View File

@ -30,6 +30,7 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
use pocketmine\world\BlockTransaction;
use function array_intersect_key;
use function count;
class Vine extends Flowable{
@ -113,7 +114,7 @@ class Vine extends Flowable{
}
if($changed){
if(empty($this->faces)){
if(count($this->faces) === 0){
$this->pos->getWorld()->useBreakOn($this->pos);
}else{
$this->pos->getWorld()->setBlock($this->pos, $this);