本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
}
}
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
}
示例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;
}
}
}
}
示例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;
}
}
}