Improved Air block collision check

This commit is contained in:
Shoghi Cervantes 2014-08-24 15:55:34 +02:00
parent 4edadd764c
commit 214dcef1ea
3 changed files with 7 additions and 2 deletions

View File

@ -47,4 +47,8 @@ class Air extends Transparent{
return new AxisAlignedBB(0, 0, 0, 0, 0, 0);
}
public function collidesWithBB(AxisAlignedBB $bb, &$list = []){
}
}

View File

@ -825,9 +825,9 @@ abstract class Block extends Position implements Metadatable{
* @param AxisAlignedBB $bb
* @param Block[] $list
*/
public function collidesWithBB(AxisAlignedBB $bb, &$list = array()){
public function collidesWithBB(AxisAlignedBB $bb, &$list = []){
$bb2 = $this->getBoundingBox();
if($bb2->intersectsWith($bb)){
if($bb2 !== null and $bb2->intersectsWith($bb)){
$list[] = $bb2;
}
}

View File

@ -666,6 +666,7 @@ class Level implements ChunkManager, Metadatable{
$collides = [];
//TODO: optimize this loop, check collision cube boundaries
for($z = $minZ; $z < $maxZ; ++$z){
for($x = $minX; $x < $maxX; ++$x){
if($this->isChunkLoaded($x >> 4, $z >> 4)){