aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-09-18 14:41:25 +0200
committerGitHub <noreply@github.com>2022-09-18 14:41:25 +0200
commit098327f12809ac584e9683acf69ed88b3325d050 (patch)
tree56ebc3d98fa9d2de6865095be9149cbf74afb131 /launcher/minecraft
parent8674ac4f68f92757b422f5db89388077ab11a7c6 (diff)
parent81e326571bb31dc4a92f1dbe32cb3ec50ace71f8 (diff)
downloadPrismLauncher-098327f12809ac584e9683acf69ed88b3325d050.tar.gz
PrismLauncher-098327f12809ac584e9683acf69ed88b3325d050.tar.bz2
PrismLauncher-098327f12809ac584e9683acf69ed88b3325d050.zip
Merge pull request #903 from jopejoe1/demo-launch
Diffstat (limited to 'launcher/minecraft')
-rw-r--r--launcher/minecraft/MinecraftInstance.cpp8
-rw-r--r--launcher/minecraft/MinecraftInstance.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp
index 9478b1b8..ab904fa2 100644
--- a/launcher/minecraft/MinecraftInstance.cpp
+++ b/launcher/minecraft/MinecraftInstance.cpp
@@ -245,6 +245,14 @@ QString MinecraftInstance::getLocalLibraryPath() const
return libraries_dir.absolutePath();
}
+bool MinecraftInstance::supportsDemo() const
+{
+ Version instance_ver { getPackProfile()->getComponentVersion("net.minecraft") };
+ // Demo mode was introduced in 1.3.1: https://minecraft.fandom.com/wiki/Demo_mode#History
+ // FIXME: Due to Version constraints atm, this can't handle well non-release versions
+ return instance_ver >= Version("1.3.1");
+}
+
QString MinecraftInstance::jarModsDir() const
{
QDir jarmods_dir(FS::PathCombine(instanceRoot(), "jarmods/"));
diff --git a/launcher/minecraft/MinecraftInstance.h b/launcher/minecraft/MinecraftInstance.h
index d62ac655..fe39674a 100644
--- a/launcher/minecraft/MinecraftInstance.h
+++ b/launcher/minecraft/MinecraftInstance.h
@@ -69,6 +69,8 @@ public:
// where the instance-local libraries should be
QString getLocalLibraryPath() const;
+ /** Returns whether the instance, with its version, has support for demo mode. */
+ [[nodiscard]] bool supportsDemo() const;
////// Profile management //////
std::shared_ptr<PackProfile> getPackProfile() const;