summaryrefslogtreecommitdiffstats
path: root/logic/minecraft/MinecraftInstance.h
blob: b5483d1b045783610fbb6d144fd5df57a03c869f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once
#include "BaseInstance.h"
#include "minecraft/Mod.h"
#include <QProcess>

#include "multimc_logic_export.h"

class ModList;
class WorldList;

class MULTIMC_LOGIC_EXPORT MinecraftInstance: public BaseInstance
{
public:
	MinecraftInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr settings, const QString &rootDir);
	virtual ~MinecraftInstance() {};

	/// Path to the instance's minecraft directory.
	QString minecraftRoot() const;

	//////  Mod Lists  //////
	virtual std::shared_ptr<ModList> resourcePackList() const
	{
		return nullptr;
	}
	virtual std::shared_ptr<ModList> texturePackList() const
	{
		return nullptr;
	}
	virtual std::shared_ptr<WorldList> worldList() const
	{
		return nullptr;
	}
	/// get all jar mods applicable to this instance's jar
	virtual QList<Mod> getJarMods() const
	{
		return QList<Mod>();
	}

	//FIXME: nuke?
	virtual std::shared_ptr< BaseVersionList > versionList() const;

	/// 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;

	/// guess log level from a line of minecraft log
	virtual MessageLevel::Enum guessLevel(const QString &line, MessageLevel::Enum level);

	virtual IPathMatcher::Ptr getLogFileMatcher() override;

	virtual QString getLogFileRoot() override;

	virtual QString getStatusbarDescription() override;

protected:
	QMap<QString, QString> createCensorFilterFromSession(AuthSessionPtr session);
private:
	QString prettifyTimeDuration(int64_t duration);
};

typedef std::shared_ptr<MinecraftInstance> MinecraftInstancePtr;