Timings: added new timers for entity move collision checks and projectile move ray tracing

projectiles get their own distinct sub-timer, since the logic is completely different from regular entities.
This commit is contained in:
Dylan K. Taylor
2023-03-19 15:49:35 +00:00
parent eec53f9ae0
commit 607bdfa42f
3 changed files with 18 additions and 2 deletions

View File

@ -175,7 +175,8 @@ abstract class Projectile extends Entity{
protected function move(float $dx, float $dy, float $dz) : void{
$this->blocksAround = null;
Timings::$entityMove->startTiming();
Timings::$projectileMove->startTiming();
Timings::$projectileMoveRayTrace->startTiming();
$start = $this->location->asVector3();
$end = $start->add($dx, $dy, $dz);
@ -221,6 +222,8 @@ abstract class Projectile extends Entity{
}
}
Timings::$projectileMoveRayTrace->stopTiming();
$this->location = Location::fromObject(
$end,
$this->location->world,
@ -268,7 +271,7 @@ abstract class Projectile extends Entity{
$this->getWorld()->onEntityMoved($this);
$this->checkBlockIntersections();
Timings::$entityMove->stopTiming();
Timings::$projectileMove->stopTiming();
}
/**