Added individual object timings to Entities / Tile Entities

This commit is contained in:
Shoghi Cervantes
2014-09-30 16:09:21 +02:00
parent f8378c09ba
commit 539fa232f8
8 changed files with 167 additions and 121 deletions

View File

@ -152,12 +152,17 @@ abstract class Entity extends Position implements Metadatable{
public $closed = false;
/** @var \pocketmine\event\TimingsHandler */
protected $timings;
public function __construct(FullChunk $chunk, Compound $nbt){
if($chunk === null or $chunk->getProvider() === null){
throw new \Exception("Invalid garbage Chunk given to Entity");
}
$this->timings = Timings::getEntityTimings($this);
if($this->eyeHeight === null){
$this->eyeHeight = $this->height;
}
@ -533,7 +538,7 @@ abstract class Entity extends Position implements Metadatable{
}
foreach($this->hasSpawned as $player){
$player->directDataPacket($pk);
$player->dataPacket($pk);
}
}
@ -575,11 +580,14 @@ abstract class Entity extends Position implements Metadatable{
if($this->closed !== false){
return false;
}
$this->timings->startTiming();
$hasUpdate = $this->entityBaseTick();
$this->updateMovement();
$this->timings->stopTiming();
//if($this->isStatic())
return true;
//return !($this instanceof Player);