mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
Tick entities on Level, show correct timing reports
This commit is contained in:
parent
9b7a94b5ee
commit
705e4da789
@ -1950,32 +1950,6 @@ class Server{
|
|||||||
|
|
||||||
private function checkTickUpdates($currentTick){
|
private function checkTickUpdates($currentTick){
|
||||||
|
|
||||||
//TODO: move this to each Level
|
|
||||||
|
|
||||||
//Update entities that need update
|
|
||||||
if(count(Entity::$needUpdate) > 0){
|
|
||||||
Timings::$tickEntityTimer->startTiming();
|
|
||||||
foreach(Entity::$needUpdate as $id => $entity){
|
|
||||||
if($entity->onUpdate() === false){
|
|
||||||
unset(Entity::$needUpdate[$id]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Timings::$tickEntityTimer->stopTiming();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Update tiles that need update
|
|
||||||
if(count(Tile::$needUpdate) > 0){
|
|
||||||
Timings::$tickTileEntityTimer->startTiming();
|
|
||||||
foreach(Tile::$needUpdate as $id => $tile){
|
|
||||||
if($tile->onUpdate() === false){
|
|
||||||
unset(Tile::$needUpdate[$id]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Timings::$tickTileEntityTimer->stopTiming();
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Add level blocks
|
|
||||||
|
|
||||||
//Do level ticks
|
//Do level ticks
|
||||||
foreach($this->getLevels() as $level){
|
foreach($this->getLevels() as $level){
|
||||||
$level->doTick($currentTick);
|
$level->doTick($currentTick);
|
||||||
|
@ -584,6 +584,7 @@ abstract class Entity extends Position implements Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final function scheduleUpdate(){
|
public final function scheduleUpdate(){
|
||||||
|
//TODO!
|
||||||
Entity::$needUpdate[$this->id] = $this;
|
Entity::$needUpdate[$this->id] = $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ use pocketmine\event\level\LevelUnloadEvent;
|
|||||||
use pocketmine\event\level\SpawnChangeEvent;
|
use pocketmine\event\level\SpawnChangeEvent;
|
||||||
use pocketmine\event\LevelTimings;
|
use pocketmine\event\LevelTimings;
|
||||||
use pocketmine\event\player\PlayerInteractEvent;
|
use pocketmine\event\player\PlayerInteractEvent;
|
||||||
|
use pocketmine\event\Timings;
|
||||||
use pocketmine\inventory\InventoryHolder;
|
use pocketmine\inventory\InventoryHolder;
|
||||||
use pocketmine\item\Item;
|
use pocketmine\item\Item;
|
||||||
use pocketmine\level\format\Chunk;
|
use pocketmine\level\format\Chunk;
|
||||||
@ -502,6 +503,32 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
$this->timings->doTickPending->stopTiming();
|
$this->timings->doTickPending->stopTiming();
|
||||||
|
|
||||||
|
$this->timings->entityTick->startTiming();
|
||||||
|
//Update entities that need update
|
||||||
|
if(count(Entity::$needUpdate) > 0){
|
||||||
|
//Timings::$tickEntityTimer->startTiming();
|
||||||
|
foreach($this->entities as $id => $entity){
|
||||||
|
if($entity->onUpdate() === false){
|
||||||
|
//unset(Entity::$needUpdate[$id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Timings::$tickEntityTimer->stopTiming();
|
||||||
|
}
|
||||||
|
$this->timings->entityTick->stopTiming();
|
||||||
|
|
||||||
|
$this->timings->tileEntityTick->startTiming();
|
||||||
|
//Update tiles that need update
|
||||||
|
if(count(Tile::$needUpdate) > 0){
|
||||||
|
//Timings::$tickTileEntityTimer->startTiming();
|
||||||
|
foreach($this->tiles as $id => $tile){
|
||||||
|
if($tile->onUpdate() === false){
|
||||||
|
//unset(Tile::$needUpdate[$id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Timings::$tickTileEntityTimer->stopTiming();
|
||||||
|
}
|
||||||
|
$this->timings->tileEntityTick->stopTiming();
|
||||||
|
|
||||||
$this->timings->doTickTiles->startTiming();
|
$this->timings->doTickTiles->startTiming();
|
||||||
$this->tickChunks();
|
$this->tickChunks();
|
||||||
$this->timings->doTickTiles->stopTiming();
|
$this->timings->doTickTiles->stopTiming();
|
||||||
|
@ -100,6 +100,7 @@ abstract class Tile extends Position{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final function scheduleUpdate(){
|
public final function scheduleUpdate(){
|
||||||
|
//TODO!
|
||||||
Tile::$needUpdate[$this->id] = $this;
|
Tile::$needUpdate[$this->id] = $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user