aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-04-09 14:56:07 +0200
committerSefa Eyeoglu <contact@scrumplex.net>2022-04-09 14:56:07 +0200
commit89125fde22d39aed93ab516956b3a4e30cca7a88 (patch)
treea4feafd2fe5ece3a3466ba6ab75d9be89463d725 /launcher
parent35cfb41a9c8cf1328f3d2d14022cf51cbfc67f1f (diff)
downloadPrismLauncher-89125fde22d39aed93ab516956b3a4e30cca7a88.tar.gz
PrismLauncher-89125fde22d39aed93ab516956b3a4e30cca7a88.tar.bz2
PrismLauncher-89125fde22d39aed93ab516956b3a4e30cca7a88.zip
refactor: switch Quilt mappings to hashed MojMap
Diffstat (limited to 'launcher')
-rw-r--r--launcher/minecraft/ComponentUpdateTask.cpp39
-rw-r--r--launcher/ui/pages/instance/VersionPage.cpp2
2 files changed, 10 insertions, 31 deletions
diff --git a/launcher/minecraft/ComponentUpdateTask.cpp b/launcher/minecraft/ComponentUpdateTask.cpp
index a0559232..0095c613 100644
--- a/launcher/minecraft/ComponentUpdateTask.cpp
+++ b/launcher/minecraft/ComponentUpdateTask.cpp
@@ -494,31 +494,6 @@ static bool getTrivialComponentChanges(const ComponentIndex & index, const Requi
return succeeded;
}
-QString ComponentUpdateTask::findBestComponentVersion(const ComponentPtr component)
-{
- auto & components = d->m_list->d->components;
- auto versions = component->getVersionList();
- versions->load(d->netmode);
-
- for (auto & version : versions->versions()) {
- if (version->isRecommended()) { // only look at recommended versions
- bool requirementsMet = true;
- for (auto req : version->requires()) {
- auto requirementMet = std::any_of(components.begin(), components.end(), [&req](ComponentPtr & cmp){
- return cmp->getID() == req.uid && cmp->getVersion() == req.equalsVersion;
- });
- if (!requirementMet) {
- requirementsMet = false;
- }
- }
-
- if (requirementsMet) // return first recommended version that meets all requirements
- return version->version();
- }
- }
- return nullptr;
-}
-
// FIXME, TODO: decouple dependency resolution from loading
// FIXME: This works directly with the PackProfile internals. It shouldn't! It needs richer data types than PackProfile uses.
// FIXME: throw all this away and use a graph
@@ -615,13 +590,17 @@ void ComponentUpdateTask::resolveDependencies(bool checkOnly)
{
component->m_version = "3.1.2";
}
-// HACK HACK HACK HACK FIXME: this is a placeholder for deciding what version to use. For now, it is hardcoded.
-// ############################################################################################################
-// below is not ugly anymore
- else if (add.uid == "net.fabricmc.intermediary" || add.uid == "org.quiltmc.quilt-mappings")
+ else if (add.uid == "net.fabricmc.intermediary" || add.uid == "org.quiltmc.hashed")
{
- component->m_version = findBestComponentVersion(component);
+ auto minecraft = std::find_if(components.begin(), components.end(), [](ComponentPtr & cmp){
+ return cmp->getID() == "net.minecraft";
+ });
+ if(minecraft != components.end()) {
+ component->m_version = (*minecraft)->getVersion();
+ }
}
+// HACK HACK HACK HACK FIXME: this is a placeholder for deciding what version to use. For now, it is hardcoded.
+// ############################################################################################################
}
}
component->m_dependencyOnly = true;
diff --git a/launcher/ui/pages/instance/VersionPage.cpp b/launcher/ui/pages/instance/VersionPage.cpp
index 6b9c82a2..7264f362 100644
--- a/launcher/ui/pages/instance/VersionPage.cpp
+++ b/launcher/ui/pages/instance/VersionPage.cpp
@@ -395,7 +395,7 @@ void VersionPage::on_actionChange_version_triggered()
return;
}
VersionSelectDialog vselect(list.get(), tr("Change %1 version").arg(name), this);
- if (uid == "net.fabricmc.intermediary" || uid == "org.quiltmc.quilt-mappings")
+ if (uid == "net.fabricmc.intermediary" || uid == "org.quiltmc.hashed")
{
vselect.setEmptyString(tr("No intermediary mappings versions are currently available."));
vselect.setEmptyErrorString(tr("Couldn't load or download the intermediary mappings version lists!"));