-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
BaseClient.java
235 lines (168 loc) · 9.38 KB
/
BaseClient.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
package me.wavelength.baseclient;
import java.io.File;
import org.lwjgl.opengl.Display;
import com.google.common.collect.Lists;
import me.wavelength.baseclient.account.AccountManager;
import me.wavelength.baseclient.command.CommandManager;
import me.wavelength.baseclient.event.EventManager;
import me.wavelength.baseclient.font.Font;
import me.wavelength.baseclient.friends.FriendsManager;
import me.wavelength.baseclient.gui.altmanager.GuiAltManager;
import me.wavelength.baseclient.gui.clickgui.ClickGui;
import me.wavelength.baseclient.irc.IRCClient;
import me.wavelength.baseclient.module.ModuleManager;
import me.wavelength.baseclient.overlay.HotbarOverlay;
import me.wavelength.baseclient.overlay.TabGui1;
import me.wavelength.baseclient.overlay.ToggledModules1;
import me.wavelength.baseclient.thealtening.AltService;
import me.wavelength.baseclient.utils.Config;
import me.wavelength.baseclient.utils.Files;
import me.wavelength.baseclient.utils.Strings;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.Locale;
public class BaseClient {
/**
* @formatter:off
* Credits
*
* Fonts: Slick's font manager edited by Russian412 and color system by me
* Alt Manager: Russian412's Alt Manager with some small bug-fixes by me
* The Altening Implementation: Russian412
*
* Everything else is made by me
* @formatter:on
**/
private final String clientName = "BaseClient";
private final String clientVersion = "0.1";
private final String author = "WaveLength";
public static BaseClient instance;
private final String defaultUsername = "WaveLength";
private EventManager eventManager;
private FriendsManager friendsManager;
private CommandManager commandManager;
private ModuleManager moduleManager;
private IRCClient ircClient;
private AccountManager accountManager;
private AltService altService;
private Font font;
private String packageBase = "me.wavelength.baseclient";
private boolean defaultHotbar = false;
private Config genericConfig;
private ClickGui clickGui;
private Locale englishLocale;
public BaseClient() {
instance = this;
}
public void initialize() {
Display.setTitle(String.format("%1$s - %2$s | Loading...", clientName, clientVersion));
this.englishLocale = new Locale();
this.ircClient = new IRCClient("chat.freenode.net", 6667, Minecraft.getMinecraft().getSession().getUsername(), "#WaveLengthBaseClient");
new GuiAltManager(); // We create the instance.
String clientFolder = new File(".").getAbsolutePath();
clientFolder = (clientFolder.contains("jars") ? new File(".").getAbsolutePath().substring(0, clientFolder.length() - 2) : new File(".").getAbsolutePath()) + Strings.getSplitter() + clientName;
String accountManagerFolder = clientFolder + Strings.getSplitter() + "alts";
Files.createRecursiveFolder(accountManagerFolder);
this.accountManager = new AccountManager(new File(accountManagerFolder));
this.clickGui = new ClickGui();
this.eventManager = new EventManager();
this.friendsManager = new FriendsManager();
this.moduleManager = new ModuleManager();
this.commandManager = new CommandManager(".");
commandManager.registerCommands(); // Moved here to make sure the CommandManager instance is created, else the
// "commandManager" variable in the Command class would be null (since we are
// getting the CommandManager instance from this class)
this.altService = new AltService();
switchToMojang();
this.genericConfig = new Config(new File(clientFolder + Strings.getSplitter() + "config.cfg"));
genericConfig.addDefault("tabguicolor", "5556190");
/** Setting a custom icon */
/** Both 16x16 and 32x32 version encoded in Base64 */
String icon16x16 = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQA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kDwreXa2v7mKyIJclFjL7SCMiuGdt/ctIFIgjBNfYTWTLuBEMsLrbTX9scC5MYW3zjAytt+G9x/EQ/9v+ChA/wb3ZRmeVP8lFEAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjAtMDMtMTZUMDA6MDU6MjMtMDc6MDCll0/8AAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIwLTAzLTE2VDAwOjA1OjIzLTA3OjAw1Mr3QAAAAABJRU5ErkJggg==";
/** Calling the #setWindowIcon() method with the two encoded icons */
Minecraft.getMinecraft().setWindowIcon(icon16x16, icon32x32);
}
public void afterMinecraft() {
Display.setTitle(String.format("%1$s - %2$s", clientName, clientVersion));
this.font = new Font(packageBase + ".font.fonts", "BwModelicaSS01-RegularCondensed", 50, 25, 30, 33);
registerHuds();
}
private void registerHuds() {
new HotbarOverlay();
new ToggledModules1();
new TabGui1();
}
public String getClientName() {
return clientName;
}
public String getClientVersion() {
return clientVersion;
}
public String getAuthor() {
return author;
}
public String getDefaultUsername() {
return defaultUsername;
}
public EventManager getEventManager() {
return eventManager;
}
public FriendsManager getFriendsManager() {
return friendsManager;
}
public CommandManager getCommandManager() {
return commandManager;
}
public ModuleManager getModuleManager() {
return moduleManager;
}
public IRCClient getIRCClient() {
return ircClient;
}
public AccountManager getAccountManager() {
return accountManager;
}
public AltService getAltService() {
return altService;
}
@Deprecated
public Font getFontRenderer() {
return font;
}
public Font getFont() {
return font;
}
public String getPackageBase() {
return packageBase;
}
public boolean isDefaultHotbar() {
return defaultHotbar;
}
public Config getGenericConfig() {
return genericConfig;
}
public ClickGui getClickGui() {
return clickGui;
}
public Locale getEnglishLocale() {
return englishLocale;
}
public void switchToMojang() {
try {
this.altService.switchService(AltService.EnumAltService.MOJANG);
} catch (NoSuchFieldException e) {
System.out.println("Couldn't switch to modank altservice");
} catch (IllegalAccessException e) {
System.out.println("Couldn't switch to modank altservice -2");
}
}
public void switchToTheAltening() {
try {
this.altService.switchService(AltService.EnumAltService.THEALTENING);
} catch (NoSuchFieldException e) {
System.out.println("Couldn't switch to altening altservice");
} catch (IllegalAccessException e) {
System.out.println("Couldn't switch to altening altservice -2");
}
}
}