diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-04-01 00:07:37 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-04-30 23:59:03 +0200 |
commit | 5ae3b2c11416eb897a08b0d9531843d0357332f8 (patch) | |
tree | a5850f8e58ccb2db55c4a992677770126139429e /logic/minecraft/MinecraftVersionList.cpp | |
parent | 4392abfb8d3b45fb6c5cabe9d5e30c9416a5ad90 (diff) | |
download | MultiMC-5ae3b2c11416eb897a08b0d9531843d0357332f8.tar MultiMC-5ae3b2c11416eb897a08b0d9531843d0357332f8.tar.gz MultiMC-5ae3b2c11416eb897a08b0d9531843d0357332f8.tar.lz MultiMC-5ae3b2c11416eb897a08b0d9531843d0357332f8.tar.xz MultiMC-5ae3b2c11416eb897a08b0d9531843d0357332f8.zip |
NOISSUE nuke builtin Minecraft versions
Use upstream Mojang versions.
Diffstat (limited to 'logic/minecraft/MinecraftVersionList.cpp')
-rw-r--r-- | logic/minecraft/MinecraftVersionList.cpp | 70 |
1 files changed, 4 insertions, 66 deletions
diff --git a/logic/minecraft/MinecraftVersionList.cpp b/logic/minecraft/MinecraftVersionList.cpp index bd679c73..eab55c9a 100644 --- a/logic/minecraft/MinecraftVersionList.cpp +++ b/logic/minecraft/MinecraftVersionList.cpp @@ -83,7 +83,6 @@ public: MinecraftVersionList::MinecraftVersionList(QObject *parent) : BaseVersionList(parent) { - loadBuiltinList(); loadCachedList(); } @@ -141,7 +140,7 @@ void MinecraftVersionList::loadCachedList() { throw ListLoadError(tr("Error reading the version list.")); } - loadMojangList(jsonDoc, Local); + loadList(jsonDoc, Local); } catch (Exception &e) { @@ -153,57 +152,7 @@ void MinecraftVersionList::loadCachedList() m_hasLocalIndex = true; } -void MinecraftVersionList::loadBuiltinList() -{ - qDebug() << "Loading builtin version list."; - // grab the version list data from internal resources. - const QJsonDocument doc = - Json::requireDocument(QString(":/versions/minecraft.json"), "builtin version list"); - const QJsonObject root = doc.object(); - - // parse all the versions - for (const auto version : Json::requireArray(root.value("versions"))) - { - QJsonObject versionObj = version.toObject(); - QString versionID = versionObj.value("id").toString(""); - QString versionTypeStr = versionObj.value("type").toString(""); - if (versionID.isEmpty() || versionTypeStr.isEmpty()) - { - qCritical() << "Parsed version is missing ID or type"; - continue; - } - - if (g_VersionFilterData.legacyBlacklist.contains(versionID)) - { - qWarning() << "Blacklisted legacy version ignored: " << versionID; - continue; - } - - // Now, we construct the version object and add it to the list. - std::shared_ptr<MinecraftVersion> mcVersion(new MinecraftVersion()); - mcVersion->m_name = mcVersion->m_descriptor = versionID; - - // Parse the timestamp. - mcVersion->m_releaseTime = timeFromS3Time(versionObj.value("releaseTime").toString("")); - mcVersion->m_versionFileURL = QString(); - mcVersion->m_versionSource = Builtin; - mcVersion->m_type = versionTypeStr; - mcVersion->m_appletClass = versionObj.value("appletClass").toString(""); - mcVersion->m_mainClass = versionObj.value("mainClass").toString(""); - mcVersion->m_jarChecksum = versionObj.value("checksum").toString(""); - if (versionObj.contains("+traits")) - { - for (auto traitVal : Json::requireArray(versionObj.value("+traits"))) - { - mcVersion->m_traits.insert(Json::requireString(traitVal)); - } - } - m_lookup[versionID] = mcVersion; - m_vlist.append(mcVersion); - } -} - -void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource source) +void MinecraftVersionList::loadList(QJsonDocument jsonDoc, VersionSource source) { qDebug() << "Loading" << ((source == Remote) ? "remote" : "local") << "version list."; @@ -260,16 +209,11 @@ void MinecraftVersionList::loadMojangList(QJsonDocument jsonDoc, VersionSource s // Now, we construct the version object and add it to the list. std::shared_ptr<MinecraftVersion> mcVersion(new MinecraftVersion()); - mcVersion->m_name = mcVersion->m_descriptor = versionID; + mcVersion->m_version = versionID; mcVersion->m_releaseTime = timeFromS3Time(versionObj.value("releaseTime").toString("")); mcVersion->m_updateTime = timeFromS3Time(versionObj.value("time").toString("")); - if (mcVersion->m_releaseTime < g_VersionFilterData.legacyCutoffDate) - { - continue; - } - // depends on where we load the version from -- network request or local file? mcVersion->m_versionSource = source; mcVersion->m_versionFileURL = versionObj.value("url").toString(""); @@ -444,7 +388,7 @@ void MCVListLoadTask::list_downloaded() throw ListLoadError( tr("Error parsing version list JSON: %1").arg(jsonError.errorString())); } - m_list->loadMojangList(jsonDoc, Remote); + m_list->loadList(jsonDoc, Remote); } catch (Exception &e) { @@ -502,8 +446,6 @@ void MCVListVersionUpdateTask::json_downloaded() // Strip LWJGL from the version file. We use our own. ProfileUtils::removeLwjglFromPatch(file); - // TODO: recognize and add LWJGL versions here. - file->fileId = "net.minecraft"; // now dump the file to disk @@ -627,10 +569,6 @@ void MinecraftVersionList::finalizeUpdate(QString version) auto updatedVersion = std::dynamic_pointer_cast<MinecraftVersion>(m_vlist[idx]); - // reject any updates to builtin versions. - if (updatedVersion->m_versionSource == Builtin) - return; - // if we have an update for the version, replace it, make the update local if (updatedVersion->upstreamUpdate) { |