diff --git a/src/world/World.php b/src/world/World.php index a1af7fcdd..0ae25d183 100644 --- a/src/world/World.php +++ b/src/world/World.php @@ -1836,7 +1836,7 @@ class World implements ChunkManager{ foreach($tx->getBlocks() as [$x, $y, $z, $block]){ $block->position($this, $x, $y, $z); foreach($block->getCollisionBoxes() as $collisionBox){ - if(count($this->getNearbyEntities($collisionBox)) > 0){ + if(count($this->getCollidingEntities($collisionBox)) > 0){ return false; //Entity in block } } @@ -1910,12 +1910,12 @@ class World implements ChunkManager{ * * @return Entity[] */ - public function getCollidingEntities(AxisAlignedBB $bb, Entity $entity) : array{ + public function getCollidingEntities(AxisAlignedBB $bb, ?Entity $entity = null) : array{ $nearby = []; - if($entity->canCollide){ + if($entity === null or $entity->canCollide){ foreach($this->getNearbyEntities($bb, $entity) as $ent){ - if($ent->canBeCollidedWith() and $entity->canCollideWith($ent)){ + if($ent->canBeCollidedWith() and ($entity === null or $entity->canCollideWith($ent))){ $nearby[] = $ent; } }