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),
123 $this->session->getLogger()->debug(
"Sending items");
126 $this->session->getLogger()->debug(
"Sending actor identifiers");
127 $this->session->sendDataPacket(StaticPacketCache::getInstance()->getAvailableActorIdentifiers());
129 $this->session->getLogger()->debug(
"Sending biome definitions");
130 $this->session->sendDataPacket(StaticPacketCache::getInstance()->getBiomeDefs());
132 $this->session->getLogger()->debug(
"Sending attributes");
133 $this->session->getEntityEventBroadcaster()->syncAttributes([$this->session], $this->player, $this->player->getAttributeMap()->getAll());
135 $this->session->getLogger()->debug(
"Sending available commands");
136 $this->session->syncAvailableCommands();
138 $this->session->getLogger()->debug(
"Sending abilities");
139 $this->session->syncAbilities($this->player);
140 $this->session->syncAdventureSettings();
142 $this->session->getLogger()->debug(
"Sending effects");
143 foreach($this->player->getEffects()->all() as $effect){
144 $this->session->getEntityEventBroadcaster()->onEntityEffectAdded([$this->session], $this->player, $effect,
false);
147 $this->session->getLogger()->debug(
"Sending actor metadata");
148 $this->player->sendData([$this->player]);
150 $this->session->getLogger()->debug(
"Sending inventory");
151 $this->inventoryManager->syncAll();
152 $this->inventoryManager->syncSelectedHotbarSlot();
154 $this->session->getLogger()->debug(
"Sending creative inventory data");
155 $this->inventoryManager->syncCreative();
157 $this->session->getLogger()->debug(
"Sending crafting data");
158 $this->session->sendDataPacket(CraftingDataCache::getInstance()->getCache($this->
server->getCraftingManager()));
160 $this->session->getLogger()->debug(
"Sending player list");
161 $this->session->syncPlayerList($this->
server->getOnlinePlayers());
163 Timings::$playerNetworkSendPreSpawnGameData->stopTiming();
168 $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, bool $isLoggingChat, ?ServerJoinInformation $serverJoinInformation, ServerTelemetryData $serverTelemetryData, array $blockPalette, int $blockPaletteChecksum,)