mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
avoid type juggling in conditions, always use explicit boolean conditions
This commit is contained in:
@ -78,7 +78,7 @@ class Anvil extends Fallable{
|
||||
public function recalculateBoundingBox() : ?AxisAlignedBB{
|
||||
$inset = 0.125;
|
||||
|
||||
if($this->meta & 0x01){ //east/west
|
||||
if(($this->meta & 0x01) !== 0){ //east/west
|
||||
return new AxisAlignedBB(
|
||||
$this->x,
|
||||
$this->y,
|
||||
|
@ -563,7 +563,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
* @return AxisAlignedBB[]
|
||||
*/
|
||||
protected function recalculateCollisionBoxes() : array{
|
||||
if($bb = $this->recalculateBoundingBox()){
|
||||
if(($bb = $this->recalculateBoundingBox()) !== null){
|
||||
return [$bb];
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ class DoublePlant extends Flowable{
|
||||
* Returns whether this double-plant has a corresponding other half.
|
||||
*/
|
||||
public function isValidHalfPlant() : bool{
|
||||
if($this->meta & self::BITFLAG_TOP){
|
||||
if(($this->meta & self::BITFLAG_TOP) !== 0){
|
||||
$other = $this->getSide(Vector3::SIDE_DOWN);
|
||||
}else{
|
||||
$other = $this->getSide(Vector3::SIDE_UP);
|
||||
@ -102,7 +102,7 @@ class DoublePlant extends Flowable{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item) : array{
|
||||
if($this->meta & self::BITFLAG_TOP){
|
||||
if(($this->meta & self::BITFLAG_TOP) !== 0){
|
||||
if($this->isCompatibleWithTool($item)){
|
||||
return parent::getDrops($item);
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ class Leaves extends Transparent{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item) : array{
|
||||
if($item->getBlockToolType() & BlockToolType::TYPE_SHEARS){
|
||||
if(($item->getBlockToolType() & BlockToolType::TYPE_SHEARS) !== 0){
|
||||
return $this->getDropsForCompatibleTool($item);
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ class Vine extends Flowable{
|
||||
}
|
||||
|
||||
public function getDrops(Item $item) : array{
|
||||
if($item->getBlockToolType() & BlockToolType::TYPE_SHEARS){
|
||||
if(($item->getBlockToolType() & BlockToolType::TYPE_SHEARS) !== 0){
|
||||
return $this->getDropsForCompatibleTool($item);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user