mirror of
https://github.com/UltimMC/Launcher.git
synced 2026-01-01 21:18:15 +00:00
Resolved merge conflict
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "minecraft/launch/ReconstructAssets.h"
|
||||
#include "minecraft/launch/ScanModFolders.h"
|
||||
#include "minecraft/launch/InjectAuthlib.h"
|
||||
#include "minecraft/launch/VerifyJavaInstall.h"
|
||||
#include "java/launch/CheckJava.h"
|
||||
#include "java/JavaUtils.h"
|
||||
#include "meta/Index.h"
|
||||
@@ -751,7 +752,7 @@ MessageLevel::Enum MinecraftInstance::guessLevel(const QString &line, MessageLev
|
||||
|| line.contains(QRegularExpression("Caused by: " + javaSymbol))
|
||||
|| line.contains(QRegularExpression("([a-zA-Z_$][a-zA-Z\\d_$]*\\.)+[a-zA-Z_$]?[a-zA-Z\\d_$]*(Exception|Error|Throwable)"))
|
||||
|| line.contains(QRegularExpression("... \\d+ more$"))
|
||||
)
|
||||
)
|
||||
return MessageLevel::Error;
|
||||
return level;
|
||||
}
|
||||
@@ -923,6 +924,11 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
|
||||
process->appendStep(new ReconstructAssets(pptr));
|
||||
}
|
||||
|
||||
// verify that minimum Java requirements are met
|
||||
{
|
||||
process->appendStep(new VerifyJavaInstall(pptr));
|
||||
}
|
||||
|
||||
// authlib patch
|
||||
if (session->m_accountPtr->provider()->injectorEndpoint() != "")
|
||||
{
|
||||
|
||||
@@ -65,4 +65,7 @@ VersionFilterData::VersionFilterData()
|
||||
QSet<QString>{"net.java.jinput:jinput", "net.java.jinput:jinput-platform",
|
||||
"net.java.jutils:jutils", "org.lwjgl.lwjgl:lwjgl",
|
||||
"org.lwjgl.lwjgl:lwjgl_util", "org.lwjgl.lwjgl:lwjgl-platform"};
|
||||
|
||||
java8BeginsDate = timeFromS3Time("2017-03-30T09:32:19+00:00");
|
||||
java16BeginsDate = timeFromS3Time("2021-05-12T11:19:15+00:00");
|
||||
}
|
||||
|
||||
@@ -23,5 +23,9 @@ struct VersionFilterData
|
||||
QDateTime legacyCutoffDate;
|
||||
// Libraries that belong to LWJGL
|
||||
QSet<QString> lwjglWhitelist;
|
||||
// release date of first version to require Java 8 (17w13a)
|
||||
QDateTime java8BeginsDate;
|
||||
// release data of first version to require Java 16 (21w19a)
|
||||
QDateTime java16BeginsDate;
|
||||
};
|
||||
extern VersionFilterData MULTIMC_LOGIC_EXPORT g_VersionFilterData;
|
||||
|
||||
34
api/logic/minecraft/launch/VerifyJavaInstall.cpp
Normal file
34
api/logic/minecraft/launch/VerifyJavaInstall.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "VerifyJavaInstall.h"
|
||||
|
||||
#include <launch/LaunchTask.h>
|
||||
#include <minecraft/MinecraftInstance.h>
|
||||
#include <minecraft/PackProfile.h>
|
||||
#include <minecraft/VersionFilterData.h>
|
||||
|
||||
void VerifyJavaInstall::executeTask() {
|
||||
auto m_inst = std::dynamic_pointer_cast<MinecraftInstance>(m_parent->instance());
|
||||
|
||||
auto javaVersion = m_inst->getJavaVersion();
|
||||
auto minecraftComponent = m_inst->getPackProfile()->getComponent("net.minecraft");
|
||||
|
||||
// Java 16 requirement
|
||||
if (minecraftComponent->getReleaseDateTime() >= g_VersionFilterData.java16BeginsDate) {
|
||||
if (javaVersion.major() < 16) {
|
||||
emit logLine("Minecraft 21w19a and above require the use of Java 16",
|
||||
MessageLevel::Fatal);
|
||||
emitFailed(tr("Minecraft 21w19a and above require the use of Java 16"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Java 8 requirement
|
||||
else if (minecraftComponent->getReleaseDateTime() >= g_VersionFilterData.java8BeginsDate) {
|
||||
if (javaVersion.major() < 8) {
|
||||
emit logLine("Minecraft 17w13a and above require the use of Java 8",
|
||||
MessageLevel::Fatal);
|
||||
emitFailed(tr("Minecraft 17w13a and above require the use of Java 8"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
emitSucceeded();
|
||||
}
|
||||
17
api/logic/minecraft/launch/VerifyJavaInstall.h
Normal file
17
api/logic/minecraft/launch/VerifyJavaInstall.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <launch/LaunchStep.h>
|
||||
|
||||
class VerifyJavaInstall : public LaunchStep {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VerifyJavaInstall(LaunchTask *parent) : LaunchStep(parent) {
|
||||
};
|
||||
~VerifyJavaInstall() override = default;
|
||||
|
||||
void executeTask() override;
|
||||
bool canAbort() const override {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user