MCPcopy Create free account
hub / github.com/MultiMC/Launcher / loadComponents

Method loadComponents

launcher/minecraft/ComponentUpdateTask.cpp:174–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174void ComponentUpdateTask::loadComponents()
175{
176 LoadResult result = LoadResult::LoadedLocal;
177 size_t taskIndex = 0;
178 size_t componentIndex = 0;
179 d->remoteLoadSuccessful = true;
180 // load the main index (it is needed to determine if components can revert)
181 {
182 // FIXME: tear out as a method? or lambda?
183 Task::Ptr indexLoadTask;
184 auto singleResult = loadIndex(indexLoadTask, d->netmode);
185 result = composeLoadResult(result, singleResult);
186 if(indexLoadTask)
187 {
188 qDebug() << "Remote loading is being run for metadata index";
189 RemoteLoadStatus status;
190 status.type = RemoteLoadStatus::Type::Index;
191 d->remoteLoadStatusList.append(status);
192 connect(indexLoadTask.get(), &Task::succeeded, [=]()
193 {
194 remoteLoadSucceeded(taskIndex);
195 });
196 connect(indexLoadTask.get(), &Task::failed, [=](const QString & error)
197 {
198 remoteLoadFailed(taskIndex, error);
199 });
200 taskIndex++;
201 }
202 }
203 // load all the components OR their lists...
204 for (auto component: d->m_list->d->components)
205 {
206 Task::Ptr loadTask;
207 LoadResult singleResult;
208 RemoteLoadStatus::Type loadType;
209 // FIXME: to do this right, we need to load the lists and decide on which versions to use during dependency resolution. For now, ignore all that...
210#if 0
211 switch(d->mode)
212 {
213 case Mode::Launch:
214 {
215 singleResult = loadComponent(component, loadTask, d->netmode);
216 loadType = RemoteLoadStatus::Type::Version;
217 break;
218 }
219 case Mode::Resolution:
220 {
221 singleResult = loadPackProfile(component, loadTask, d->netmode);
222 loadType = RemoteLoadStatus::Type::List;
223 break;
224 }
225 }
226#else
227 singleResult = loadComponent(component, loadTask, d->netmode);
228 loadType = RemoteLoadStatus::Type::Version;
229#endif
230 if(singleResult == LoadResult::LoadedLocal)
231 {

Callers

nothing calls this directly

Calls 8

loadIndexFunction · 0.85
composeLoadResultFunction · 0.85
loadComponentFunction · 0.85
loadPackProfileFunction · 0.85
appendMethod · 0.80
updateCachedDataMethod · 0.80
getNameMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected