MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / assetIndexFinished

Method assetIndexFinished

launcher/minecraft/update/AssetUpdateTask.cpp:54–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54void AssetUpdateTask::assetIndexFinished()
55{
56 AssetsIndex index;
57 qDebug() << m_inst->name() << ": Finished asset index download";
58
59 auto components = m_inst->getPackProfile();
60 auto profile = components->getProfile();
61 auto assets = profile->getMinecraftAssets();
62
63 QString asset_fname = "assets/indexes/" + assets->id + ".json";
64 // FIXME: this looks like a job for a generic validator based on json schema?
65 if (!AssetsUtils::loadAssetsIndexJson(assets->id, asset_fname, index)) {
66 auto metacache = APPLICATION->metacache();
67 auto entry = metacache->resolveEntry("asset_indexes", assets->id + ".json");
68 metacache->evictEntry(entry);
69 emitFailed(tr("Failed to read the assets index!"));
70 }
71
72 auto job = index.getDownloadJob();
73 if (job) {
74 setStatus(tr("Getting the assets files from Mojang..."));
75 downloadJob = job;
76 connect(downloadJob.get(), &NetJob::succeeded, this, &AssetUpdateTask::emitSucceeded);
77 connect(downloadJob.get(), &NetJob::failed, this, &AssetUpdateTask::assetsFailed);
78 connect(downloadJob.get(), &NetJob::aborted, this, [this] { emitFailed(tr("Aborted")); });
79 connect(downloadJob.get(), &NetJob::progress, this, &AssetUpdateTask::progress);
80 connect(downloadJob.get(), &NetJob::stepProgress, this, &AssetUpdateTask::propagateStepProgress);
81 downloadJob->start();
82 return;
83 }
84 emitSucceeded();
85}
86
87void AssetUpdateTask::assetIndexFailed(QString reason)
88{

Callers

nothing calls this directly

Calls 11

loadAssetsIndexJsonFunction · 0.85
getPackProfileMethod · 0.80
getProfileMethod · 0.80
getMinecraftAssetsMethod · 0.80
metacacheMethod · 0.80
resolveEntryMethod · 0.80
evictEntryMethod · 0.80
getDownloadJobMethod · 0.80
nameMethod · 0.45
getMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected