player = $player; $this->server = $server; $this->session = $session; } public function setUp() : void{ $spawnPosition = $this->player->getSpawn(); $pk = new StartGamePacket(); $pk->entityUniqueId = $this->player->getId(); $pk->entityRuntimeId = $this->player->getId(); $pk->playerGamemode = Player::getClientFriendlyGamemode($this->player->getGamemode()); $pk->playerPosition = $this->player->getOffsetPosition($this->player); $pk->pitch = $this->player->pitch; $pk->yaw = $this->player->yaw; $pk->seed = -1; $pk->dimension = DimensionIds::OVERWORLD; //TODO: implement this properly $pk->worldGamemode = Player::getClientFriendlyGamemode($this->server->getGamemode()); $pk->difficulty = $this->player->getLevel()->getDifficulty(); $pk->spawnX = $spawnPosition->getFloorX(); $pk->spawnY = $spawnPosition->getFloorY(); $pk->spawnZ = $spawnPosition->getFloorZ(); $pk->hasAchievementsDisabled = true; $pk->time = $this->player->getLevel()->getTime(); $pk->eduMode = false; $pk->rainLevel = 0; //TODO: implement these properly $pk->lightningLevel = 0; $pk->commandsEnabled = true; $pk->levelId = ""; $pk->worldName = $this->server->getMotd(); $this->session->sendDataPacket($pk); $this->player->getLevel()->sendTime($this->player); $this->player->sendAttributes(true); $this->player->sendCommandData(); $this->player->sendSettings(); $this->player->sendPotionEffects($this->player); $this->player->sendData($this->player); $this->player->sendAllInventories(); $this->player->getInventory()->sendCreativeContents(); $this->player->getInventory()->sendHeldItem($this->player); $this->session->sendEncoded($this->server->getCraftingManager()->getCraftingDataPacket()); $this->server->sendFullPlayerListData($this->player); } public function handleRequestChunkRadius(RequestChunkRadiusPacket $packet) : bool{ $this->player->setViewDistance($packet->radius); return true; } }