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