2015-01-28 03:01:07 +05:30
|
|
|
#pragma once
|
2015-02-09 06:21:14 +05:30
|
|
|
#include "BaseInstance.h"
|
2016-06-16 05:50:23 +05:30
|
|
|
#include <java/JavaVersion.h>
|
2015-02-09 06:21:14 +05:30
|
|
|
#include "minecraft/Mod.h"
|
2015-07-21 06:08:15 +05:30
|
|
|
#include <QProcess>
|
2015-02-05 01:40:10 +05:30
|
|
|
|
2015-09-05 22:16:57 +05:30
|
|
|
#include "multimc_logic_export.h"
|
|
|
|
|
2015-02-05 01:40:10 +05:30
|
|
|
class ModList;
|
2015-08-19 04:40:17 +05:30
|
|
|
class WorldList;
|
2016-06-16 05:50:23 +05:30
|
|
|
class LaunchStep;
|
2015-01-28 03:01:07 +05:30
|
|
|
|
2015-09-05 22:16:57 +05:30
|
|
|
class MULTIMC_LOGIC_EXPORT MinecraftInstance: public BaseInstance
|
2015-01-28 03:01:07 +05:30
|
|
|
{
|
|
|
|
public:
|
2015-02-01 07:38:25 +05:30
|
|
|
MinecraftInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString &rootDir);
|
2015-01-28 03:01:07 +05:30
|
|
|
virtual ~MinecraftInstance() {};
|
|
|
|
|
|
|
|
/// Path to the instance's minecraft directory.
|
|
|
|
QString minecraftRoot() const;
|
|
|
|
|
2017-01-11 03:33:00 +05:30
|
|
|
/// Path to the instance's minecraft/bin directory.
|
|
|
|
QString binRoot() const;
|
|
|
|
|
2015-01-28 03:01:07 +05:30
|
|
|
////// Mod Lists //////
|
|
|
|
virtual std::shared_ptr<ModList> resourcePackList() const
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
virtual std::shared_ptr<ModList> texturePackList() const
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-08-19 04:40:17 +05:30
|
|
|
virtual std::shared_ptr<WorldList> worldList() const
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
2015-01-28 03:01:07 +05:30
|
|
|
/// get all jar mods applicable to this instance's jar
|
|
|
|
virtual QList<Mod> getJarMods() const
|
|
|
|
{
|
|
|
|
return QList<Mod>();
|
|
|
|
}
|
2015-07-21 06:08:15 +05:30
|
|
|
|
2016-06-16 05:50:23 +05:30
|
|
|
virtual std::shared_ptr<LaunchTask> createLaunchTask(AuthSessionPtr account) override;
|
2016-02-29 00:03:05 +05:30
|
|
|
virtual QString createLaunchScript(AuthSessionPtr session) = 0;
|
|
|
|
|
2015-07-21 06:08:15 +05:30
|
|
|
//FIXME: nuke?
|
2015-09-26 07:34:09 +05:30
|
|
|
virtual std::shared_ptr<BaseVersionList> versionList() const override;
|
2015-07-21 06:08:15 +05:30
|
|
|
|
|
|
|
/// get arguments passed to java
|
|
|
|
QStringList javaArguments() const;
|
|
|
|
|
|
|
|
/// get variables for launch command variable substitution/environment
|
|
|
|
virtual QMap<QString, QString> getVariables() const override;
|
|
|
|
|
|
|
|
/// create an environment for launching processes
|
|
|
|
virtual QProcessEnvironment createEnvironment() override;
|
2015-07-22 12:31:04 +05:30
|
|
|
|
|
|
|
/// guess log level from a line of minecraft log
|
2015-09-26 07:34:09 +05:30
|
|
|
virtual MessageLevel::Enum guessLevel(const QString &line, MessageLevel::Enum level) override;
|
2015-08-16 05:47:50 +05:30
|
|
|
|
2015-08-18 05:55:24 +05:30
|
|
|
virtual IPathMatcher::Ptr getLogFileMatcher() override;
|
|
|
|
|
2015-08-19 05:34:56 +05:30
|
|
|
virtual QString getLogFileRoot() override;
|
|
|
|
|
2015-09-22 04:36:45 +05:30
|
|
|
virtual QString getStatusbarDescription() override;
|
|
|
|
|
2016-06-16 05:50:23 +05:30
|
|
|
virtual QStringList getClassPath() const = 0;
|
|
|
|
virtual QStringList getNativeJars() const = 0;
|
|
|
|
|
|
|
|
virtual QString getMainClass() const = 0;
|
|
|
|
|
|
|
|
virtual QString getNativePath() const = 0;
|
|
|
|
|
2016-10-02 03:56:10 +05:30
|
|
|
virtual QString getLocalLibraryPath() const = 0;
|
|
|
|
|
2016-06-16 05:50:23 +05:30
|
|
|
virtual QStringList processMinecraftArgs(AuthSessionPtr account) const = 0;
|
|
|
|
|
|
|
|
virtual JavaVersion getJavaVersion() const;
|
|
|
|
|
2015-08-16 05:47:50 +05:30
|
|
|
protected:
|
|
|
|
QMap<QString, QString> createCensorFilterFromSession(AuthSessionPtr session);
|
2016-06-16 05:50:23 +05:30
|
|
|
virtual QStringList validLaunchMethods() = 0;
|
|
|
|
virtual QString launchMethod();
|
|
|
|
virtual std::shared_ptr<LaunchStep> createMainLaunchStep(LaunchTask *parent, AuthSessionPtr session) = 0;
|
2015-09-22 04:36:45 +05:30
|
|
|
private:
|
|
|
|
QString prettifyTimeDuration(int64_t duration);
|
2015-01-28 03:01:07 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::shared_ptr<MinecraftInstance> MinecraftInstancePtr;
|