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

@ -32,6 +32,10 @@ class Fence extends Transparent{
}
public function getBoundingBox(){
if($this->boundingBox !== null){
return $this->boundingBox;
}
$flag = $this->canConnect($this->getSide(2));
$flag1 = $this->canConnect($this->getSide(3));
$flag2 = $this->canConnect($this->getSide(4));
@ -42,7 +46,7 @@ class Fence extends Transparent{
$f2 = $flag ? 0 : 0.375;
$f3 = $flag1 ? 1 : 0.625;
return new AxisAlignedBB(
return $this->boundingBox = new AxisAlignedBB(
$this->x + $f,
$this->y,
$this->z + $f2,