World: fix bug in getNearestEntity()

fuck you PhpStorm
This commit is contained in:
Dylan K. Taylor 2019-08-21 18:51:08 -04:00
parent 7e5193355e
commit aa60aa69ee

View File

@ -1889,7 +1889,7 @@ class World implements ChunkManager{
if(!($entity instanceof $entityType) or $entity->isFlaggedForDespawn() or (!$includeDead and !$entity->isAlive())){ if(!($entity instanceof $entityType) or $entity->isFlaggedForDespawn() or (!$includeDead and !$entity->isAlive())){
continue; continue;
} }
$distSq = $entity->distanceSquared($pos); $distSq = $entity->getPosition()->distanceSquared($pos);
if($distSq < $currentTargetDistSq){ if($distSq < $currentTargetDistSq){
$currentTargetDistSq = $distSq; $currentTargetDistSq = $distSq;
$currentTarget = $entity; $currentTarget = $entity;