Cleaned up Ladder AABB calculation code

This commit is contained in:
Dylan K. Taylor 2017-10-11 18:25:16 +01:00
parent b7a9e10d49
commit 8f0ee84277

View File

@ -65,48 +65,29 @@ class Ladder extends Transparent{
} }
protected function recalculateBoundingBox(){ protected function recalculateBoundingBox(){
$f = 0.1875; $f = 0.1875;
$minX = $minZ = 0;
$maxX = $maxZ = 1;
if($this->meta === 2){ if($this->meta === 2){
return new AxisAlignedBB( $minZ = 1 - $f;
$this->x,
$this->y,
$this->z + 1 - $f,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}elseif($this->meta === 3){ }elseif($this->meta === 3){
return new AxisAlignedBB( $maxZ = $f;
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + $f
);
}elseif($this->meta === 4){ }elseif($this->meta === 4){
return new AxisAlignedBB( $minX = 1 - $f;
$this->x + 1 - $f,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}elseif($this->meta === 5){ }elseif($this->meta === 5){
return new AxisAlignedBB( $maxX = $f;
$this->x,
$this->y,
$this->z,
$this->x + $f,
$this->y + 1,
$this->z + 1
);
} }
return null; return new AxisAlignedBB(
$this->x + $minX,
$this->y,
$this->z + $minZ,
$this->x + $maxX,
$this->y + 1,
$this->z + $maxZ
);
} }