From 94dd0fd04333a32492a52fd7f649afb8bff36e29 Mon Sep 17 00:00:00 2001 From: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:37:14 +1100 Subject: [PATCH] Move Custom Display Title to Helper --- .../nomilabs/mixin/vanilla/MinecraftMixin.java | 7 ++----- .../nomiceu/nomilabs/util/LabsDisplayHelper.java | 13 +++++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/nomiceu/nomilabs/util/LabsDisplayHelper.java diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/vanilla/MinecraftMixin.java b/src/main/java/com/nomiceu/nomilabs/mixin/vanilla/MinecraftMixin.java index eb4eb2bd..da27d4cd 100644 --- a/src/main/java/com/nomiceu/nomilabs/mixin/vanilla/MinecraftMixin.java +++ b/src/main/java/com/nomiceu/nomilabs/mixin/vanilla/MinecraftMixin.java @@ -24,10 +24,9 @@ import com.nomiceu.nomilabs.NomiLabs; import com.nomiceu.nomilabs.config.LabsConfig; -import com.nomiceu.nomilabs.config.LabsVersionConfig; import com.nomiceu.nomilabs.event.LabsResourcesRefreshedEvent; import com.nomiceu.nomilabs.mixinhelper.ResourcesObserver; -import com.nomiceu.nomilabs.util.LabsModeHelper; +import com.nomiceu.nomilabs.util.LabsDisplayHelper; /** * Allows Setting of Window Title and Icon. Also calls an event on Resources Reload. @@ -48,9 +47,7 @@ private void callResourcesRefreshedEvent(CallbackInfo ci) { require = 1) private void setCustomTitle(String title) { if (LabsConfig.advanced.windowOverrides.windowTitleOverride.isEmpty()) Display.setTitle(title); - else Display.setTitle(LabsConfig.advanced.windowOverrides.windowTitleOverride - .replace("{version}", LabsVersionConfig.formattedVersion) - .replace("{mode}", LabsModeHelper.getFormattedMode())); + else Display.setTitle(LabsDisplayHelper.getWindowTitle()); } @Inject(method = "setWindowIcon", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/com/nomiceu/nomilabs/util/LabsDisplayHelper.java b/src/main/java/com/nomiceu/nomilabs/util/LabsDisplayHelper.java new file mode 100644 index 00000000..b39d65f9 --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/util/LabsDisplayHelper.java @@ -0,0 +1,13 @@ +package com.nomiceu.nomilabs.util; + +import com.nomiceu.nomilabs.config.LabsConfig; +import com.nomiceu.nomilabs.config.LabsVersionConfig; + +public class LabsDisplayHelper { + + public static String getWindowTitle() { + return LabsConfig.advanced.windowOverrides.windowTitleOverride + .replace("{version}", LabsVersionConfig.formattedVersion) + .replace("{mode}", LabsModeHelper.getFormattedMode()); + } +}