UltimMC: Add our changes

This commit is contained in:
Neptune
2024-03-03 11:42:23 -05:00
parent 2c9e7b75f4
commit 0d01261956
45 changed files with 2191 additions and 445 deletions

View File

@@ -27,7 +27,9 @@
#include "minecraft/launch/ClaimAccount.h"
#include "minecraft/launch/ReconstructAssets.h"
#include "minecraft/launch/ScanModFolders.h"
#include "minecraft/launch/InjectAuthlib.h"
#include "minecraft/launch/VerifyJavaInstall.h"
#include "minecraft/auth/AccountList.h"
#include "java/JavaUtils.h"
@@ -314,6 +316,10 @@ QStringList MinecraftInstance::javaArguments() const
{
QStringList args;
if (m_injector) {
args.append(m_injector->javaArg);
}
// custom args go first. we want to override them if we have our own here.
args.append(extraArguments());
@@ -847,7 +853,7 @@ Task::Ptr MinecraftInstance::createUpdateTask(Net::Mode mode)
return nullptr;
}
shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPtr session, QuickPlayTargetPtr quickPlayTarget)
shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPtr session, QuickPlayTargetPtr quickPlayTarget, quint16 localAuthServerPort)
{
// FIXME: get rid of shared_from_this ...
auto process = LaunchTask::create(std::dynamic_pointer_cast<MinecraftInstance>(shared_from_this()));
@@ -911,11 +917,14 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
}
// if we aren't in offline mode,.
if(session->status != AuthSession::PlayableOffline)
/*if(session->status != AuthSession::PlayableOffline)
{
process->appendStep(new ClaimAccount(pptr, session));
}*/
// do update only if we're in online mode
if (session->wants_online)
{
if(!session->demo) {
process->appendStep(new ClaimAccount(pptr, session));
}
process->appendStep(new Update(pptr, Net::Mode::Online));
}
else
@@ -953,6 +962,18 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
process->appendStep(new VerifyJavaInstall(pptr));
}
auto accounts = APPLICATION->accounts();
auto m_acct = accounts->getAccountByProfileName(session->player_name);
// authlib patch
if (m_acct->provider()->injectorEndpoint() != "")
{
auto step = new InjectAuthlib(pptr, &m_injector);
step->setAuthServer(m_acct->provider()->injectorEndpoint().arg(localAuthServerPort));
step->setOfflineMode(!session->wants_online);
process->appendStep(step);
}
{
// actually launch the game
auto method = launchMethod();