Save block bounding boxes, improves block cache

This commit is contained in:
Shoghi Cervantes
2014-10-13 18:38:00 +02:00
parent 5448a48f67
commit 1eec333501
24 changed files with 113 additions and 39 deletions

View File

@ -44,10 +44,14 @@ class Ladder extends Transparent{
}
public function getBoundingBox(){
if($this->boundingBox !== null){
return $this->boundingBox;
}
$f = 0.125;
if($this->meta === 2){
return new AxisAlignedBB(
return $this->boundingBox = new AxisAlignedBB(
$this->x,
$this->y,
$this->z + 1 - $f,
@ -56,7 +60,7 @@ class Ladder extends Transparent{
$this->z + 1
);
}elseif($this->meta === 3){
return new AxisAlignedBB(
return $this->boundingBox = new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
@ -65,7 +69,7 @@ class Ladder extends Transparent{
$this->z + $f
);
}elseif($this->meta === 4){
return new AxisAlignedBB(
return $this->boundingBox = new AxisAlignedBB(
$this->x + 1 - $f,
$this->y,
$this->z,
@ -74,7 +78,7 @@ class Ladder extends Transparent{
$this->z + 1
);
}elseif($this->meta === 5){
return new AxisAlignedBB(
return $this->boundingBox = new AxisAlignedBB(
$this->x,
$this->y,
$this->z,