Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 026a45a

Browse files
committed
Modify how version and modules are implemented, optimized some stuff.
1 parent 2c443da commit 026a45a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+491
-400
lines changed

src/main/java/net/minecraft/client/gui/GuiMainMenu.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks)
548548
GlStateManager.scale(f, f, f);
549549
this.drawCenteredString(this.fontRendererObj, this.splashText, 0, -8, -256);
550550
GlStateManager.popMatrix();
551-
String s = String.format("%s %s | %s | %s", Main.instance.smartClientAPI.versionInfo.name, Main.instance.smartClientAPI.versionInfo.build, Main.instance.smartClientAPI.versionInfo.version, Main.instance.smartClientAPI.versionInfo.commit);
551+
String s = String.format("%s %s | %s | %s", Main.instance.getName(), Main.instance.getBuild(), Main.instance.getVersion(), Main.instance.getCommit());
552552
this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1);
553553
String s1 = "Copyright sssssss.dev (C) 2021-2022";
554554
this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1);

src/main/java/net/sssssssthedev/SmartClient/Main.java

+12-6
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55

66
import de.enzaxd.viaforge.ViaForge;
77
import net.minecraft.util.Session;
8-
import net.sssssssthedev.SmartClient.api.SmartClientAPI;
8+
import net.sssssssthedev.SmartClient.annotations.version.IVersion;
9+
import net.sssssssthedev.SmartClient.annotations.version.VersionInfo;
910
import net.sssssssthedev.SmartClient.clickgui.ClickGUI;
1011
import net.sssssssthedev.SmartClient.command.CommandManager;
1112
import net.sssssssthedev.SmartClient.event.EventManager;
1213
import net.sssssssthedev.SmartClient.event.EventTarget;
1314
import net.sssssssthedev.SmartClient.event.impl.KeyEvent;
14-
import net.sssssssthedev.SmartClient.module.Module;
15+
import net.sssssssthedev.SmartClient.annotations.modules.Module;
1516
import net.sssssssthedev.SmartClient.module.ModuleManager;
1617
import net.sssssssthedev.SmartClient.settings.SettingsManager;
18+
import net.sssssssthedev.SmartClient.utils.CommitHelper;
1719
import net.sssssssthedev.SmartClient.utils.ValueManager;
1820
import org.lwjgl.opengl.Display;
1921

@@ -24,7 +26,12 @@
2426
* Main class
2527
* @author sssssssthedev
2628
*/
27-
public class Main {
29+
@IVersion(
30+
name = "SmartClient",
31+
version = "1.2.9",
32+
build = "Production"
33+
)
34+
public class Main extends VersionInfo {
2835

2936
public static Main instance = new Main();
3037
public static Date date = new Date(System.currentTimeMillis());
@@ -43,7 +50,6 @@ public class Main {
4350
public EventManager eventManager = new EventManager();
4451
public CommandManager commandManager = new CommandManager();
4552
public ValueManager valueManager = new ValueManager();
46-
public SmartClientAPI smartClientAPI = new SmartClientAPI();
4753

4854
/***
4955
* loadClient
@@ -55,8 +61,8 @@ public void loadClient() throws IOException {
5561
clickGUI = new ClickGUI();
5662
ViaForge.getInstance().start();
5763
eventManager.register(this);
58-
smartClientAPI.load();
59-
Display.setTitle(String.format("%s %s | %s | %s", smartClientAPI.versionInfo.name, smartClientAPI.versionInfo.build, smartClientAPI.versionInfo.version, smartClientAPI.versionInfo.commit));
64+
setCommit(CommitHelper.instance.getCommitID());
65+
Display.setTitle(String.format("%s %s | %s | %s", getName(), getBuild(), getVersion(), getCommit()));
6066

6167
}
6268

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package net.sssssssthedev.SmartClient.annotations.modules;
2+
3+
import net.sssssssthedev.SmartClient.module.Category;
4+
5+
import java.lang.annotation.*;
6+
7+
@Target({ElementType.TYPE})
8+
@Retention(RetentionPolicy.RUNTIME)
9+
@Documented
10+
public @interface IModule {
11+
12+
/***
13+
* Name of the module
14+
* @return module name
15+
*/
16+
String name();
17+
18+
/***
19+
* Key of the module
20+
* @return module key
21+
*/
22+
int key();
23+
24+
/***
25+
* Category of the module
26+
* @return module category
27+
*/
28+
Category category();
29+
30+
}
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,100 @@
1-
package net.sssssssthedev.SmartClient.module;
2-
3-
import net.minecraft.client.Minecraft;
4-
import net.sssssssthedev.SmartClient.Main;
5-
import net.sssssssthedev.SmartClient.ui.notification.Notification;
6-
import net.sssssssthedev.SmartClient.ui.notification.NotificationManager;
7-
import net.sssssssthedev.SmartClient.ui.notification.NotificationType;
8-
import net.sssssssthedev.SmartClient.utils.Wrapper;
9-
10-
public class Module {
11-
12-
protected Minecraft mc = Minecraft.getMinecraft();
13-
14-
private String name, displayname;
15-
private int key;
16-
private Category category;
17-
private boolean toggled;
18-
19-
public Module(String name, int key, Category category) {
20-
this.name = name;
21-
this.key = key;
22-
this.category = category;
23-
toggled = false;
24-
25-
setup();
26-
}
27-
28-
public void onEnable() {
29-
Main.instance.eventManager.register(this);
30-
}
31-
32-
public void onDisable() {
33-
Main.instance.eventManager.unregister(this);
34-
}
35-
36-
public void onToggle() {
37-
}
38-
39-
public void toggle() {
40-
toggled = !toggled;
41-
onToggle();
42-
if(toggled) {
43-
onEnable();
44-
if (!getDisplayName().equals("ClickGUI"))
45-
NotificationManager.show(new Notification(NotificationType.INFO, getDisplayName(), "Turned On", 1));
46-
} else {
47-
onDisable();
48-
if (!getDisplayName().equals("ClickGUI")) {
49-
NotificationManager.show(new Notification(NotificationType.INFO, getDisplayName(), "Turned Off", 1));
50-
}
51-
}
52-
53-
}
54-
55-
public String getName() {
56-
return name;
57-
}
58-
59-
public void setName(String name) {
60-
this.name = name;
61-
}
62-
63-
public int getKey() {
64-
return key;
65-
}
66-
67-
public void setKey(int key) {
68-
this.key = key;
69-
}
70-
71-
public Category getCategory() {
72-
return category;
73-
}
74-
75-
public void setCategory(Category category) {
76-
this.category = category;
77-
}
78-
79-
public boolean isToggled() {
80-
return toggled;
81-
}
82-
83-
public String getDisplayName() {
84-
return displayname == null ? name : displayname;
85-
}
86-
87-
public void setDisplayName(String displayName) {
88-
this.displayname = displayName;
89-
}
90-
91-
public void setup() {
92-
93-
}
94-
95-
public String getKeyName() {
96-
return Wrapper.getKeyName(key);
97-
}
98-
}
1+
package net.sssssssthedev.SmartClient.annotations.modules;
2+
3+
import net.minecraft.client.Minecraft;
4+
import net.sssssssthedev.SmartClient.Main;
5+
import net.sssssssthedev.SmartClient.annotations.version.IVersion;
6+
import net.sssssssthedev.SmartClient.module.Category;
7+
import net.sssssssthedev.SmartClient.ui.notification.Notification;
8+
import net.sssssssthedev.SmartClient.ui.notification.NotificationManager;
9+
import net.sssssssthedev.SmartClient.ui.notification.NotificationType;
10+
import net.sssssssthedev.SmartClient.utils.Wrapper;
11+
12+
public class Module {
13+
14+
protected Minecraft mc = Minecraft.getMinecraft();
15+
16+
private String name, displayname;
17+
private int key;
18+
private Category category;
19+
private boolean toggled;
20+
21+
public Module() {
22+
this.name = (getClass().getAnnotation(IModule.class)).name();
23+
this.key = (getClass().getAnnotation(IModule.class)).key();
24+
this.category = (getClass().getAnnotation(IModule.class)).category();
25+
toggled = false;
26+
27+
setup();
28+
}
29+
30+
public void onEnable() {
31+
Main.instance.eventManager.register(this);
32+
}
33+
34+
public void onDisable() {
35+
Main.instance.eventManager.unregister(this);
36+
}
37+
38+
public void onToggle() {
39+
}
40+
41+
public void toggle() {
42+
toggled = !toggled;
43+
onToggle();
44+
if(toggled) {
45+
onEnable();
46+
if (!getDisplayName().equals("ClickGUI"))
47+
NotificationManager.show(new Notification(NotificationType.INFO, getDisplayName(), "Turned On", 1));
48+
} else {
49+
onDisable();
50+
if (!getDisplayName().equals("ClickGUI")) {
51+
NotificationManager.show(new Notification(NotificationType.INFO, getDisplayName(), "Turned Off", 1));
52+
}
53+
}
54+
55+
}
56+
57+
public String getName() {
58+
return name;
59+
}
60+
61+
public void setName(String name) {
62+
this.name = name;
63+
}
64+
65+
public int getKey() {
66+
return key;
67+
}
68+
69+
public void setKey(int key) {
70+
this.key = key;
71+
}
72+
73+
public Category getCategory() {
74+
return category;
75+
}
76+
77+
public void setCategory(Category category) {
78+
this.category = category;
79+
}
80+
81+
public boolean isToggled() {
82+
return toggled;
83+
}
84+
85+
public String getDisplayName() {
86+
return displayname == null ? name : displayname;
87+
}
88+
89+
public void setDisplayName(String displayName) {
90+
this.displayname = displayName;
91+
}
92+
93+
public void setup() {
94+
95+
}
96+
97+
public String getKeyName() {
98+
return Wrapper.getKeyName(key);
99+
}
100+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package net.sssssssthedev.SmartClient.annotations.version;
2+
3+
import java.lang.annotation.*;
4+
5+
@Target({ElementType.TYPE})
6+
@Retention(RetentionPolicy.RUNTIME)
7+
@Documented
8+
public @interface IVersion {
9+
10+
/***
11+
* Name of the client
12+
* @return client name
13+
*/
14+
String name() default "";
15+
16+
/***
17+
* Version of the client
18+
* @return client version
19+
*/
20+
String version() default "";
21+
22+
/***
23+
* Environment of the client (Production/Development)
24+
* @return client environment
25+
*/
26+
String build() default "";
27+
28+
/***
29+
* Commit of the client
30+
* @return client commit
31+
*/
32+
String commit() default "";
33+
34+
}

src/main/java/net/sssssssthedev/SmartClient/api/impl/version/VersionInfo.java renamed to src/main/java/net/sssssssthedev/SmartClient/annotations/version/VersionInfo.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package net.sssssssthedev.SmartClient.api.impl.version;
1+
package net.sssssssthedev.SmartClient.annotations.version;
22

33
public class VersionInfo {
44

@@ -7,11 +7,11 @@ public class VersionInfo {
77
public String build;
88
public String commit;
99

10-
public VersionInfo(String name, String version, String build, String commit) {
11-
this.name = name;
12-
this.version = version;
13-
this.build = build;
14-
this.commit = commit;
10+
public VersionInfo() {
11+
this.name = (getClass().getAnnotation(IVersion.class)).name();
12+
this.version = (getClass().getAnnotation(IVersion.class)).version();
13+
this.build = (getClass().getAnnotation(IVersion.class)).build();
14+
this.commit = (getClass().getAnnotation(IVersion.class)).commit();
1515
}
1616

1717
public void setVersion(String version) {

src/main/java/net/sssssssthedev/SmartClient/api/SmartClientAPI.java

-16
This file was deleted.

src/main/java/net/sssssssthedev/SmartClient/clickgui/ClickGUI.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import net.sssssssthedev.SmartClient.clickgui.util.ColorUtil;
1414
import net.sssssssthedev.SmartClient.clickgui.util.FontUtil;
1515
import net.sssssssthedev.SmartClient.module.Category;
16-
import net.sssssssthedev.SmartClient.module.Module;
16+
import net.sssssssthedev.SmartClient.annotations.modules.Module;
1717
import net.sssssssthedev.SmartClient.settings.SettingsManager;
1818
import org.lwjgl.input.Keyboard;
1919
import org.lwjgl.opengl.GL11;

src/main/java/net/sssssssthedev/SmartClient/clickgui/elements/ModuleButton.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
import net.minecraft.client.Minecraft;
44
import net.minecraft.client.gui.Gui;
5-
import net.minecraft.client.resources.SimpleReloadableResourceManager;
65
import net.sssssssthedev.SmartClient.Main;
76
import net.sssssssthedev.SmartClient.clickgui.Panel;
87
import net.sssssssthedev.SmartClient.clickgui.elements.menu.ElementCheckBox;
98
import net.sssssssthedev.SmartClient.clickgui.elements.menu.ElementComboBox;
109
import net.sssssssthedev.SmartClient.clickgui.elements.menu.ElementSlider;
1110
import net.sssssssthedev.SmartClient.clickgui.util.ColorUtil;
1211
import net.sssssssthedev.SmartClient.clickgui.util.FontUtil;
13-
import net.sssssssthedev.SmartClient.module.Module;
12+
import net.sssssssthedev.SmartClient.annotations.modules.Module;
1413
import net.sssssssthedev.SmartClient.settings.Setting;
1514
import org.lwjgl.input.Keyboard;
1615

0 commit comments

Comments
 (0)