mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-13 20:22:13 +00:00
HACK add option to launch without a main jar
This commit is contained in:
@@ -162,12 +162,20 @@ const LibraryPtr LaunchProfile::getMainJar() const
|
||||
return m_mainJar;
|
||||
}
|
||||
|
||||
void LaunchProfile::applyMainJar(LibraryPtr jar)
|
||||
void LaunchProfile::applyMainJar(LibraryPtr jar, bool removeMainJar)
|
||||
{
|
||||
if(jar)
|
||||
if(removeMainJar)
|
||||
{
|
||||
m_mainJar.reset();
|
||||
}
|
||||
else if(jar)
|
||||
{
|
||||
m_mainJar = jar;
|
||||
}
|
||||
else
|
||||
{
|
||||
// mainJar was not specified, NOOP
|
||||
}
|
||||
}
|
||||
|
||||
void LaunchProfile::applyProblemSeverity(ProblemSeverity severity)
|
||||
|
||||
@@ -20,7 +20,7 @@ public: /* application of profile variables from patches */
|
||||
void applyJarMods(const QList<LibraryPtr> &jarMods);
|
||||
void applyMods(const QList<LibraryPtr> &jarMods);
|
||||
void applyLibrary(LibraryPtr library);
|
||||
void applyMainJar(LibraryPtr jar);
|
||||
void applyMainJar(LibraryPtr jar, bool removeMainJar);
|
||||
void applyProblemSeverity(ProblemSeverity severity);
|
||||
/// clear the profile
|
||||
void clear();
|
||||
|
||||
@@ -187,8 +187,16 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
|
||||
// if we have mainJar, just use it
|
||||
if(root.contains("mainJar"))
|
||||
{
|
||||
QJsonObject libObj = requireObject(root, "mainJar");
|
||||
out->mainJar = libraryFromJson(libObj, filename);
|
||||
auto val = root.value("mainJar");
|
||||
if(val.isNull())
|
||||
{
|
||||
out->removeMainJar = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
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())
|
||||
@@ -276,6 +284,10 @@ QJsonDocument OneSixVersionFormat::versionFileToJson(const VersionFilePtr &patch
|
||||
{
|
||||
root.insert("mainJar", libraryToJson(patch->mainJar.get()));
|
||||
}
|
||||
else if(patch->removeMainJar)
|
||||
{
|
||||
root.insert("mainJar", QJsonValue());
|
||||
}
|
||||
writeString(root, "appletClass", patch->appletClass);
|
||||
writeStringList(root, "+tweakers", patch->addTweakers);
|
||||
writeStringList(root, "+traits", patch->traits.toList());
|
||||
|
||||
@@ -28,7 +28,7 @@ void VersionFile::applyTo(LaunchProfile *profile)
|
||||
profile->applyMinecraftAssets(mojangAssetIndex);
|
||||
}
|
||||
|
||||
profile->applyMainJar(mainJar);
|
||||
profile->applyMainJar(mainJar, removeMainJar);
|
||||
profile->applyMainClass(mainClass);
|
||||
profile->applyAppletClass(appletClass);
|
||||
profile->applyMinecraftArguments(minecraftArguments);
|
||||
|
||||
@@ -77,6 +77,7 @@ public: /* data */
|
||||
|
||||
/// The main jar (Minecraft version library, normally)
|
||||
LibraryPtr mainJar;
|
||||
bool removeMainJar = false;
|
||||
|
||||
/// MultiMC: list of attached traits of this version file - used to enable features
|
||||
QSet<QString> traits;
|
||||
|
||||
@@ -45,7 +45,11 @@ void LibrariesTask::executeTask()
|
||||
QList<LibraryPtr> libArtifactPool;
|
||||
libArtifactPool.append(profile->getLibraries());
|
||||
libArtifactPool.append(profile->getNativeLibraries());
|
||||
libArtifactPool.append(profile->getMainJar());
|
||||
auto mainJar = profile->getMainJar();
|
||||
if(mainJar)
|
||||
{
|
||||
libArtifactPool.append(mainJar);
|
||||
}
|
||||
processArtifactPool(libArtifactPool, failedLocalLibraries, inst->getLocalLibraryPath());
|
||||
|
||||
QStringList failedLocalJarMods;
|
||||
|
||||
Reference in New Issue
Block a user