当前位置: 首页>>代码示例>>PHP>>正文


PHP Timings::getEntityTimings方法代码示例

本文整理汇总了PHP中pocketmine\event\Timings::getEntityTimings方法的典型用法代码示例。如果您正苦于以下问题:PHP Timings::getEntityTimings方法的具体用法?PHP Timings::getEntityTimings怎么用?PHP Timings::getEntityTimings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\event\Timings的用法示例。


在下文中一共展示了Timings::getEntityTimings方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(FullChunk $chunk, Compound $nbt)
 {
     if ($chunk === null or $chunk->getProvider() === null) {
         throw new ChunkException("Invalid garbage Chunk given to Entity");
     }
     $this->timings = Timings::getEntityTimings($this);
     if ($this->eyeHeight === null) {
         $this->eyeHeight = $this->height / 2 + 0.1;
     }
     $this->id = Entity::$entityCount++;
     $this->justCreated = true;
     $this->namedtag = $nbt;
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
     $this->setPositionAndRotation(new Vector3($this->namedtag["Pos"][0], $this->namedtag["Pos"][1], $this->namedtag["Pos"][2]), $this->namedtag->Rotation[0], $this->namedtag->Rotation[1], true);
     $this->setMotion(new Vector3($this->namedtag["Motion"][0], $this->namedtag["Motion"][1], $this->namedtag["Motion"][2]));
     if (!isset($this->namedtag->FallDistance)) {
         $this->namedtag->FallDistance = new Float("FallDistance", 0);
     }
     $this->fallDistance = $this->namedtag["FallDistance"];
     if (!isset($this->namedtag->Fire)) {
         $this->namedtag->Fire = new Short("Fire", 0);
     }
     $this->fireTicks = $this->namedtag["Fire"];
     if (!isset($this->namedtag->Air)) {
         $this->namedtag->Air = new Short("Air", 300);
     }
     $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $this->namedtag["Air"]);
     if (!isset($this->namedtag->OnGround)) {
         $this->namedtag->OnGround = new Byte("OnGround", 0);
     }
     $this->onGround = $this->namedtag["OnGround"] > 0 ? true : false;
     if (!isset($this->namedtag->Invulnerable)) {
         $this->namedtag->Invulnerable = new Byte("Invulnerable", 0);
     }
     $this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false;
     $this->chunk->addEntity($this);
     $this->level->addEntity($this);
     $this->initEntity();
     $this->lastUpdate = $this->server->getTick();
     $this->server->getPluginManager()->callEvent(new EntitySpawnEvent($this));
     $this->checkBlockCollisionTicks = (int) $this->server->getAdvancedProperty("main.check-block-collision", 1);
     $this->scheduleUpdate();
 }
开发者ID:RedstoneAlmeida,项目名称:Steadfast2,代码行数:46,代码来源:Entity.php

示例2: entityConstruct

 private function entityConstruct(Player $player, FullChunk $chunk, CompoundTag $nbt)
 {
     assert($chunk !== null and $chunk->getProvider() !== null);
     $this->setPrivateVariableData($player, 'timings', Timings::getEntityTimings($player));
     $this->setPrivateVariableData($player, 'isPlayer', $player instanceof Player);
     $player->temporalVector = new Vector3();
     if ($player->eyeHeight === null) {
         $player->eyeHeight = $player->height / 2 + 0.1;
     }
     $this->setPrivateVariableData($player, 'id', Entity::$entityCount++);
     $this->setPrivateVariableData($player, 'justCreated', true);
     $player->namedtag = $nbt;
     $player->chunk = $chunk;
     $player->setLevel($chunk->getProvider()->getLevel());
     $this->setPrivateVariableData($player, 'server', $chunk->getProvider()->getLevel()->getServer());
     $player->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
     $player->setPositionAndRotation($player->temporalVector->setComponents($player->namedtag["Pos"][0], $player->namedtag["Pos"][1], $player->namedtag["Pos"][2]), $player->namedtag->Rotation[0], $player->namedtag->Rotation[1]);
     $player->setMotion($player->temporalVector->setComponents($player->namedtag["Motion"][0], $player->namedtag["Motion"][1], $player->namedtag["Motion"][2]));
     assert(!is_nan($player->x) and !is_infinite($player->x) and !is_nan($player->y) and !is_infinite($player->y) and !is_nan($player->z) and !is_infinite($player->z));
     if (!isset($player->namedtag->FallDistance)) {
         $player->namedtag->FallDistance = new FloatTag("FallDistance", 0);
     }
     $player->fallDistance = $player->namedtag["FallDistance"];
     if (!isset($player->namedtag->Fire)) {
         $player->namedtag->Fire = new ShortTag("Fire", 0);
     }
     $player->fireTicks = $player->namedtag["Fire"];
     if (!isset($player->namedtag->Air)) {
         $player->namedtag->Air = new ShortTag("Air", 300);
     }
     $player->setDataProperty($player::DATA_AIR, $player::DATA_TYPE_SHORT, $player->namedtag["Air"]);
     if (!isset($player->namedtag->OnGround)) {
         $player->namedtag->OnGround = new ByteTag("OnGround", 0);
     }
     $player->onGround = $player->namedtag["OnGround"] > 0 ? true : false;
     if (!isset($player->namedtag->Invulnerable)) {
         $player->namedtag->Invulnerable = new ByteTag("Invulnerable", 0);
     }
     $player->invulnerable = $player->namedtag["Invulnerable"] > 0 ? true : false;
     $player->chunk->addEntity($player);
     $player->level->addEntity($player);
     $this->initialHuman($player);
     $player->lastUpdate = $this->server->getTick();
     $this->server->getPluginManager()->callEvent(new EntitySpawnEvent($player));
     $player->scheduleUpdate();
 }
开发者ID:organization,项目名称:SpawningPool,代码行数:46,代码来源:AuthenticateCallback.php

示例3: __construct

 public function __construct(FullChunk $chunk, CompoundTag $nbt)
 {
     assert($chunk !== null and $chunk->getProvider() !== null);
     $this->timings = Timings::getEntityTimings($this);
     $this->isPlayer = $this instanceof Player;
     $this->temporalVector = new Vector3();
     if ($this->eyeHeight === null) {
         $this->eyeHeight = $this->height / 2 + 0.1;
     }
     $this->id = Entity::$entityCount++;
     $this->justCreated = true;
     $this->namedtag = $nbt;
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
     $this->setPositionAndRotation($this->temporalVector->setComponents($this->namedtag["Pos"][0], $this->namedtag["Pos"][1], $this->namedtag["Pos"][2]), $this->namedtag->Rotation[0], $this->namedtag->Rotation[1]);
     $this->setMotion($this->temporalVector->setComponents($this->namedtag["Motion"][0], $this->namedtag["Motion"][1], $this->namedtag["Motion"][2]));
     assert(!is_nan($this->x) and !is_infinite($this->x) and !is_nan($this->y) and !is_infinite($this->y) and !is_nan($this->z) and !is_infinite($this->z));
     if (!isset($this->namedtag->FallDistance)) {
         $this->namedtag->FallDistance = new FloatTag("FallDistance", 0);
     }
     $this->fallDistance = $this->namedtag["FallDistance"];
     if (!isset($this->namedtag->Fire) || $this->namedtag["Fire"] > 32767) {
         $this->namedtag->Fire = new ShortTag("Fire", 0);
     }
     $this->fireTicks = $this->namedtag["Fire"];
     if (!isset($this->namedtag->Air)) {
         $this->namedtag->Air = new ShortTag("Air", 300);
     }
     $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $this->namedtag["Air"], false);
     if (!isset($this->namedtag->OnGround)) {
         $this->namedtag->OnGround = new ByteTag("OnGround", 0);
     }
     $this->onGround = $this->namedtag["OnGround"] > 0 ? true : false;
     if (!isset($this->namedtag->Invulnerable)) {
         $this->namedtag->Invulnerable = new ByteTag("Invulnerable", 0);
     }
     $this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false;
     $this->attributeMap = new AttributeMap();
     $this->chunk->addEntity($this);
     $this->level->addEntity($this);
     $this->initEntity();
     $this->lastUpdate = $this->server->getTick();
     $this->server->getPluginManager()->callEvent(new EntitySpawnEvent($this));
     $this->scheduleUpdate();
 }
开发者ID:robske110,项目名称:ClearSky,代码行数:47,代码来源:Entity.php

示例4: doInit

 public function doInit()
 {
     $nbt = $this->server->getOfflinePlayerData($this->name);
     if (!isset($nbt->NameTag)) {
         $nbt->NameTag = new StringTag("NameTag", $this->name);
     } else {
         $nbt["NameTag"] = $this->name;
     }
     $this->gamemode = $nbt["playerGameType"] & 0x3;
     if ($this->server->getForceGamemode()) {
         $this->gamemode = $this->server->getGamemode();
         $nbt->playerGameType = new IntTag("playerGameType", $this->gamemode);
     }
     $this->allowFlight = $this->isCreative();
     if (($level = $this->server->getLevelByName($nbt["Level"])) === null) {
         $this->setLevel($this->server->getDefaultLevel());
         $nbt["Level"] = $this->level->getName();
         $nbt["Pos"][0] = $this->level->getSpawnLocation()->x;
         $nbt["Pos"][1] = $this->level->getSpawnLocation()->y;
         $nbt["Pos"][2] = $this->level->getSpawnLocation()->z;
     } else {
         $this->setLevel($level);
     }
     if (!$nbt instanceof CompoundTag) {
         $this->close($this->getLeaveMessage(), "Invalid data");
         return;
     }
     $this->achievements = [];
     /** @var Byte $achievement */
     foreach ($nbt->Achievements as $achievement) {
         $this->achievements[$achievement->getName()] = $achievement->getValue() > 0 ? true : false;
     }
     $nbt->lastPlayed = new LongTag("lastPlayed", floor(microtime(true) * 1000));
     if ($this->server->getAutoSave()) {
         $this->server->saveOfflinePlayerData($this->name, $nbt, true);
     }
     $chunk = $this->level->getChunk($nbt["Pos"][0] >> 4, $nbt["Pos"][2] >> 4, true);
     assert($chunk !== null and $chunk->getProvider() !== null);
     $this->timings = Timings::getEntityTimings($this);
     $this->isPlayer = $this instanceof Player;
     $this->temporalVector = new Vector3();
     if ($this->eyeHeight === null) {
         $this->eyeHeight = $this->height / 2 + 0.1;
     }
     $this->id = Entity::$entityCount++;
     $this->justCreated = true;
     $this->namedtag = $nbt;
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
     $this->setPositionAndRotation($this->temporalVector->setComponents($this->namedtag["Pos"][0], $this->namedtag["Pos"][1], $this->namedtag["Pos"][2]), $this->namedtag->Rotation[0], $this->namedtag->Rotation[1]);
     $this->setMotion($this->temporalVector->setComponents($this->namedtag["Motion"][0], $this->namedtag["Motion"][1], $this->namedtag["Motion"][2]));
     assert(!is_nan($this->x) and !is_infinite($this->x) and !is_nan($this->y) and !is_infinite($this->y) and !is_nan($this->z) and !is_infinite($this->z));
     if (!isset($this->namedtag->FallDistance)) {
         $this->namedtag->FallDistance = new FloatTag("FallDistance", 0);
     }
     $this->fallDistance = $this->namedtag["FallDistance"];
     if (!isset($this->namedtag->Fire)) {
         $this->namedtag->Fire = new ShortTag("Fire", 0);
     }
     $this->fireTicks = $this->namedtag["Fire"];
     if (!isset($this->namedtag->Air)) {
         $this->namedtag->Air = new ShortTag("Air", 300);
     }
     $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $this->namedtag["Air"]);
     if (!isset($this->namedtag->OnGround)) {
         $this->namedtag->OnGround = new ByteTag("OnGround", 0);
     }
     $this->onGround = $this->namedtag["OnGround"] > 0 ? true : false;
     if (!isset($this->namedtag->Invulnerable)) {
         $this->namedtag->Invulnerable = new ByteTag("Invulnerable", 0);
     }
     $this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false;
     $this->chunk->addEntity($this);
     $this->level->addEntity($this);
     $this->initEntity();
     $this->lastUpdate = $this->server->getTick();
     $this->server->getPluginManager()->callEvent(new EntitySpawnEvent($this));
     $this->scheduleUpdate();
 }
开发者ID:organization,项目名称:DummyPlayer,代码行数:81,代码来源:DummyReceiver.php


注:本文中的pocketmine\event\Timings::getEntityTimings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。