summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft
diff options
context:
space:
mode:
Diffstat (limited to 'api/logic/minecraft')
-rw-r--r--api/logic/minecraft/MinecraftProfile.cpp6
-rw-r--r--api/logic/minecraft/MinecraftProfile.h3
-rw-r--r--api/logic/minecraft/ProfilePatch.cpp5
-rw-r--r--api/logic/minecraft/ProfilePatch.h1
-rw-r--r--api/logic/minecraft/onesix/OneSixUpdate.cpp33
5 files changed, 29 insertions, 19 deletions
diff --git a/api/logic/minecraft/MinecraftProfile.cpp b/api/logic/minecraft/MinecraftProfile.cpp
index e7e88efd..4c1ab818 100644
--- a/api/logic/minecraft/MinecraftProfile.cpp
+++ b/api/logic/minecraft/MinecraftProfile.cpp
@@ -385,6 +385,7 @@ bool MinecraftProfile::reapplyPatches()
clear();
for(auto file: m_patches)
{
+ qDebug() << "Applying" << file->getID() << (file->getProblemSeverity() == ProblemSeverity::Error ? "ERROR" : "GOOD");
file->applyTo(this);
}
}
@@ -663,11 +664,6 @@ void MinecraftProfile::installJarMods(QStringList selectedFiles)
m_strategy->installJarMods(selectedFiles);
}
-void MinecraftProfile::installVersion(BaseVersionPtr version)
-{
- // TODO: implement
-}
-
/*
* TODO: get rid of this. Get rid of all order numbers.
*/
diff --git a/api/logic/minecraft/MinecraftProfile.h b/api/logic/minecraft/MinecraftProfile.h
index 8cb5331f..192c77f9 100644
--- a/api/logic/minecraft/MinecraftProfile.h
+++ b/api/logic/minecraft/MinecraftProfile.h
@@ -58,9 +58,6 @@ public:
/// install more jar mods
void installJarMods(QStringList selectedFiles);
- /// install more jar mods
- void installVersion(BaseVersionPtr version);
-
/// DEPRECATED, remove ASAP
int getFreeOrderNumber();
diff --git a/api/logic/minecraft/ProfilePatch.cpp b/api/logic/minecraft/ProfilePatch.cpp
index 3ca2ac68..a2605278 100644
--- a/api/logic/minecraft/ProfilePatch.cpp
+++ b/api/logic/minecraft/ProfilePatch.cpp
@@ -17,6 +17,11 @@ ProfilePatch::ProfilePatch(std::shared_ptr<VersionFile> file, const QString& fil
{
}
+std::shared_ptr<Meta::Version> ProfilePatch::getMeta()
+{
+ return m_metaVersion;
+}
+
void ProfilePatch::applyTo(MinecraftProfile* profile)
{
auto vfile = getVersionFile();
diff --git a/api/logic/minecraft/ProfilePatch.h b/api/logic/minecraft/ProfilePatch.h
index 53f4c5e4..59171a0a 100644
--- a/api/logic/minecraft/ProfilePatch.h
+++ b/api/logic/minecraft/ProfilePatch.h
@@ -36,6 +36,7 @@ public:
virtual QString getID();
virtual QString getName();
virtual QString getVersion();
+ virtual std::shared_ptr<Meta::Version> getMeta();
virtual QDateTime getReleaseDateTime();
virtual QString getFilename();
diff --git a/api/logic/minecraft/onesix/OneSixUpdate.cpp b/api/logic/minecraft/onesix/OneSixUpdate.cpp
index bf234189..e0027032 100644
--- a/api/logic/minecraft/onesix/OneSixUpdate.cpp
+++ b/api/logic/minecraft/onesix/OneSixUpdate.cpp
@@ -44,25 +44,36 @@ OneSixUpdate::OneSixUpdate(OneSixInstance *inst, QObject *parent) : Task(parent)
m_tasks.append(std::make_shared<FoldersTask>(m_inst));
}
- // add a version update task, if necessary
+ // add metadata update tasks, if necessary
{
/*
* FIXME: there are some corner cases here that remain unhandled:
* what if local load succeeds but remote fails? The version is still usable...
+ * We should not rely on the remote to be there... and prefer local files if it does not respond.
*/
- // FIXME: derive this from the actual list of version patches...
- auto loadVersion = [&](const QString & uid, const QString & version)
+ qDebug() << "Updating patches...";
+ auto profile = m_inst->getMinecraftProfile();
+ m_inst->reloadProfile();
+ for(int i = 0; i < profile->rowCount(); i++)
{
- auto obj = ENV.metadataIndex()->get(uid, version);
- obj->load();
- auto task = obj->getCurrentTask();
- if(task)
+ auto patch = profile->versionPatch(i);
+ auto id = patch->getID();
+ auto metadata = patch->getMeta();
+ if(metadata)
{
- m_tasks.append(task.unwrap());
+ metadata->load();
+ auto task = metadata->getCurrentTask();
+ if(task)
+ {
+ qDebug() << "Loading remote meta patch" << id;
+ m_tasks.append(task.unwrap());
+ }
}
- };
- loadVersion("org.lwjgl", m_inst->getComponentVersion("org.lwjgl"));
- loadVersion("net.minecraft", m_inst->getComponentVersion("net.minecraft"));
+ else
+ {
+ qDebug() << "Ignoring local patch" << id;
+ }
+ }
}
// libraries download