Remove premature optimisation from World::getCollidingEntities()

this is already covered in more fine-grained detail by canCollideWith().

[bc break]
This commit is contained in:
Dylan K. Taylor
2022-06-01 21:00:54 +01:00
parent b7e2b3e94a
commit 6ee551c5e1
5 changed files with 3 additions and 13 deletions

View File

@ -1904,11 +1904,9 @@ class World implements ChunkManager{
public function getCollidingEntities(AxisAlignedBB $bb, ?Entity $entity = null) : array{
$nearby = [];
if($entity === null || $entity->canCollide){
foreach($this->getNearbyEntities($bb, $entity) as $ent){
if($ent->canBeCollidedWith() && ($entity === null || $entity->canCollideWith($ent))){
$nearby[] = $ent;
}
foreach($this->getNearbyEntities($bb, $entity) as $ent){
if($ent->canBeCollidedWith() && ($entity === null || $entity->canCollideWith($ent))){
$nearby[] = $ent;
}
}