Automatically add add-opens if Java version >= 9

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2022-12-15 15:28:17 +00:00
parent 8a6776731a
commit 87bcefd08a
4 changed files with 13 additions and 12 deletions

View File

@ -50,11 +50,11 @@ QString JavaVersion::toString()
bool JavaVersion::requiresPermGen()
{
if(m_parseable)
{
return m_major < 8;
}
return true;
return !m_parseable || m_major < 8;
}
bool JavaVersion::isModular() {
return m_parseable && m_major >= 9;
}
bool JavaVersion::operator<(const JavaVersion &rhs)

View File

@ -25,6 +25,8 @@ public:
bool requiresPermGen();
bool isModular();
QString toString();
int major()

View File

@ -440,15 +440,15 @@ QStringList MinecraftInstance::javaArguments()
args << "-Duser.language=en";
if (javaVersion.isModular() && traits().contains("legacySkins") && settings()->get("LegacySkinFix").toBool())
args << "--add-opens" << "java.base/java.net=ALL-UNNAMED";
return args;
}
QString MinecraftInstance::getLauncher()
{
auto profile = m_components->getProfile();
QString MinecraftInstance::getLauncher() {
// use legacy launcher if the traits are set
if (profile->getTraits().contains("legacyLaunch") || profile->getTraits().contains("alphaLaunch"))
if (traits().contains("legacyLaunch") || traits().contains("alphaLaunch"))
return "legacy";
return "standard";

View File

@ -62,8 +62,7 @@ public final class SkinFix implements Fix, URLStreamHandlerFactory {
public boolean isApplicable(Parameters params) {
if (!UrlUtils.isSupported() || !Base64.isSupported()) {
Log.warning("Cannot access the necessary Java internals for skin fix");
Log.warning("Try adding '--add-opens java.base/java.net=ALL-UNNAMED' to your Java arguments");
Log.warning("Alternatively, turning off legacy skin fix in Settings > Miscellaneous will silence the warnings");
Log.warning("Turning off legacy skin fix in Settings > Miscellaneous will silence the warnings");
return false;
}