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(){
$f = 0.1875;
$minX = $minZ = 0;
$maxX = $maxZ = 1;
if($this->meta === 2){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z + 1 - $f,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
$minZ = 1 - $f;
}elseif($this->meta === 3){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + $f
);
$maxZ = $f;
}elseif($this->meta === 4){
return new AxisAlignedBB(
$this->x + 1 - $f,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
$minX = 1 - $f;
}elseif($this->meta === 5){
return new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + $f,
$this->y + 1,
$this->z + 1
);
$maxX = $f;
}
return null;
return new AxisAlignedBB(
$this->x + $minX,
$this->y,
$this->z + $minZ,
$this->x + $maxX,
$this->y + 1,
$this->z + $maxZ
);
}