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


PHP Item::getCreativeItems方法代码示例

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


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

示例1: handleDataPacket


//.........这里部分代码省略.........
             $pk->spawnZ = (int) $spawnPosition->z;
             $pk->generator = 1;
             //0 old, 1 infinite, 2 flat
             $pk->gamemode = $this->gamemode & 0x1;
             $pk->eid = 0;
             //Always use EntityID as zero for the actual player
             $this->dataPacket($pk);
             $pk = new SetTimePacket();
             $pk->time = $this->level->getTime();
             $pk->started = $this->level->stopTime == false;
             $this->dataPacket($pk);
             $pk = new SetSpawnPositionPacket();
             $pk->x = (int) $spawnPosition->x;
             $pk->y = (int) $spawnPosition->y;
             $pk->z = (int) $spawnPosition->z;
             $this->dataPacket($pk);
             $pk = new SetHealthPacket();
             $pk->health = $this->getHealth();
             $this->dataPacket($pk);
             if ($this->getHealth() <= 0) {
                 $this->dead = true;
             }
             $pk = new SetDifficultyPacket();
             $pk->difficulty = $this->server->getDifficulty();
             $this->dataPacket($pk);
             $this->server->getLogger()->info(TextFormat::AQUA . $this->username . TextFormat::WHITE . "/" . TextFormat::AQUA . $this->ip . " connected");
             if ($this->gamemode === Player::SPECTATOR) {
                 $pk = new ContainerSetContentPacket();
                 $pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
                 $this->dataPacket($pk);
             } else {
                 $pk = new ContainerSetContentPacket();
                 $pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
                 foreach (Item::getCreativeItems() as $item) {
                     $pk->slots[] = clone $item;
                 }
                 $this->dataPacket($pk);
             }
             $this->orderChunks();
             $this->sendNextChunk();
             break;
         case ProtocolInfo::MOVE_PLAYER_PACKET:
             $newPos = new Vector3($packet->x, $packet->y - $this->getEyeHeight(), $packet->z);
             $revert = false;
             if ($this->dead === true or $this->spawned !== true) {
                 $revert = true;
                 $this->forceMovement = new Vector3($this->x, $this->y, $this->z);
             }
             if ($this->forceMovement instanceof Vector3 and (($dist = $newPos->distanceSquared($this->forceMovement)) > 0.04 or $revert)) {
                 $pk = new MovePlayerPacket();
                 $pk->eid = $this->getId();
                 $pk->x = $this->forceMovement->x;
                 $pk->y = $this->forceMovement->y + $this->getEyeHeight();
                 $pk->z = $this->forceMovement->z;
                 $pk->bodyYaw = $packet->bodyYaw;
                 $pk->pitch = $packet->pitch;
                 $pk->yaw = $packet->yaw;
                 $pk->teleport = 1;
                 $this->directDataPacket($pk);
                 $this->forceMovement = null;
             } else {
                 $packet->yaw %= 360;
                 $packet->pitch %= 360;
                 if ($packet->yaw < 0) {
                     $packet->yaw += 360;
                 }
开发者ID:ZenaGamingsky,项目名称:Steadfast2,代码行数:67,代码来源:Player.php

示例2: processLogin


//.........这里部分代码省略.........
     if (!isset($nbt->NameTag)) {
         $nbt->NameTag = new String("NameTag", $this->username);
     } else {
         $nbt["NameTag"] = $this->username;
     }
     $this->gamemode = $nbt["playerGameType"] & 0x3;
     if ($this->server->getForceGamemode()) {
         $this->gamemode = $this->server->getGamemode();
         $nbt->playerGameType = new Int("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 Compound) {
         $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 Long("lastPlayed", floor(microtime(true) * 1000));
     if ($this->server->getAutoSave()) {
         $this->server->saveOfflinePlayerData($this->username, $nbt, true);
     }
     parent::__construct($this->level->getChunk($nbt["Pos"][0] >> 4, $nbt["Pos"][2] >> 4, true), $nbt);
     $this->loggedIn = true;
     $this->server->addOnlinePlayer($this);
     $this->server->getPluginManager()->callEvent($ev = new PlayerLoginEvent($this, "Plugin reason"));
     if ($ev->isCancelled()) {
         $this->close($this->getLeaveMessage(), $ev->getKickMessage());
         return;
     }
     if ($this->isCreative()) {
         $this->inventory->setHeldItemSlot(0);
     } else {
         $this->inventory->setHeldItemSlot($this->inventory->getHotbarSlotIndex(0));
     }
     $pk = new PlayStatusPacket();
     $pk->status = PlayStatusPacket::LOGIN_SUCCESS;
     $this->dataPacket($pk);
     if ($this->spawnPosition === null and isset($this->namedtag->SpawnLevel) and ($level = $this->server->getLevelByName($this->namedtag["SpawnLevel"])) instanceof Level) {
         $this->spawnPosition = new Position($this->namedtag["SpawnX"], $this->namedtag["SpawnY"], $this->namedtag["SpawnZ"], $level);
     }
     $spawnPosition = $this->getSpawn();
     $pk = new StartGamePacket();
     $pk->seed = -1;
     $pk->dimension = 0;
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->spawnX = (int) $spawnPosition->x;
     $pk->spawnY = (int) $spawnPosition->y;
     $pk->spawnZ = (int) $spawnPosition->z;
     $pk->generator = 1;
     //0 old, 1 infinite, 2 flat
     $pk->gamemode = $this->gamemode & 0x1;
     $pk->eid = 0;
     //Always use EntityID as zero for the actual player
     $this->dataPacket($pk);
     $pk = new SetTimePacket();
     $pk->time = $this->level->getTime();
     $pk->started = $this->level->stopTime == false;
     $this->dataPacket($pk);
     $pk = new SetSpawnPositionPacket();
     $pk->x = (int) $spawnPosition->x;
     $pk->y = (int) $spawnPosition->y;
     $pk->z = (int) $spawnPosition->z;
     $this->dataPacket($pk);
     $pk = new SetHealthPacket();
     $pk->health = $this->getHealth();
     $this->dataPacket($pk);
     $pk = new SetDifficultyPacket();
     $pk->difficulty = $this->server->getDifficulty();
     $this->dataPacket($pk);
     $this->server->getLogger()->info($this->getServer()->getLanguage()->translateString("pocketmine.player.logIn", [TextFormat::AQUA . $this->username . TextFormat::WHITE, $this->ip, $this->port, $this->id, $this->level->getName(), round($this->x, 4), round($this->y, 4), round($this->z, 4)]));
     if ($this->isOp()) {
         $this->setRemoveFormat(false);
     }
     if ($this->gamemode === Player::SPECTATOR) {
         $pk = new ContainerSetContentPacket();
         $pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
         $this->dataPacket($pk);
     } else {
         $pk = new ContainerSetContentPacket();
         $pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
         $pk->slots = Item::getCreativeItems();
         $this->dataPacket($pk);
     }
     $this->forceMovement = $this->teleportPosition = $this->getPosition();
     $this->server->onPlayerLogin($this);
 }
开发者ID:NewDelion,项目名称:PocketMine-0.13.x,代码行数:101,代码来源:Player.php

示例3: sendContents

 /**
  * @param Player|Player[] $target
  */
 public function sendContents($target)
 {
     if ($target instanceof Player) {
         $target = [$target];
     }
     $pk = new ContainerSetContentPacket();
     $pk->slots = [];
     $holder = $this->getHolder();
     if ($holder instanceof Player and $holder->isCreative()) {
         //TODO: Remove this workaround because of broken client
         foreach (Item::getCreativeItems() as $i => $item) {
             $pk->slots[$i] = Item::getCreativeItem($i);
         }
     } else {
         for ($i = 0; $i < $this->getSize(); ++$i) {
             //Do not send armor by error here
             $pk->slots[$i] = $this->getItem($i);
         }
     }
     foreach ($target as $player) {
         $pk->hotbar = [];
         if ($player === $this->getHolder()) {
             for ($i = 0; $i < $this->getHotbarSize(); ++$i) {
                 $index = $this->getHotbarSlotIndex($i);
                 $pk->hotbar[] = $index <= -1 ? -1 : $index + 9;
             }
         }
         if (($id = $player->getWindowId($this)) === -1 or $player->spawned !== true) {
             $this->close($player);
             continue;
         }
         $pk->windowid = $id;
         $player->dataPacket(clone $pk);
     }
 }
开发者ID:onebone,项目名称:PocketMine-MP,代码行数:38,代码来源:PlayerInventory.php

示例4: sendCreativeContents

 public function sendCreativeContents()
 {
     $pk = new ContainerSetContentPacket();
     $pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
     if ($this->getHolder()->getGamemode() === Player::CREATIVE) {
         foreach (Item::getCreativeItems() as $i => $item) {
             $pk->slots[$i] = clone $item;
         }
     }
     $this->getHolder()->dataPacket($pk);
 }
开发者ID:xxFlare,项目名称:PocketMine-MP,代码行数:11,代码来源:PlayerInventory.php

示例5: processLogin


//.........这里部分代码省略.........
                     $this->close($this->getLeaveMessage(), "Logged in from another location");
                     return;
                 }
             }
         }
         $nbt = $this->server->getOfflinePlayerData($this->username);
         $this->playedBefore = $nbt["lastPlayed"] - $nbt["firstPlayed"] > 1;
         if (!isset($nbt->NameTag)) {
             $nbt->NameTag = new StringTag("NameTag", $this->username);
         } else {
             $nbt["NameTag"] = $this->username;
         }
         if (!isset($nbt->Hunger) or !isset($nbt->Health) or !isset($nbt->MaxHealth)) {
             $nbt->Hunger = new ShortTag("Hunger", 20);
             $nbt->Health = new ShortTag("Health", 20);
             $nbt->MaxHealth = new ShortTag("MaxHealth", 20);
         }
         $this->food = $nbt["Hunger"];
         $this->setMaxHealth($nbt["MaxHealth"]);
         Entity::setHealth($nbt["Health"] <= 0 ? 20 : $nbt["Health"]);
         $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 ByteTag $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->username, $nbt, true);
         }
         Entity::__construct($this->level->getChunk($nbt["Pos"][0] >> 4, $nbt["Pos"][2] >> 4, true), $nbt);
         $this->loggedIn = true;
         $this->server->addOnlinePlayer($this);
         $this->server->getPluginManager()->callEvent($ev = new PlayerLoginEvent($this, "Plugin reason"));
         if ($ev->isCancelled()) {
             $this->close($this->getLeaveMessage(), $ev->getKickMessage());
             return;
         }
         if ($this->isCreative()) {
             $this->inventory->setHeldItemSlot(0);
         } else {
             $this->inventory->setHeldItemSlot($this->inventory->getHotbarSlotIndex(0));
         }
         if ($this->spawnPosition === null and isset($this->namedtag->SpawnLevel) and ($level = $this->server->getLevelByName($this->namedtag["SpawnLevel"])) instanceof Level) {
             $this->spawnPosition = new Position($this->namedtag["SpawnX"], $this->namedtag["SpawnY"], $this->namedtag["SpawnZ"], $level);
         }
         $spawnPosition = $this->getSpawn();
         $pk = new SetTimePacket();
         $pk->time = $this->level->getTime();
         $pk->started = $this->level->stopTime == false;
         $this->dataPacket($pk);
         $pk = new SetSpawnPositionPacket();
         $pk->x = (int) $spawnPosition->x;
         $pk->y = (int) $spawnPosition->y;
         $pk->z = (int) $spawnPosition->z;
         $this->dataPacket($pk);
         $this->sendAttributes();
         $pk = new SetDifficultyPacket();
         $pk->difficulty = $this->server->getDifficulty();
         $this->dataPacket($pk);
         $pk = new SetPlayerGameTypePacket();
         $pk->gamemode = $this->gamemode & 0x1;
         $this->dataPacket($pk);
         $this->sendSettings();
         $this->server->getLogger()->info($this->getServer()->getLanguage()->translateString("pocketmine.player.logIn", [TextFormat::AQUA . $this->username . TextFormat::WHITE, $this->ip, $this->port, TextFormat::GREEN . $this->randomClientId . TextFormat::WHITE, $this->id, $this->level->getName(), round($this->x, 4), round($this->y, 4), round($this->z, 4)]));
         if ($this->gamemode === Player::SPECTATOR) {
             $pk = new ContainerSetContentPacket();
             $pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
             $this->dataPacket($pk);
         } else {
             $pk = new ContainerSetContentPacket();
             $pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
             $pk->slots = array_merge(Item::getCreativeItems(), $this->personalCreativeItems);
             $this->dataPacket($pk);
         }
         $pk = new SetEntityDataPacket();
         $pk->eid = 0;
         $pk->metadata = [self::DATA_LEAD_HOLDER => [self::DATA_TYPE_LONG, -1]];
         $this->dataPacket($pk);
         $this->forceMovement = $this->teleportPosition = $this->getPosition();
     }
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:101,代码来源:Player.php

示例6: processLogin


//.........这里部分代码省略.........
     } else {
         $this->setLevel($level);
     }
     if (!$nbt instanceof CompoundTag) {
         $this->close($this->getLeaveMessage(), "Invalid data");
         return;
     }
     $this->achievements = [];
     /** @var ByteTag $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->username, $nbt, true);
     }
     parent::__construct($this->level->getChunk($nbt["Pos"][0] >> 4, $nbt["Pos"][2] >> 4, true), $nbt);
     $this->loggedIn = true;
     $this->server->addOnlinePlayer($this);
     $this->server->getPluginManager()->callEvent($ev = new PlayerLoginEvent($this, "Plugin reason"));
     if ($ev->isCancelled()) {
         $this->close($this->getLeaveMessage(), $ev->getKickMessage());
         return;
     }
     /*
     $pk = new PlayStatusPacket();
     $pk->status = PlayStatusPacket::LOGIN_SUCCESS;
     $this->dataPacket($pk);
     */
     if ($this->isCreative()) {
         $this->inventory->setHeldItemSlot(0);
     } else {
         $this->inventory->setHeldItemSlot($this->inventory->getHotbarSlotIndex(0));
     }
     $this->dataPacket(new ResourcePacksInfoPacket());
     if (!$this->hasValidSpawnPosition() and isset($this->namedtag->SpawnLevel) and ($level = $this->server->getLevelByName($this->namedtag["SpawnLevel"])) instanceof Level) {
         $this->spawnPosition = new WeakPosition($this->namedtag["SpawnX"], $this->namedtag["SpawnY"], $this->namedtag["SpawnZ"], $level);
     }
     $spawnPosition = $this->getSpawn();
     $pk = new StartGamePacket();
     $pk->entityUniqueId = 0;
     //Always use EntityID as zero for the actual player
     $pk->entityRuntimeId = 0;
     //Always use EntityID as zero for the actual player
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->seed = -1;
     $pk->dimension = 0;
     $pk->gamemode = $this->gamemode & 0x1;
     $pk->difficulty = $this->server->getDifficulty();
     $pk->spawnX = $spawnPosition->getFloorX();
     $pk->spawnY = $spawnPosition->getFloorY();
     $pk->spawnZ = $spawnPosition->getFloorZ();
     $pk->hasBeenLoadedInCreative = 1;
     $pk->dayCycleStopTime = -1;
     //TODO: implement this properly
     $pk->eduMode = 0;
     $pk->rainLevel = 0;
     //TODO: implement these properly
     $pk->lightningLevel = 0;
     $pk->commandsEnabled = 1;
     $pk->levelId = "";
     $pk->worldName = $this->server->getMotd();
     $this->dataPacket($pk);
     $pk = new SetTimePacket();
     $pk->time = $this->level->getTime();
     $pk->started = $this->level->stopTime == false;
     $this->dataPacket($pk);
     $pk = new SetSpawnPositionPacket();
     $pk->x = (int) $spawnPosition->x;
     $pk->y = (int) $spawnPosition->y;
     $pk->z = (int) $spawnPosition->z;
     $this->dataPacket($pk);
     $pk = new SetDifficultyPacket();
     $pk->difficulty = $this->server->getDifficulty();
     $this->dataPacket($pk);
     $this->sendAttributes(true);
     $this->setNameTagVisible(true);
     $this->setNameTagAlwaysVisible(true);
     $this->server->getLogger()->info($this->getServer()->getLanguage()->translateString("pocketmine.player.logIn", [TextFormat::AQUA . $this->username . TextFormat::WHITE, $this->ip, $this->port, $this->id, $this->level->getName(), round($this->x, 4), round($this->y, 4), round($this->z, 4)]));
     if ($this->isOp()) {
         $this->setRemoveFormat(false);
     }
     $this->sendCommandData();
     if ($this->gamemode === Player::SPECTATOR) {
         $pk = new ContainerSetContentPacket();
         $pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
         $this->dataPacket($pk);
     } else {
         $pk = new ContainerSetContentPacket();
         $pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
         $pk->slots = Item::getCreativeItems();
         $this->dataPacket($pk);
     }
     $this->setDataProperty(self::DATA_NO_AI, self::DATA_TYPE_BYTE, 0);
     $this->setMovementSpeed(self::DEFAULT_SPEED);
     $this->forceMovement = $this->teleportPosition = $this->getPosition();
     $this->server->onPlayerLogin($this);
 }
开发者ID:robske110,项目名称:ClearSky,代码行数:101,代码来源:Player.php

示例7: processLogin


//.........这里部分代码省略.........
         $nbt->Hunger = new ShortTag("Hunger", 20);
         $nbt->Health = new ShortTag("Health", 20);
         $nbt->MaxHealth = new ShortTag("MaxHealth", 20);
     }
     $this->food = $nbt["Hunger"];
     $this->setMaxHealth($nbt["MaxHealth"]);
     Entity::setHealth($nbt["Health"] <= 0 ? 20 : $nbt["Health"]);
     $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 ByteTag $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->username, $nbt, true);
     }
     parent::__construct($this->level->getChunk($nbt["Pos"][0] >> 4, $nbt["Pos"][2] >> 4, true), $nbt);
     $this->loggedIn = true;
     $this->server->addOnlinePlayer($this);
     $this->server->getPluginManager()->callEvent($ev = new PlayerLoginEvent($this, "Plugin reason"));
     if ($ev->isCancelled()) {
         $this->close($this->getLeaveMessage(), $ev->getKickMessage());
         return;
     }
     if (!$this->isConnected()) {
         return;
     }
     $this->dataPacket(new ResourcePacksInfoPacket());
     if (!$this->hasValidSpawnPosition() and isset($this->namedtag->SpawnLevel) and ($level = $this->server->getLevelByName($this->namedtag["SpawnLevel"])) instanceof Level) {
         $this->spawnPosition = new WeakPosition($this->namedtag["SpawnX"], $this->namedtag["SpawnY"], $this->namedtag["SpawnZ"], $level);
     }
     $spawnPosition = $this->getSpawn();
     $pk = new StartGamePacket();
     $pk->entityUniqueId = 0;
     $pk->entityRuntimeId = 0;
     $pk->x = $this->x;
     $pk->y = $this->y;
     $pk->z = $this->z;
     $pk->seed = -1;
     $pk->dimension = $this->level->getDimension();
     $pk->gamemode = $this->gamemode & 0x1;
     $pk->difficulty = $this->server->getDifficulty();
     $pk->spawnX = $spawnPosition->getFloorX();
     $pk->spawnY = $spawnPosition->getFloorY();
     $pk->spawnZ = $spawnPosition->getFloorZ();
     $pk->hasBeenLoadedInCreative = 1;
     $pk->dayCycleStopTime = -1;
     //TODO: implement this properly
     $pk->eduMode = 0;
     $pk->rainLevel = 0;
     //TODO: implement these properly
     $pk->lightningLevel = 0;
     $pk->commandsEnabled = 1;
     $pk->unknown = "UNKNOWN";
     $pk->worldName = $this->server->getMotd();
     $this->dataPacket($pk);
     $pk = new SetTimePacket();
     $pk->time = $this->level->getTime();
     $pk->started = $this->level->stopTime == false;
     $this->dataPacket($pk);
     $this->sendAttributes(true);
     $this->setNameTagVisible(true);
     $this->setNameTagAlwaysVisible(true);
     $this->server->getLogger()->info($this->getServer()->getLanguage()->translateString("pocketmine.player.logIn", [TextFormat::AQUA . $this->username . TextFormat::WHITE, $this->ip, $this->port, TextFormat::GREEN . $this->randomClientId . TextFormat::WHITE, $this->id, $this->level->getName(), round($this->x, 4), round($this->y, 4), round($this->z, 4)]));
     /*if($this->isOp()){
     			$this->setRemoveFormat(false);
     		}*/
     if ($this->gamemode === Player::SPECTATOR) {
         $pk = new ContainerSetContentPacket();
         $pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
         $this->dataPacket($pk);
     } else {
         $pk = new ContainerSetContentPacket();
         $pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;
         $pk->slots = array_merge(Item::getCreativeItems(), $this->personalCreativeItems);
         $this->dataPacket($pk);
     }
     $this->sendCommandData();
     $this->level->getWeather()->sendWeather($this);
     $this->forceMovement = $this->teleportPosition = $this->getPosition();
 }
开发者ID:kniffo80,项目名称:Genisys,代码行数:101,代码来源:Player.php


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