mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-19 15:35:52 +00:00
Improved Air block collision check
This commit is contained in:
parent
4edadd764c
commit
214dcef1ea
@ -47,4 +47,8 @@ class Air extends Transparent{
|
||||
return new AxisAlignedBB(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public function collidesWithBB(AxisAlignedBB $bb, &$list = []){
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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)){
|
||||
|
Loading…
x
Reference in New Issue
Block a user