Entity: micro optimisation for checkBlockIntersections()

This commit is contained in:
Dylan K. Taylor 2023-04-16 17:57:51 +01:00
parent 56fbd45dd5
commit 9561ae5af7
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -1325,10 +1325,12 @@ abstract class Entity{
} }
} }
$vector = Vector3::sum(...$vectors); if(count($vectors) > 0){
if($vector->lengthSquared() > 0){ $vector = Vector3::sum(...$vectors);
$d = 0.014; if($vector->lengthSquared() > 0){
$this->motion = $this->motion->addVector($vector->normalize()->multiply($d)); $d = 0.014;
$this->motion = $this->motion->addVector($vector->normalize()->multiply($d));
}
} }
} }