fix: enable demo launch only on supported instances
e.g. >= 1.3.1 instances Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
@ -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/"));
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user