summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/onesix/OneSixVersionFormat.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-04-13 09:28:25 +0200
committerPetr Mrázek <peterix@gmail.com>2017-04-13 09:28:25 +0200
commitbe53eb66f8a63730f4def5640db6205678b4e9d8 (patch)
treebd5bdef96985312b6687b40f8835336bb3f56bb3 /api/logic/minecraft/onesix/OneSixVersionFormat.cpp
parentdb7357d008ae1f4ac0599b7e410ab666dbea5805 (diff)
downloadMultiMC-be53eb66f8a63730f4def5640db6205678b4e9d8.tar
MultiMC-be53eb66f8a63730f4def5640db6205678b4e9d8.tar.gz
MultiMC-be53eb66f8a63730f4def5640db6205678b4e9d8.tar.lz
MultiMC-be53eb66f8a63730f4def5640db6205678b4e9d8.tar.xz
MultiMC-be53eb66f8a63730f4def5640db6205678b4e9d8.zip
NOISSUE implement mainJar support in OneSix format
This allows customizing the main jar like any other library.
Diffstat (limited to 'api/logic/minecraft/onesix/OneSixVersionFormat.cpp')
-rw-r--r--api/logic/minecraft/onesix/OneSixVersionFormat.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/api/logic/minecraft/onesix/OneSixVersionFormat.cpp b/api/logic/minecraft/onesix/OneSixVersionFormat.cpp
index 266bd4bd..1da375ad 100644
--- a/api/logic/minecraft/onesix/OneSixVersionFormat.cpp
+++ b/api/logic/minecraft/onesix/OneSixVersionFormat.cpp
@@ -142,6 +142,32 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
readLibs("+libraries");
}
+ // if we have mainJar, just use it
+ if(root.contains("mainJar"))
+ {
+ QJsonObject libObj = requireObject(root, "mainJar");
+ out->mainJar = libraryFromJson(libObj, filename);
+ }
+ // else reconstruct it from downloads and id ... if that's available
+ else if(!out->minecraftVersion.isEmpty())
+ {
+ auto lib = std::make_shared<Library>();
+ lib->setRawName(GradleSpecifier(QString("com.mojang:minecraft:%1:client").arg(out->minecraftVersion)));
+ // we have a reliable client download, use it.
+ if(out->mojangDownloads.contains("client"))
+ {
+ auto LibDLInfo = std::make_shared<MojangLibraryDownloadInfo>();
+ LibDLInfo->artifact = out->mojangDownloads["client"];
+ lib->setMojangDownloadInfo(LibDLInfo);
+ }
+ // we got nothing... guess based on ancient hardcoded Mojang behaviour
+ // FIXME: this will eventually break...
+ else
+ {
+ lib->setAbsoluteUrl(URLConstants::getLegacyJarUrl(out->minecraftVersion));
+ }
+ }
+
/* removed features that shouldn't be used */
if (root.contains("tweakers"))
{