Fixed dead entities and Item picking, improved timing reports

This commit is contained in:
Shoghi Cervantes 2015-05-06 16:21:35 +02:00
parent bff51322af
commit 44b5c23ee1
10 changed files with 73 additions and 73 deletions

View File

@ -312,7 +312,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
* @param Player $player * @param Player $player
*/ */
public function spawnTo(Player $player){ public function spawnTo(Player $player){
if($this->spawned === true and $player->spawned === true and $this->dead !== true and $player->dead !== true and $player->getLevel() === $this->level and $player->canSee($this) and !$this->isSpectator()){ if($this->spawned === true and $player->spawned === true and $this->isAlive() and $player->isAdventure() and $player->getLevel() === $this->level and $player->canSee($this) and !$this->isSpectator()){
parent::spawnTo($player); parent::spawnTo($player);
} }
} }
@ -634,7 +634,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
if($this->spawned){ if($this->spawned){
foreach($this->level->getChunkEntities($x, $z) as $entity){ foreach($this->level->getChunkEntities($x, $z) as $entity){
if($entity !== $this and !$entity->closed and !$entity->dead){ if($entity !== $this and !$entity->closed and $entity->isAlive()){
$entity->spawnTo($this); $entity->spawnTo($this);
} }
} }
@ -718,7 +718,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
foreach($this->usedChunks as $index => $c){ foreach($this->usedChunks as $index => $c){
Level::getXZ($index, $chunkX, $chunkZ); Level::getXZ($index, $chunkX, $chunkZ);
foreach($this->level->getChunkEntities($chunkX, $chunkZ) as $entity){ foreach($this->level->getChunkEntities($chunkX, $chunkZ) as $entity){
if($entity !== $this and !$entity->closed and !$entity->dead){ if($entity !== $this and !$entity->closed and $entity->isAlive()){
$entity->spawnTo($this); $entity->spawnTo($this);
} }
} }
@ -1160,31 +1160,31 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
protected function checkNearEntities($tickDiff){ protected function checkNearEntities($tickDiff){
foreach($this->level->getNearbyEntities($this->boundingBox->grow(1, 0.5, 1), $this) as $entity){ foreach($this->level->getNearbyEntities($this->boundingBox->grow(1, 0.5, 1), $this) as $entity){
if($tickDiff > 1){ $entity->scheduleUpdate();
$entity->scheduleUpdate();
if(!$entity->isAlive()){
continue;
} }
if($entity instanceof Arrow and $entity->hadCollision){ if($entity instanceof Arrow and $entity->hadCollision){
if($entity->dead !== true){ $item = Item::get(Item::ARROW, 0, 1);
$item = Item::get(Item::ARROW, 0, 1); if($this->isSurvival() and !$this->inventory->canAddItem($item)){
if($this->isSurvival() and !$this->inventory->canAddItem($item)){ continue;
continue;
}
$this->server->getPluginManager()->callEvent($ev = new InventoryPickupArrowEvent($this->inventory, $entity));
if($ev->isCancelled()){
continue;
}
$pk = new TakeItemEntityPacket();
$pk->eid = $this->getId();
$pk->target = $entity->getId();
Server::broadcastPacket($entity->getViewers(), $pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
$this->inventory->addItem(clone $item);
$entity->kill();
} }
$this->server->getPluginManager()->callEvent($ev = new InventoryPickupArrowEvent($this->inventory, $entity));
if($ev->isCancelled()){
continue;
}
$pk = new TakeItemEntityPacket();
$pk->eid = $this->getId();
$pk->target = $entity->getId();
Server::broadcastPacket($entity->getViewers(), $pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING));
$this->inventory->addItem(clone $item);
$entity->kill();
}elseif($entity instanceof DroppedItem){ }elseif($entity instanceof DroppedItem){
if($entity->dead !== true and $entity->getPickupDelay() <= 0){ if($entity->getPickupDelay() <= 0){
$item = $entity->getItem(); $item = $entity->getItem();
if($item instanceof Item){ if($item instanceof Item){
@ -1219,7 +1219,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
} }
protected function processMovement($tickDiff){ protected function processMovement($tickDiff){
if($this->dead or !$this->spawned or $this->newPosition === null or $this->teleportPosition !== null){ if(!$this->isAlive() or !$this->spawned or $this->newPosition === null or $this->teleportPosition !== null){
return; return;
} }
@ -1375,7 +1375,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->lastUpdate = $currentTick; $this->lastUpdate = $currentTick;
if($this->dead === true and $this->spawned){ if(!$this->isAlive() and $this->spawned){
++$this->deadTicks; ++$this->deadTicks;
if($this->deadTicks >= 10){ if($this->deadTicks >= 10){
$this->despawnFromAll(); $this->despawnFromAll();
@ -1639,8 +1639,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$spawnPosition = $this->getSpawn(); $spawnPosition = $this->getSpawn();
$this->dead = false;
$pk = new StartGamePacket(); $pk = new StartGamePacket();
$pk->seed = -1; $pk->seed = -1;
$pk->x = $this->x; $pk->x = $this->x;
@ -1668,9 +1666,6 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$pk = new SetHealthPacket(); $pk = new SetHealthPacket();
$pk->health = $this->getHealth(); $pk->health = $this->getHealth();
$this->dataPacket($pk->setChannel(Network::CHANNEL_PRIORITY)); $this->dataPacket($pk->setChannel(Network::CHANNEL_PRIORITY));
if($this->getHealth() <= 0){
$this->dead = true;
}
$pk = new SetDifficultyPacket(); $pk = new SetDifficultyPacket();
$pk->difficulty = $this->server->getDifficulty(); $pk->difficulty = $this->server->getDifficulty();
@ -1714,7 +1709,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$newPos = new Vector3($packet->x, $packet->y - $this->getEyeHeight(), $packet->z); $newPos = new Vector3($packet->x, $packet->y - $this->getEyeHeight(), $packet->z);
$revert = false; $revert = false;
if($this->dead === true or $this->spawned !== true){ if(!$this->isAlive() or $this->spawned !== true){
$revert = true; $revert = true;
$this->forceMovement = new Vector3($this->x, $this->y, $this->z); $this->forceMovement = new Vector3($this->x, $this->y, $this->z);
} }
@ -1736,7 +1731,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
break; break;
case ProtocolInfo::PLAYER_EQUIPMENT_PACKET: case ProtocolInfo::PLAYER_EQUIPMENT_PACKET:
if($this->spawned === false or $this->dead === true){ if($this->spawned === false or !$this->isAlive()){
break; break;
} }
@ -1800,7 +1795,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false); $this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);
break; break;
case ProtocolInfo::USE_ITEM_PACKET: case ProtocolInfo::USE_ITEM_PACKET:
if($this->spawned === false or $this->dead === true or $this->blocked){ if($this->spawned === false or !$this->isAlive() or $this->blocked){
break; break;
} }
@ -1909,7 +1904,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
} }
break; break;
case ProtocolInfo::PLAYER_ACTION_PACKET: case ProtocolInfo::PLAYER_ACTION_PACKET:
if($this->spawned === false or $this->blocked === true or ($this->dead === true and $packet->action !== 7)){ if($this->spawned === false or $this->blocked === true or (!$this->isAlive() and $packet->action !== 7)){
break; break;
} }
@ -2027,7 +2022,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->stopSleep(); $this->stopSleep();
break; break;
case 7: //Respawn case 7: //Respawn
if($this->spawned === false or $this->dead === false){ if($this->spawned === false or $this->isAlive()){
break; break;
} }
@ -2047,8 +2042,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->deadTicks = 0; $this->deadTicks = 0;
$this->noDamageTicks = 60; $this->noDamageTicks = 60;
$this->setHealth(20); $this->setHealth($this->getMaxHealth());
$this->dead = false;
$this->removeAllEffects(); $this->removeAllEffects();
$this->sendData($this); $this->sendData($this);
@ -2069,7 +2063,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
break; break;
case ProtocolInfo::REMOVE_BLOCK_PACKET: case ProtocolInfo::REMOVE_BLOCK_PACKET:
if($this->spawned === false or $this->blocked === true or $this->dead === true){ if($this->spawned === false or $this->blocked === true or !$this->isAlive()){
break; break;
} }
$this->craftingType = 0; $this->craftingType = 0;
@ -2112,7 +2106,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
break; break;
case ProtocolInfo::INTERACT_PACKET: case ProtocolInfo::INTERACT_PACKET:
if($this->spawned === false or $this->dead === true or $this->blocked){ if($this->spawned === false or !$this->isAlive() or $this->blocked){
break; break;
} }
@ -2130,7 +2124,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$cancelled = true; $cancelled = true;
} }
if($target instanceof Entity and $this->getGamemode() !== Player::VIEW and $this->dead !== true and $target->dead !== true){ if($target instanceof Entity and $this->getGamemode() !== Player::VIEW and $this->isAlive() and $target->isAlive()){
if($target instanceof DroppedItem or $target instanceof Arrow){ if($target instanceof DroppedItem or $target instanceof Arrow){
$this->kick("Attempting to attack an invalid entity"); $this->kick("Attempting to attack an invalid entity");
$this->server->getLogger()->warning($this->getServer()->getLanguage()->translateString("pocketmine.player.invalidEntity", [$this->getName()])); $this->server->getLogger()->warning($this->getServer()->getLanguage()->translateString("pocketmine.player.invalidEntity", [$this->getName()]));
@ -2235,7 +2229,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
break; break;
case ProtocolInfo::ANIMATE_PACKET: case ProtocolInfo::ANIMATE_PACKET:
if($this->spawned === false or $this->dead === true){ if($this->spawned === false or !$this->isAlive()){
break; break;
} }
@ -2252,7 +2246,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
case ProtocolInfo::SET_HEALTH_PACKET: //Not used case ProtocolInfo::SET_HEALTH_PACKET: //Not used
break; break;
case ProtocolInfo::ENTITY_EVENT_PACKET: case ProtocolInfo::ENTITY_EVENT_PACKET:
if($this->spawned === false or $this->blocked === true or $this->dead === true){ if($this->spawned === false or $this->blocked === true or !$this->isAlive()){
break; break;
} }
$this->craftingType = 0; $this->craftingType = 0;
@ -2326,7 +2320,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
} }
break; break;
case ProtocolInfo::DROP_ITEM_PACKET: case ProtocolInfo::DROP_ITEM_PACKET:
if($this->spawned === false or $this->blocked === true or $this->dead === true){ if($this->spawned === false or $this->blocked === true or !$this->isAlive()){
break; break;
} }
$packet->eid = $this->id; $packet->eid = $this->id;
@ -2346,7 +2340,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false); $this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);
break; break;
case ProtocolInfo::TEXT_PACKET: case ProtocolInfo::TEXT_PACKET:
if($this->spawned === false or $this->dead === true){ if($this->spawned === false or !$this->isAlive()){
break; break;
} }
$this->craftingType = 0; $this->craftingType = 0;
@ -2385,7 +2379,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
} }
break; break;
case ProtocolInfo::CONTAINER_SET_SLOT_PACKET: case ProtocolInfo::CONTAINER_SET_SLOT_PACKET:
if($this->spawned === false or $this->blocked === true or $this->dead === true){ if($this->spawned === false or $this->blocked === true or !$this->isAlive()){
break; break;
} }
@ -2512,7 +2506,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
break; break;
case ProtocolInfo::TILE_ENTITY_DATA_PACKET: case ProtocolInfo::TILE_ENTITY_DATA_PACKET:
if($this->spawned === false or $this->blocked === true or $this->dead === true){ if($this->spawned === false or $this->blocked === true or !$this->isAlive()){
break; break;
} }
$this->craftingType = 0; $this->craftingType = 0;
@ -2753,7 +2747,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
} }
public function kill(){ public function kill(){
if($this->dead === true or $this->spawned === false){ if(!$this->isAlive() or $this->spawned === false){
return; return;
} }
@ -2862,7 +2856,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
} }
if($this->dead){ if(!$this->isAlive()){
return; return;
} }
@ -2903,7 +2897,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
} }
public function attack($damage, EntityDamageEvent $source){ public function attack($damage, EntityDamageEvent $source){
if($this->dead === true){ if(!$this->isAlive()){
return; return;
} }

View File

@ -142,7 +142,6 @@ abstract class Entity extends Location implements Metadatable{
public $inBlock = false; public $inBlock = false;
public $positionChanged; public $positionChanged;
public $motionChanged; public $motionChanged;
public $dead;
public $deadTicks = 0; public $deadTicks = 0;
protected $age = 0; protected $age = 0;
@ -558,6 +557,10 @@ abstract class Entity extends Location implements Metadatable{
return $this->health; return $this->health;
} }
public function isAlive(){
return $this->health > 0;
}
/** /**
* Sets the health of the Entity. This won't send any update to the players * Sets the health of the Entity. This won't send any update to the players
* *
@ -570,7 +573,7 @@ abstract class Entity extends Location implements Metadatable{
if($amount <= 0){ if($amount <= 0){
$this->health = 0; $this->health = 0;
if($this->dead !== true){ if(!$this->isAlive()){
$this->kill(); $this->kill();
} }
}elseif($amount <= $this->getMaxHealth() or $amount < $this->health){ }elseif($amount <= $this->getMaxHealth() or $amount < $this->health){
@ -708,20 +711,20 @@ abstract class Entity extends Location implements Metadatable{
public function entityBaseTick($tickDiff = 1){ public function entityBaseTick($tickDiff = 1){
Timings::$tickEntityTimer->startTiming(); Timings::$timerEntityBaseTick->startTiming();
//TODO: check vehicles //TODO: check vehicles
$this->justCreated = false; $this->justCreated = false;
$isPlayer = $this instanceof Player; $isPlayer = $this instanceof Player;
if($this->dead === true){ if(!$this->isAlive()){
$this->removeAllEffects(); $this->removeAllEffects();
$this->despawnFromAll(); $this->despawnFromAll();
if(!$isPlayer){ if(!$isPlayer){
$this->close(); $this->close();
} }
Timings::$tickEntityTimer->stopTiming(); Timings::$timerEntityBaseTick->stopTiming();
return false; return false;
} }
@ -741,7 +744,7 @@ abstract class Entity extends Location implements Metadatable{
$this->checkBlockCollision(); $this->checkBlockCollision();
if($this->y < 0 and $this->dead !== true){ if($this->y < 0 and !$this->isAlive()){
$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_VOID, 10); $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_VOID, 10);
$this->attack($ev->getFinalDamage(), $ev); $this->attack($ev->getFinalDamage(), $ev);
$hasUpdate = true; $hasUpdate = true;
@ -779,7 +782,7 @@ abstract class Entity extends Location implements Metadatable{
$this->age += $tickDiff; $this->age += $tickDiff;
$this->ticksLived += $tickDiff; $this->ticksLived += $tickDiff;
Timings::$tickEntityTimer->stopTiming(); Timings::$timerEntityBaseTick->stopTiming();
return $hasUpdate; return $hasUpdate;
} }
@ -790,7 +793,7 @@ abstract class Entity extends Location implements Metadatable{
$diffMotion = ($this->motionX - $this->lastMotionX) ** 2 + ($this->motionY - $this->lastMotionY) ** 2 + ($this->motionZ - $this->lastMotionZ) ** 2; $diffMotion = ($this->motionX - $this->lastMotionX) ** 2 + ($this->motionY - $this->lastMotionY) ** 2 + ($this->motionZ - $this->lastMotionZ) ** 2;
if($diffPosition > 0.04 or $diffRotation > 2.25){ //0.2 ** 2, 1.5 ** 2 if($diffPosition > 0.04 or $diffRotation > 2.25 or ($diffMotion > 0 and $this->getMotion()->lengthSquared() <= 0.0001)){ //0.2 ** 2, 1.5 ** 2
$this->lastX = $this->x; $this->lastX = $this->x;
$this->lastY = $this->y; $this->lastY = $this->y;
$this->lastZ = $this->z; $this->lastZ = $this->z;
@ -805,7 +808,7 @@ abstract class Entity extends Location implements Metadatable{
} }
} }
if($diffMotion > 0.0025){ //0.05 ** 2 if($diffMotion > 0.0025 or ($diffMotion > 0 and $this->getMotion()->lengthSquared() <= 0.0001)){ //0.05 ** 2
$this->lastMotionX = $this->motionX; $this->lastMotionX = $this->motionX;
$this->lastMotionY = $this->motionY; $this->lastMotionY = $this->motionY;
$this->lastMotionZ = $this->motionZ; $this->lastMotionZ = $this->motionZ;
@ -839,7 +842,7 @@ abstract class Entity extends Location implements Metadatable{
return false; return false;
} }
if($this->dead === true){ if(!$this->isAlive()){
++$this->deadTicks; ++$this->deadTicks;
if($this->deadTicks >= 10){ if($this->deadTicks >= 10){
$this->despawnFromAll(); $this->despawnFromAll();
@ -1377,10 +1380,9 @@ abstract class Entity extends Location implements Metadatable{
} }
public function kill(){ public function kill(){
if($this->dead){ if(!$this->isAlive()){
return; return;
} }
$this->dead = true;
$this->setHealth(0); $this->setHealth(0);
$this->scheduleUpdate(); $this->scheduleUpdate();
} }

View File

@ -94,7 +94,7 @@ class FallingSand extends Entity{
$hasUpdate = $this->entityBaseTick($tickDiff); $hasUpdate = $this->entityBaseTick($tickDiff);
if(!$this->dead){ if($this->isAlive()){
if($this->ticksLived === 1){ if($this->ticksLived === 1){
$block = $this->level->getBlock($pos = (new Vector3($this->x - 0.5, $this->y - 0.5, $this->z - 0.5))->floor()); $block = $this->level->getBlock($pos = (new Vector3($this->x - 0.5, $this->y - 0.5, $this->z - 0.5))->floor());
if($block->getId() !== $this->blockId){ if($block->getId() !== $this->blockId){

View File

@ -94,7 +94,7 @@ class Item extends Entity{
$hasUpdate = $this->entityBaseTick($tickDiff); $hasUpdate = $this->entityBaseTick($tickDiff);
if(!$this->dead){ if($this->isAlive()){
if($this->pickupDelay > 0 and $this->pickupDelay < 32767){ //Infinite delay if($this->pickupDelay > 0 and $this->pickupDelay < 32767){ //Infinite delay
$this->pickupDelay -= $tickDiff; $this->pickupDelay -= $tickDiff;

View File

@ -143,7 +143,7 @@ abstract class Living extends Entity implements Damageable{
} }
public function kill(){ public function kill(){
if($this->dead){ if(!$this->isAlive()){
return; return;
} }
parent::kill(); parent::kill();
@ -154,11 +154,11 @@ abstract class Living extends Entity implements Damageable{
} }
public function entityBaseTick($tickDiff = 1){ public function entityBaseTick($tickDiff = 1){
Timings::$timerEntityBaseTick->startTiming(); Timings::$timerLivingEntityBaseTick->startTiming();
$hasUpdate = parent::entityBaseTick($tickDiff); $hasUpdate = parent::entityBaseTick($tickDiff);
if($this->dead !== true){ if($this->isAlive()){
if($this->isInsideOfSolid()){ if($this->isInsideOfSolid()){
$hasUpdate = true; $hasUpdate = true;
$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 1); $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 1);
@ -200,7 +200,7 @@ abstract class Living extends Entity implements Damageable{
$this->attackTime -= $tickDiff; $this->attackTime -= $tickDiff;
} }
Timings::$timerEntityBaseTick->stopTiming(); Timings::$timerLivingEntityBaseTick->stopTiming();
return $hasUpdate; return $hasUpdate;
} }

View File

@ -83,7 +83,7 @@ class PrimedTNT extends Entity implements Explosive{
$hasUpdate = $this->entityBaseTick($tickDiff); $hasUpdate = $this->entityBaseTick($tickDiff);
if(!$this->dead){ if($this->isAlive()){
$this->motionY -= $this->gravity; $this->motionY -= $this->gravity;

View File

@ -88,7 +88,7 @@ abstract class Projectile extends Entity{
$hasUpdate = $this->entityBaseTick($tickDiff); $hasUpdate = $this->entityBaseTick($tickDiff);
if(!$this->dead){ if($this->isAlive()){
$movingObjectPosition = null; $movingObjectPosition = null;

View File

@ -95,7 +95,7 @@ class Squid extends WaterAnimal implements Ageable{
$hasUpdate = parent::onUpdate($currentTick); $hasUpdate = parent::onUpdate($currentTick);
if(!$this->dead){ if($this->isAlive()){
if($this->y > 62 and $this->swimDirection !== null){ if($this->y > 62 and $this->swimDirection !== null){
$this->swimDirection->y = -0.5; $this->swimDirection->y = -0.5;

View File

@ -71,6 +71,8 @@ abstract class Timings{
/** @var TimingsHandler */ /** @var TimingsHandler */
public static $timerEntityBaseTick; public static $timerEntityBaseTick;
/** @var TimingsHandler */ /** @var TimingsHandler */
public static $timerLivingEntityBaseTick;
/** @var TimingsHandler */
public static $timerEntityAI; public static $timerEntityAI;
/** @var TimingsHandler */ /** @var TimingsHandler */
public static $timerEntityAICollision; public static $timerEntityAICollision;
@ -121,7 +123,8 @@ abstract class Timings{
self::$activatedEntityTimer = new TimingsHandler("** activatedTickEntity"); self::$activatedEntityTimer = new TimingsHandler("** activatedTickEntity");
self::$tickTileEntityTimer = new TimingsHandler("** tickTileEntity"); self::$tickTileEntityTimer = new TimingsHandler("** tickTileEntity");
self::$timerEntityBaseTick = new TimingsHandler("** livingEntityBaseTick"); self::$timerEntityBaseTick = new TimingsHandler("** entityBaseTick");
self::$timerLivingEntityBaseTick = new TimingsHandler("** livingEntityBaseTick");
self::$timerEntityAI = new TimingsHandler("** livingEntityAI"); self::$timerEntityAI = new TimingsHandler("** livingEntityAI");
self::$timerEntityAICollision = new TimingsHandler("** livingEntityAICollision"); self::$timerEntityAICollision = new TimingsHandler("** livingEntityAICollision");
self::$timerEntityAIMove = new TimingsHandler("** livingEntityAIMove"); self::$timerEntityAIMove = new TimingsHandler("** livingEntityAIMove");

View File

@ -607,16 +607,17 @@ class Level implements ChunkManager, Metadatable{
$this->timings->entityTick->stopTiming(); $this->timings->entityTick->stopTiming();
$this->timings->tileEntityTick->startTiming(); $this->timings->tileEntityTick->startTiming();
Timings::$tickTileEntityTimer->startTiming();
//Update tiles that need update //Update tiles that need update
if(count($this->updateTiles) > 0){ if(count($this->updateTiles) > 0){
//Timings::$tickTileEntityTimer->startTiming();
foreach($this->updateTiles as $id => $tile){ foreach($this->updateTiles as $id => $tile){
if($tile->onUpdate() !== true){ if($tile->onUpdate() !== true){
unset($this->updateTiles[$id]); unset($this->updateTiles[$id]);
} }
} }
//Timings::$tickTileEntityTimer->stopTiming();
} }
Timings::$tickTileEntityTimer->stopTiming();
$this->timings->tileEntityTick->stopTiming(); $this->timings->tileEntityTick->stopTiming();
$this->timings->doTickTiles->startTiming(); $this->timings->doTickTiles->startTiming();