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


PHP Human::switchLevel方法代码示例

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


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

示例1: switchLevel

 protected function switchLevel(Level $targetLevel)
 {
     $oldLevel = $this->level;
     if (parent::switchLevel($targetLevel)) {
         foreach ($this->usedChunks as $index => $d) {
             Level::getXZ($index, $X, $Z);
             $this->unloadChunk($X, $Z, $oldLevel);
         }
         $this->usedChunks = [];
         $pk = new SetTimePacket();
         $pk->time = $this->level->getTime();
         $pk->started = $this->level->stopTime == false;
         $this->dataPacket($pk);
     }
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:15,代码来源:Player.php

示例2: switchLevel

 protected function switchLevel(Level $targetLevel)
 {
     $oldLevel = $this->level;
     if (parent::switchLevel($targetLevel)) {
         foreach ($this->usedChunks as $index => $d) {
             if (\PHP_INT_SIZE === 8) {
                 $X = $index >> 32 << 32 >> 32;
                 $Z = ($index & 4294967295.0) << 32 >> 32;
             } else {
                 list($X, $Z) = \explode(":", $index);
                 $X = (int) $X;
                 $Z = (int) $Z;
             }
             $this->unloadChunk($X, $Z, $oldLevel);
         }
         $this->usedChunks = [];
         $pk = new SetTimePacket();
         $pk->time = $this->level->getTime();
         $pk->started = $this->level->stopTime == \false;
         $this->dataPacket($pk);
     }
 }
开发者ID:AASSuper,项目名称:PocketMine_0.13,代码行数:22,代码来源:Player.php

示例3: switchLevel

 protected function switchLevel(Level $targetLevel)
 {
     $oldLevel = $this->level;
     if (parent::switchLevel($targetLevel)) {
         foreach ($this->usedChunks as $index => $d) {
             Level::getXZ($index, $X, $Z);
             $this->unloadChunk($X, $Z, $oldLevel);
         }
         $this->usedChunks = [];
         $pk = new SetTimePacket();
         $pk->time = $this->level->getTime();
         $pk->started = $this->level->stopTime == false;
         $this->dataPacket($pk);
         if (WeatherManager::isRegistered($targetLevel)) {
             $targetLevel->getWeather()->sendWeather($this);
         }
         if ($this->server->netherEnabled) {
             if ($targetLevel == $this->server->netherLevel) {
                 $pk = new ChangeDimensionPacket();
                 $pk->dimension = ChangeDimensionPacket::DIMENSION_NETHER;
                 $this->dataPacket($pk);
                 $this->shouldSendStatus = true;
             } elseif ($oldLevel == $this->server->netherLevel) {
                 $pk = new ChangeDimensionPacket();
                 $pk->dimension = ChangeDimensionPacket::DIMENSION_NORMAL;
                 $this->dataPacket($pk);
                 $this->shouldSendStatus = true;
             }
         }
     }
 }
开发者ID:PepbookPvP,项目名称:Genisys,代码行数:31,代码来源:Player.php

示例4: switchLevel

 protected function switchLevel(Level $targetLevel)
 {
     $oldLevel = $this->level;
     if (parent::switchLevel($targetLevel)) {
         foreach ($this->usedChunks as $index => $d) {
             list($X, $Z) = \explode(":", $index);
             $X = (int) $X;
             $Z = (int) $Z;
             $this->unloadChunk($X, $Z, $oldLevel);
         }
         $this->usedChunks = [];
         $pk = new SetTimePacket();
         $pk->time = $this->level->getTime();
         $pk->started = $this->level->stopTime == \false;
         $this->dataPacket($pk);
     }
 }
开发者ID:xpyctum,项目名称:PocketMinePlusPlus,代码行数:17,代码来源:Player__32bit.php

示例5: switchLevel

 protected function switchLevel(Level $targetLevel)
 {
     $oldLevel = $this->level;
     if (parent::switchLevel($targetLevel)) {
         foreach ($this->usedChunks as $index => $d) {
             $X = $index >> 32 << 32 >> 32;
             $Z = ($index & 4294967295.0) << 32 >> 32;
             $this->unloadChunk($X, $Z, $oldLevel);
         }
         $this->usedChunks = [];
         $pk = new SetTimePacket();
         $pk->time = $this->level->getTime();
         $pk->started = $this->level->stopTime == \false;
         $this->dataPacket($pk);
     }
 }
开发者ID:ken77731,项目名称:PocketMine-0.13.0,代码行数:16,代码来源:Player__64bit.php

示例6: switchLevel

 protected function switchLevel(Level $targetLevel)
 {
     $oldLevel = $this->level;
     if (parent::switchLevel($targetLevel)) {
         foreach ($this->usedChunks as $index => $d) {
             Level::getXZ($index, $X, $Z);
             $this->unloadChunk($X, $Z, $oldLevel);
         }
         $this->usedChunks = [];
         $pk = new SetTimePacket();
         $pk->time = $this->level->getTime();
         $pk->started = $this->level->stopTime == false;
         $this->dataPacket($pk);
         if ($targetLevel->getDimension() != $oldLevel->getDimension()) {
             $pk = new ChangeDimensionPacket();
             $pk->dimension = $targetLevel->getDimension();
             $pk->x = $this->x;
             $pk->y = $this->y;
             $pk->z = $this->z;
             $this->dataPacket($pk);
             $this->shouldSendStatus = true;
         }
         $targetLevel->getWeather()->sendWeather($this);
         if ($this->spawned) {
             $this->spawnToAll();
         }
     }
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:28,代码来源:Player.php

示例7: switchLevel

 protected function switchLevel(Level $targetLevel)
 {
     $oldLevel = $this->level;
     if (parent::switchLevel($targetLevel)) {
         foreach ($this->usedChunks as $index => $d) {
             Level::getXZ($index, $X, $Z);
             $this->unloadChunk($X, $Z, $oldLevel);
         }
         $this->usedChunks = [];
         $pk = new SetTimePacket();
         $pk->time = $this->level->getTime();
         $pk->started = $this->level->stopTime == false;
         $this->dataPacket($pk);
         if (!$oldLevel->getDimension() === $this->level->getDimension()) {
             if ($this->level->getDimension() === ChangeDimensionPacket::NETHER) {
                 $cpk = new ChangeDimensionPacket();
                 $cpk->x = $this->x;
                 $cpk->y = $this->y;
                 $cpk->z = $this->z;
                 $cpk->dimension = ChangeDimensionPacket::NETHER;
                 $this->dataPacket($cpk);
                 $cpk->unknown = true;
             } else {
                 $cpk = new ChangeDimensionPacket();
                 $cpk->x = $this->x;
                 $cpk->y = $this->y;
                 $cpk->z = $this->z;
                 $cpk->dimension = ChangeDimensionPacket::NORMAL;
                 $this->dataPacket($cpk);
                 $cpk->unknown = true;
             }
         }
     }
 }
开发者ID:robske110,项目名称:ClearSky,代码行数:34,代码来源:Player.php

示例8: changeDimension

 public function changeDimension(Level $targetLevel, $isNether = false)
 {
     $oldLevel = $this->level;
     if (parent::switchLevel($targetLevel)) {
         foreach ($this->usedChunks as $index => $d) {
             Level::getXZ($index, $X, $Z);
             $this->unloadChunk($X, $Z, $oldLevel);
         }
         $this->usedChunks = [];
         $pk = new SetTimePacket();
         $pk->time = $this->level->getTime();
         $pk->started = $this->level->stopTime == false;
         $this->dataPacket($pk);
         // if(WeatherManager::isRegistered($targetLevel)) $targetLevel->getWeather()->sendWeather($this);
         if ($isNether) {
             $pk = new ChangeDimensionPacket();
             $pk->dimension = ChangeDimensionPacket::NETHER;
             $this->dataPacket($pk);
             $this->shouldSendStatus = true;
         } else {
             $pk = new ChangeDimensionPacket();
             $pk->dimension = ChangeDimensionPacket::NORMAL;
             $this->dataPacket($pk);
             $this->shouldSendStatus = true;
         }
     }
 }
开发者ID:kakichi,项目名称:ClearSky,代码行数:27,代码来源:Player.php


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