Skip to content

Commit 5a34a39

Browse files
committed
add WindowTitleRenamer
1 parent 4570ce5 commit 5a34a39

2 files changed

Lines changed: 48 additions & 1 deletion

File tree

src/main/java/com/nerds/addon/NerdAddon.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.nerds.addon.commands.CommandExample;
44
import com.nerds.addon.hud.HudExample;
55
import com.nerds.addon.modules.JoinLeaveNotify;
6+
import com.nerds.addon.modules.WindowTitleRenamer;
67
import com.mojang.logging.LogUtils;
78
import meteordevelopment.meteorclient.addons.GithubRepo;
89
import meteordevelopment.meteorclient.addons.MeteorAddon;
@@ -22,8 +23,10 @@ public class NerdAddon extends MeteorAddon {
2223
public void onInitialize() {
2324
LOG.info("Initializing Nerd Addon");
2425

25-
// Modules
26+
2627
Modules.get().add(new JoinLeaveNotify());
28+
Modules.get().add(new WindowTitleRenamer());
29+
2730

2831
// Commands
2932
Commands.add(new CommandExample());
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.nerds.addon.modules;
2+
3+
import com.nerds.addon.NerdAddon;
4+
import meteordevelopment.meteorclient.events.world.TickEvent;
5+
import meteordevelopment.meteorclient.settings.Setting;
6+
import meteordevelopment.meteorclient.settings.SettingGroup;
7+
import meteordevelopment.meteorclient.settings.StringSetting;
8+
import meteordevelopment.meteorclient.systems.modules.Module;
9+
import meteordevelopment.orbit.EventHandler;
10+
import org.lwjgl.glfw.GLFW;
11+
12+
public class WindowTitleRenamer extends Module {
13+
private final SettingGroup sgGeneral = settings.getDefaultGroup();
14+
15+
private final Setting<String> title = sgGeneral.add(new StringSetting.Builder()
16+
.name("title")
17+
.description("The custom window title to display.")
18+
.defaultValue("Nerd Addon")
19+
.build()
20+
);
21+
22+
public WindowTitleRenamer() {
23+
super(NerdAddon.CATEGORY, "window-title-renamer", "Lets you set a custom window title.");
24+
}
25+
26+
@Override
27+
public void onActivate() {
28+
applyTitle();
29+
}
30+
31+
@Override
32+
public void onDeactivate() {
33+
GLFW.glfwSetWindowTitle(mc.getWindow().getHandle(), "Minecraft");
34+
}
35+
36+
@EventHandler
37+
private void onTick(TickEvent.Post event) {
38+
applyTitle();
39+
}
40+
41+
private void applyTitle() {
42+
GLFW.glfwSetWindowTitle(mc.getWindow().getHandle(), title.get());
43+
}
44+
}

0 commit comments

Comments
 (0)