mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2025-01-28 18:32:48 +00:00
NOISSUE add an interface to pass information to CraftPresence
Specifically, the icon key and instance title.
This commit is contained in:
parent
d98022d3ae
commit
c1ed09e747
@ -313,6 +313,11 @@ QString BaseInstance::windowTitle() const
|
||||
return BuildConfig.LAUNCHER_NAME + ": " + name().replace(QRegExp("[ \n\r\t]+"), " ");
|
||||
}
|
||||
|
||||
QString BaseInstance::instanceTitle() const
|
||||
{
|
||||
return name().replace(QRegExp("[ \n\r\t]+"), " ");
|
||||
}
|
||||
|
||||
// FIXME: why is this here? move it to MinecraftInstance!!!
|
||||
QStringList BaseInstance::extraArguments() const
|
||||
{
|
||||
|
@ -110,6 +110,8 @@ public:
|
||||
/// Value used for instance window titles
|
||||
QString windowTitle() const;
|
||||
|
||||
QString instanceTitle() const;
|
||||
|
||||
QString iconKey() const;
|
||||
void setIconKey(QString val);
|
||||
|
||||
|
@ -513,6 +513,8 @@ QString MinecraftInstance::createLaunchScript(AuthSessionPtr session, MinecraftS
|
||||
.arg(settings()->get("MinecraftWinHeight").toInt());
|
||||
launchScript += "windowTitle " + windowTitle() + "\n";
|
||||
launchScript += "windowParams " + windowParams + "\n";
|
||||
launchScript += "instanceTitle " + instanceTitle() + "\n";
|
||||
launchScript += "instanceIconId " + iconKey() + "\n";
|
||||
}
|
||||
|
||||
// legacy auth
|
||||
|
@ -192,7 +192,6 @@ void readIndex(const QString & path, QMap<QString, Language>& languages)
|
||||
return;
|
||||
}
|
||||
|
||||
int index = 1;
|
||||
try
|
||||
{
|
||||
auto toplevel_doc = Json::requireDocument(data);
|
||||
@ -225,7 +224,6 @@ void readIndex(const QString & path, QMap<QString, Language>& languages)
|
||||
lang.file_size = Json::requireInteger(langObj, "size");
|
||||
|
||||
languages.insert(lang.key, lang);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
catch (Json::JsonException & e)
|
||||
|
@ -42,6 +42,9 @@ public class OneSixLauncher implements Launcher
|
||||
private String windowTitle;
|
||||
private String windowParams;
|
||||
|
||||
private String instanceTitle;
|
||||
private String instanceIconId;
|
||||
|
||||
// secondary parameters
|
||||
private int winSizeW;
|
||||
private int winSizeH;
|
||||
@ -68,6 +71,13 @@ public class OneSixLauncher implements Launcher
|
||||
windowTitle = params.firstSafe("windowTitle", "Minecraft");
|
||||
windowParams = params.firstSafe("windowParams", "854x480");
|
||||
|
||||
instanceTitle = params.firstSafe("instanceTitle", "Minecraft");
|
||||
instanceIconId = params.firstSafe("instanceIconId", "default");
|
||||
|
||||
// NOTE: this is included for the CraftPresence mod
|
||||
System.setProperty("multimc.instance.title", instanceTitle);
|
||||
System.setProperty("multimc.instance.icon", instanceIconId);
|
||||
|
||||
serverAddress = params.firstSafe("serverAddress", null);
|
||||
serverPort = params.firstSafe("serverPort", null);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user