aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/VersionFile.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2021-07-25 19:11:59 +0200
committerPetr Mrázek <peterix@gmail.com>2021-07-25 19:50:44 +0200
commit20b9f2b42a3b58b6081af271774fbcc34025dccb (patch)
tree064fa59facb3357139b47bd4e60bfc8edb35ca11 /launcher/minecraft/VersionFile.cpp
parentdd133680858351e3e07690e286882327a4f42ba5 (diff)
downloadPrismLauncher-20b9f2b42a3b58b6081af271774fbcc34025dccb.tar.gz
PrismLauncher-20b9f2b42a3b58b6081af271774fbcc34025dccb.tar.bz2
PrismLauncher-20b9f2b42a3b58b6081af271774fbcc34025dccb.zip
NOISSUE Flatten gui and logic libraries into MultiMC
Diffstat (limited to 'launcher/minecraft/VersionFile.cpp')
-rw-r--r--launcher/minecraft/VersionFile.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/launcher/minecraft/VersionFile.cpp b/launcher/minecraft/VersionFile.cpp
new file mode 100644
index 00000000..d0a1a507
--- /dev/null
+++ b/launcher/minecraft/VersionFile.cpp
@@ -0,0 +1,60 @@
+#include <QJsonArray>
+#include <QJsonDocument>
+
+#include <QDebug>
+
+#include "minecraft/VersionFile.h"
+#include "minecraft/Library.h"
+#include "minecraft/PackProfile.h"
+#include "ParseUtils.h"
+
+#include <Version.h>
+
+static bool isMinecraftVersion(const QString &uid)
+{
+ return uid == "net.minecraft";
+}
+
+void VersionFile::applyTo(LaunchProfile *profile)
+{
+ // Only real Minecraft can set those. Don't let anything override them.
+ if (isMinecraftVersion(uid))
+ {
+ profile->applyMinecraftVersion(minecraftVersion);
+ profile->applyMinecraftVersionType(type);
+ // HACK: ignore assets from other version files than Minecraft
+ // workaround for stupid assets issue caused by amazon:
+ // https://www.theregister.co.uk/2017/02/28/aws_is_awol_as_s3_goes_haywire/
+ profile->applyMinecraftAssets(mojangAssetIndex);
+ }
+
+ profile->applyMainJar(mainJar);
+ profile->applyMainClass(mainClass);
+ profile->applyAppletClass(appletClass);
+ profile->applyMinecraftArguments(minecraftArguments);
+ profile->applyTweakers(addTweakers);
+ profile->applyJarMods(jarMods);
+ profile->applyMods(mods);
+ profile->applyTraits(traits);
+
+ for (auto library : libraries)
+ {
+ profile->applyLibrary(library);
+ }
+ for (auto mavenFile : mavenFiles)
+ {
+ profile->applyMavenFile(mavenFile);
+ }
+ profile->applyProblemSeverity(getProblemSeverity());
+}
+
+/*
+ auto theirVersion = profile->getMinecraftVersion();
+ if (!theirVersion.isNull() && !dependsOnMinecraftVersion.isNull())
+ {
+ if (QRegExp(dependsOnMinecraftVersion, Qt::CaseInsensitive, QRegExp::Wildcard).indexIn(theirVersion) == -1)
+ {
+ throw MinecraftVersionMismatch(uid, dependsOnMinecraftVersion, theirVersion);
+ }
+ }
+*/