mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-11 05:55:33 +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);
|
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 AxisAlignedBB $bb
|
||||||
* @param Block[] $list
|
* @param Block[] $list
|
||||||
*/
|
*/
|
||||||
public function collidesWithBB(AxisAlignedBB $bb, &$list = array()){
|
public function collidesWithBB(AxisAlignedBB $bb, &$list = []){
|
||||||
$bb2 = $this->getBoundingBox();
|
$bb2 = $this->getBoundingBox();
|
||||||
if($bb2->intersectsWith($bb)){
|
if($bb2 !== null and $bb2->intersectsWith($bb)){
|
||||||
$list[] = $bb2;
|
$list[] = $bb2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -666,6 +666,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
$collides = [];
|
$collides = [];
|
||||||
|
|
||||||
|
//TODO: optimize this loop, check collision cube boundaries
|
||||||
for($z = $minZ; $z < $maxZ; ++$z){
|
for($z = $minZ; $z < $maxZ; ++$z){
|
||||||
for($x = $minX; $x < $maxX; ++$x){
|
for($x = $minX; $x < $maxX; ++$x){
|
||||||
if($this->isChunkLoaded($x >> 4, $z >> 4)){
|
if($this->isChunkLoaded($x >> 4, $z >> 4)){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user