Skip to content
Permalink
Browse files

HACK add option to launch without a main jar

  • Loading branch information...
peterix committed Feb 22, 2019
1 parent a9c005b commit 00520b4dacf12bf0149fd4efbc964c28b4115e16
@@ -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 @@ class LaunchProfile: public ProblemProvider
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 @@ class VersionFile : public ProblemContainer

/// 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;

0 comments on commit 00520b4

Please sign in to comment.
You can’t perform that action at this time.