MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / assetIndexFinished

Method assetIndexFinished

launcher/minecraft/update/AssetUpdateTask.cpp:58–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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