Skip to content

Commit

Permalink
Move Custom Display Title to Helper
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Dec 9, 2024
1 parent 90d474a commit 94dd0fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/nomiceu/nomilabs/util/LabsDisplayHelper.java
Original file line number Diff line number Diff line change
@@ -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());
}
}

0 comments on commit 94dd0fd

Please sign in to comment.