59 public function __construct(
66 public function setUp() :
void{
67 Timings::$playerNetworkSendPreSpawnGameData->startTiming();
69 $location = $this->player->getLocation();
70 $world = $location->getWorld();
72 $typeConverter = $this->session->getTypeConverter();
74 $this->session->getLogger()->debug(
"Preparing StartGamePacket");
76 $levelSettings->seed = -1;
77 $levelSettings->spawnSettings =
new SpawnSettings(SpawnSettings::BIOME_TYPE_DEFAULT,
"", DimensionIds::OVERWORLD);
78 $levelSettings->worldGamemode = $typeConverter->coreGameModeToProtocol($this->
server->getGamemode());
79 $levelSettings->difficulty = $world->getDifficulty();
80 $levelSettings->spawnPosition = BlockPosition::fromVector3($world->getSpawnLocation());
81 $levelSettings->hasAchievementsDisabled =
true;
82 $levelSettings->time = $world->getTime();
83 $levelSettings->eduEditionOffer = 0;
84 $levelSettings->rainLevel = 0;
85 $levelSettings->lightningLevel = 0;
86 $levelSettings->commandsEnabled =
true;
87 $levelSettings->gameRules = [
91 $levelSettings->experiments =
new Experiments([],
false);
94 $this->player->getId(),
95 $this->player->getId(),
96 $typeConverter->coreGameModeToProtocol($this->player->getGamemode()),
97 $this->player->getOffsetPosition($location),
111 sprintf(
"%s %s", VersionInfo::NAME, VersionInfo::VERSION()->getFullVersion(
true)),
112 Uuid::fromString(Uuid::NIL),
122 $this->session->getLogger()->debug(
"Sending items");
125 $this->session->getLogger()->debug(
"Sending actor identifiers");
126 $this->session->sendDataPacket(StaticPacketCache::getInstance()->getAvailableActorIdentifiers());
128 $this->session->getLogger()->debug(
"Sending biome definitions");
129 $this->session->sendDataPacket(StaticPacketCache::getInstance()->getBiomeDefs());
131 $this->session->getLogger()->debug(
"Sending attributes");
132 $this->session->getEntityEventBroadcaster()->syncAttributes([$this->session], $this->player, $this->player->getAttributeMap()->getAll());
134 $this->session->getLogger()->debug(
"Sending available commands");
135 $this->session->syncAvailableCommands();
137 $this->session->getLogger()->debug(
"Sending abilities");
138 $this->session->syncAbilities($this->player);
139 $this->session->syncAdventureSettings();
141 $this->session->getLogger()->debug(
"Sending effects");
142 foreach($this->player->getEffects()->all() as $effect){
143 $this->session->getEntityEventBroadcaster()->onEntityEffectAdded([$this->session], $this->player, $effect,
false);
146 $this->session->getLogger()->debug(
"Sending actor metadata");
147 $this->player->sendData([$this->player]);
149 $this->session->getLogger()->debug(
"Sending inventory");
150 $this->inventoryManager->syncAll();
151 $this->inventoryManager->syncSelectedHotbarSlot();
153 $this->session->getLogger()->debug(
"Sending creative inventory data");
154 $this->inventoryManager->syncCreative();
156 $this->session->getLogger()->debug(
"Sending crafting data");
157 $this->session->sendDataPacket(CraftingDataCache::getInstance()->getCache($this->
server->getCraftingManager()));
159 $this->session->getLogger()->debug(
"Sending player list");
160 $this->session->syncPlayerList($this->
server->getOnlinePlayers());
162 Timings::$playerNetworkSendPreSpawnGameData->stopTiming();
167 $this->player->setViewDistance($packet->radius);
static create(int $actorUniqueId, int $actorRuntimeId, int $playerGamemode, Vector3 $playerPosition, float $pitch, float $yaw, CacheableNbt $playerActorProperties, LevelSettings $levelSettings, string $levelId, string $worldName, string $premiumWorldTemplateId, bool $isTrial, PlayerMovementSettings $playerMovementSettings, int $currentTick, int $enchantmentSeed, string $multiplayerCorrelationId, bool $enableNewInventorySystem, string $serverSoftwareVersion, UuidInterface $worldTemplateId, bool $enableClientSideChunkGeneration, bool $blockNetworkIdsAreHashes, NetworkPermissions $networkPermissions, ?ServerJoinInformation $serverJoinInformation, ServerTelemetryData $serverTelemetryData, array $blockPalette, int $blockPaletteChecksum,)