summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
Diffstat (limited to 'logic')
-rw-r--r--logic/minecraft/JarMod.cpp7
-rw-r--r--logic/minecraft/JarMod.h4
-rw-r--r--logic/minecraft/OneSixInstance.cpp18
-rw-r--r--logic/minecraft/OneSixProfileStrategy.cpp1
-rw-r--r--logic/minecraft/VersionFile.cpp8
5 files changed, 32 insertions, 6 deletions
diff --git a/logic/minecraft/JarMod.cpp b/logic/minecraft/JarMod.cpp
index c7ba58f1..bf711c1f 100644
--- a/logic/minecraft/JarMod.cpp
+++ b/logic/minecraft/JarMod.cpp
@@ -2,7 +2,7 @@
#include "MMCJson.h"
using namespace MMCJson;
-JarmodPtr Jarmod::fromJson(const QJsonObject &libObj, const QString &filename)
+JarmodPtr Jarmod::fromJson(const QJsonObject &libObj, const QString &filename, const QString &originalName)
{
JarmodPtr out(new Jarmod());
if (!libObj.contains("name"))
@@ -11,6 +11,7 @@ JarmodPtr Jarmod::fromJson(const QJsonObject &libObj, const QString &filename)
"contains a jarmod that doesn't have a 'name' field");
}
out->name = libObj.value("name").toString();
+ out->originalName = libObj.value("originalName").toString();
return out;
}
@@ -18,5 +19,9 @@ QJsonObject Jarmod::toJson()
{
QJsonObject out;
writeString(out, "name", name);
+ if(!originalName.isEmpty())
+ {
+ writeString(out, "originalName", originalName);
+ }
return out;
}
diff --git a/logic/minecraft/JarMod.h b/logic/minecraft/JarMod.h
index 7d9fa038..461308f0 100644
--- a/logic/minecraft/JarMod.h
+++ b/logic/minecraft/JarMod.h
@@ -7,8 +7,10 @@ typedef std::shared_ptr<Jarmod> JarmodPtr;
class Jarmod
{
public: /* methods */
- static JarmodPtr fromJson(const QJsonObject &libObj, const QString &filename);
+ static JarmodPtr fromJson(const QJsonObject &libObj, const QString &filename,
+ const QString &originalName);
QJsonObject toJson();
public: /* data */
QString name;
+ QString originalName;
};
diff --git a/logic/minecraft/OneSixInstance.cpp b/logic/minecraft/OneSixInstance.cpp
index 74c28a8f..ffccc259 100644
--- a/logic/minecraft/OneSixInstance.cpp
+++ b/logic/minecraft/OneSixInstance.cpp
@@ -136,17 +136,29 @@ BaseProcess *OneSixInstance::prepareForLaunch(AuthSessionPtr session)
for(auto & mod: loaderModList()->allMods())
{
- launchScript += "mod " + mod.filename().absoluteFilePath() + "\n";;
+ if(!mod.enabled())
+ continue;
+ if(mod.type() == Mod::MOD_FOLDER)
+ continue;
+ // TODO: proper implementation would need to descend into folders.
+
+ launchScript += "mod " + mod.filename().completeBaseName() + "\n";;
}
for(auto & coremod: coreModList()->allMods())
{
- launchScript += "coremod " + coremod.filename().absoluteFilePath() + "\n";;
+ if(!coremod.enabled())
+ continue;
+ if(coremod.type() == Mod::MOD_FOLDER)
+ continue;
+ // TODO: proper implementation would need to descend into folders.
+
+ launchScript += "coremod " + coremod.filename().completeBaseName() + "\n";;
}
for(auto & jarmod: m_version->jarMods)
{
- launchScript += "jarmod " + jarmod->name + "\n";;
+ launchScript += "jarmod " + jarmod->originalName + " (" + jarmod->name + ")\n";
}
// libraries and class path.
diff --git a/logic/minecraft/OneSixProfileStrategy.cpp b/logic/minecraft/OneSixProfileStrategy.cpp
index e0ee4c21..173cd4d6 100644
--- a/logic/minecraft/OneSixProfileStrategy.cpp
+++ b/logic/minecraft/OneSixProfileStrategy.cpp
@@ -368,6 +368,7 @@ bool OneSixProfileStrategy::installJarMods(QStringList filepaths)
auto f = std::make_shared<VersionFile>();
auto jarMod = std::make_shared<Jarmod>();
jarMod->name = target_filename;
+ jarMod->originalName = sourceInfo.completeBaseName();
f->jarMods.append(jarMod);
f->name = target_name;
f->fileId = target_id;
diff --git a/logic/minecraft/VersionFile.cpp b/logic/minecraft/VersionFile.cpp
index 6ef5a8bc..227ba8be 100644
--- a/logic/minecraft/VersionFile.cpp
+++ b/logic/minecraft/VersionFile.cpp
@@ -155,7 +155,13 @@ VersionFilePtr VersionFile::fromJson(const QJsonDocument &doc, const QString &fi
{
QJsonObject libObj = ensureObject(libVal);
// parse the jarmod
- auto lib = Jarmod::fromJson(libObj, filename);
+ auto lib = Jarmod::fromJson(libObj, filename, out->name);
+ if(lib->originalName.isEmpty())
+ {
+ auto fixed = out->name;
+ fixed.remove(" (jar mod)");
+ lib->originalName = out->name;
+ }
// and add to jar mods
out->jarMods.append(lib);
}