mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 16:24:05 +00:00
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:
parent
eec53f9ae0
commit
607bdfa42f
@ -1139,6 +1139,7 @@ abstract class Entity{
|
||||
$this->blocksAround = null;
|
||||
|
||||
Timings::$entityMove->startTiming();
|
||||
Timings::$entityMoveCollision->startTiming();
|
||||
|
||||
$wantedX = $dx;
|
||||
$wantedY = $dy;
|
||||
@ -1223,6 +1224,7 @@ abstract class Entity{
|
||||
|
||||
$this->boundingBox = $moveBB;
|
||||
}
|
||||
Timings::$entityMoveCollision->stopTiming();
|
||||
|
||||
$this->location = new Location(
|
||||
($this->boundingBox->minX + $this->boundingBox->maxX) / 2,
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,6 +89,12 @@ abstract class Timings{
|
||||
|
||||
/** @var TimingsHandler */
|
||||
public static $entityMove;
|
||||
|
||||
public static TimingsHandler $entityMoveCollision;
|
||||
|
||||
public static TimingsHandler $projectileMove;
|
||||
public static TimingsHandler $projectileMoveRayTrace;
|
||||
|
||||
/** @var TimingsHandler */
|
||||
public static $playerCheckNearEntities;
|
||||
/** @var TimingsHandler */
|
||||
@ -183,6 +189,11 @@ abstract class Timings{
|
||||
self::$syncPlayerDataSave = new TimingsHandler("Player Data Save");
|
||||
|
||||
self::$entityMove = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "Entity Movement");
|
||||
self::$entityMoveCollision = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "Entity Movement - Collision Checks", self::$entityMove);
|
||||
|
||||
self::$projectileMove = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "Projectile Movement", self::$entityMove);
|
||||
self::$projectileMoveRayTrace = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "Projectile Movement - Ray Tracing", self::$projectileMove);
|
||||
|
||||
self::$playerCheckNearEntities = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "checkNearEntities");
|
||||
self::$tickEntity = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "Entity Tick");
|
||||
self::$tickTileEntity = new TimingsHandler(self::INCLUDED_BY_OTHER_TIMINGS_PREFIX . "Block Entity Tick");
|
||||
|
Loading…
x
Reference in New Issue
Block a user