pocketmine\event\Timings::getTileEntityTimings PHP Method

getTileEntityTimings() public static method

public static getTileEntityTimings ( Tile $tile ) : TimingsHandler
$tile pocketmine\tile\Tile
return TimingsHandler
    public static function getTileEntityTimings(Tile $tile)
    {
        $tileType = (new \ReflectionClass($tile))->getShortName();
        if (!isset(self::$tileEntityTypeTimingMap[$tileType])) {
            self::$tileEntityTypeTimingMap[$tileType] = new TimingsHandler("** tickTileEntity - " . $tileType, self::$tickTileEntityTimer);
        }
        return self::$tileEntityTypeTimingMap[$tileType];
    }

Usage Example

Example #1
0
 public function __construct(FullChunk $chunk, Compound $nbt)
 {
     if ($chunk === null or $chunk->getProvider() === null) {
         throw new \Exception("Invalid garbage Chunk given to Tile");
     }
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->namedtag = $nbt;
     $this->closed = false;
     $this->name = "";
     $this->lastUpdate = microtime(true);
     $this->id = Tile::$tileCount++;
     $this->x = (int) $this->namedtag["x"];
     $this->y = (int) $this->namedtag["y"];
     $this->z = (int) $this->namedtag["z"];
     $this->chunk->addTile($this);
     $this->getLevel()->addTile($this);
     $this->tickTimer = Timings::getTileEntityTimings($this);
 }
All Usage Examples Of pocketmine\event\Timings::getTileEntityTimings