Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Sebastian-byte
2021-03-20 16:30:39 -05:00
11 changed files with 149 additions and 87 deletions

View File

@@ -226,8 +226,8 @@ set(MINECRAFT_SOURCES
minecraft/launch/ClaimAccount.cpp
minecraft/launch/ClaimAccount.h
minecraft/launch/CreateServerResourcePacksFolder.cpp
minecraft/launch/CreateServerResourcePacksFolder.h
minecraft/launch/CreateGameFolders.cpp
minecraft/launch/CreateGameFolders.h
minecraft/launch/ModMinecraftJar.cpp
minecraft/launch/ModMinecraftJar.h
minecraft/launch/DirectJavaLaunch.cpp

View File

@@ -1,5 +1,5 @@
#include "MinecraftInstance.h"
#include <minecraft/launch/CreateServerResourcePacksFolder.h>
#include <minecraft/launch/CreateGameFolders.h>
#include <minecraft/launch/ExtractNatives.h>
#include <minecraft/launch/PrintInstanceInfo.h>
#include <settings/Setting.h>
@@ -38,6 +38,7 @@
#include "MinecraftUpdate.h"
#include "MinecraftLoadAndCheck.h"
#include <minecraft/gameoptions/GameOptions.h>
#include <minecraft/update/FoldersTask.h>
#define IBUS "@im=ibus"
@@ -810,6 +811,11 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
return process;
}
// create the .minecraft folder and server-resource-packs (workaround for Minecraft bug MCL-3732)
{
process->appendStep(new CreateGameFolders(pptr));
}
// run pre-launch command if that's needed
if(getPreLaunchCommand().size())
{
@@ -835,7 +841,7 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
process->appendStep(new ModMinecraftJar(pptr));
}
// if there are any jar mods
// Scan mods folders for mods
{
process->appendStep(new ScanModFolders(pptr));
}
@@ -845,11 +851,6 @@ shared_qobject_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPt
process->appendStep(new PrintInstanceInfo(pptr, session));
}
// create the server-resource-packs folder (workaround for Minecraft bug MCL-3732)
{
process->appendStep(new CreateServerResourcePacksFolder(pptr));
}
// extract native jars if needed
{
process->appendStep(new ExtractNatives(pptr));

View File

@@ -0,0 +1,28 @@
#include "CreateGameFolders.h"
#include "minecraft/MinecraftInstance.h"
#include "launch/LaunchTask.h"
#include "FileSystem.h"
CreateGameFolders::CreateGameFolders(LaunchTask* parent): LaunchStep(parent)
{
}
void CreateGameFolders::executeTask()
{
auto instance = m_parent->instance();
std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
if(!FS::ensureFolderPathExists(minecraftInstance->gameRoot()))
{
emit logLine("Couldn't create the main game folder", MessageLevel::Error);
emitFailed("Couldn't create the main game folder");
return;
}
// HACK: this is a workaround for MCL-3732 - 'server-resource-packs' folder is created.
if(!FS::ensureFolderPathExists(FS::PathCombine(minecraftInstance->gameRoot(), "server-resource-packs")))
{
emit logLine("Couldn't create the 'server-resource-packs' folder", MessageLevel::Error);
}
emitSucceeded();
}

View File

@@ -19,13 +19,13 @@
#include <LoggedProcess.h>
#include <minecraft/auth/AuthSession.h>
// HACK: this is a workaround for MCL-3732 - 'server-resource-packs' folder is created.
class CreateServerResourcePacksFolder: public LaunchStep
// Create the main .minecraft for the instance and any other necessary folders
class CreateGameFolders: public LaunchStep
{
Q_OBJECT
public:
explicit CreateServerResourcePacksFolder(LaunchTask *parent);
virtual ~CreateServerResourcePacksFolder() {};
explicit CreateGameFolders(LaunchTask *parent);
virtual ~CreateGameFolders() {};
virtual void executeTask();
virtual bool canAbort() const

View File

@@ -1,19 +0,0 @@
#include "CreateServerResourcePacksFolder.h"
#include "minecraft/MinecraftInstance.h"
#include "launch/LaunchTask.h"
#include "FileSystem.h"
CreateServerResourcePacksFolder::CreateServerResourcePacksFolder(LaunchTask* parent): LaunchStep(parent)
{
}
void CreateServerResourcePacksFolder::executeTask()
{
auto instance = m_parent->instance();
std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance);
if(!FS::ensureFolderPathExists(FS::PathCombine(minecraftInstance->gameRoot(), "server-resource-packs")))
{
emit logLine(tr("Couldn't create the 'server-resource-packs' folder"), MessageLevel::Error);
}
emitSucceeded();
}

View File

@@ -27,11 +27,16 @@ void ScanModFolders::executeTask()
auto loaders = m_inst->loaderModList();
connect(loaders.get(), &ModFolderModel::updateFinished, this, &ScanModFolders::modsDone);
loaders->update();
if(!loaders->update()) {
m_modsDone = true;
}
auto cores = m_inst->coreModList();
connect(cores.get(), &ModFolderModel::updateFinished, this, &ScanModFolders::coreModsDone);
cores->update();
if(!cores->update()) {
m_coreModsDone = true;
}
checkDone();
}
void ScanModFolders::modsDone()