66import cc .polyfrost .oneconfig .libs .universal .UChat ;
77import llc .redstone .hysentials .capes .CapeHandler ;
88import llc .redstone .hysentials .config .hysentialMods .FormattingConfig ;
9+ import llc .redstone .hysentials .config .hysentialMods .IconsConfig ;
10+ import llc .redstone .hysentials .config .hysentialMods .icons .IconStuff ;
911import llc .redstone .hysentials .cosmetic .CosmeticManager ;
1012import llc .redstone .hysentials .cosmetics .backpack .BackpackCosmetic ;
1113import llc .redstone .hysentials .cosmetics .hamster .HamsterCompanion ;
2123import llc .redstone .hysentials .handlers .chat .modules .misc .Limit256 ;
2224import llc .redstone .hysentials .handlers .guis .GuiScreenPost ;
2325import llc .redstone .hysentials .handlers .htsl .*;
26+ import llc .redstone .hysentials .handlers .misc .HousingJoinHandler ;
2427import llc .redstone .hysentials .handlers .misc .QuestHandler ;
2528import llc .redstone .hysentials .handlers .redworks .FormatPlayerName ;
2629import llc .redstone .hysentials .macrowheel .MacroWheelData ;
5457import net .minecraft .client .gui .GuiMainMenu ;
5558import net .minecraft .client .renderer .entity .layers .LayerArmorBase ;
5659import net .minecraft .client .renderer .entity .layers .LayerBipedArmor ;
60+ import net .minecraft .command .ICommand ;
5761import net .minecraft .util .ResourceLocation ;
5862import net .minecraftforge .client .ClientCommandHandler ;
5963import net .minecraftforge .common .MinecraftForge ;
7781import java .net .URL ;
7882import java .nio .charset .Charset ;
7983import java .nio .charset .StandardCharsets ;
84+ import java .util .ArrayList ;
85+ import java .util .List ;
8086
8187@ Mod (
8288 modid = Hysentials .MOD_ID ,
@@ -106,6 +112,7 @@ public class Hysentials {
106112
107113 public final GuiDisplayHandler guiDisplayHandler = new GuiDisplayHandler ();
108114 public final CosmeticManager cosmeticManager = new CosmeticManager ();
115+ public static List <ICommand > commands ;
109116
110117 public ImageIconRenderer imageIconRenderer ;
111118 public JsonData sbBoxes ;
@@ -140,7 +147,9 @@ public void onFMLPreInitialization(FMLPreInitializationEvent event) {
140147
141148 @ Mod .EventHandler
142149 public void init (FMLInitializationEvent event ) {
150+ registerImages ();
143151 config = new HysentialsConfig ();
152+ updateAndAdd ();
144153 File file = new File (modDir , "./config/hysentials" );
145154 if (!file .exists () && !file .mkdirs ()) {
146155 throw new RuntimeException ("Failed to create config directory! Please report this to sinender on Discord" );
@@ -172,22 +181,27 @@ public void init(FMLInitializationEvent event) {
172181 Socket .createSocket ();
173182
174183 CommandManager .INSTANCE .registerCommand (new GroupChatCommand ());
175- ClientCommandHandler .instance .registerCommand (new HysentialsCommand ());
176- ClientCommandHandler .instance .registerCommand (new GlobalChatCommand ());
177- ClientCommandHandler .instance .registerCommand (new HypixelChatCommand ());
178- ClientCommandHandler .instance .registerCommand (new VisitCommand ());
179- ClientCommandHandler .instance .registerCommand (new VisitPlayerCommand ());
180- ClientCommandHandler .instance .registerCommand (new RemoveGlowCommand ());
181- ClientCommandHandler .instance .registerCommand (new GlowCommand ());
182- ClientCommandHandler .instance .registerCommand (new SetLoreLineCommand ());
183- ClientCommandHandler .instance .registerCommand (new RenameCommand ());
184- ClientCommandHandler .instance .registerCommand (new RemoveNameCommand ());
185- ClientCommandHandler .instance .registerCommand (new InsertLoreLineCommand ());
186- ClientCommandHandler .instance .registerCommand (new RemoveLoreLineCommand ());
187- ClientCommandHandler .instance .registerCommand (new OpenInvCommand ());
188- ClientCommandHandler .instance .registerCommand (new SetTextureCommand ());
189- ClientCommandHandler .instance .registerCommand (new HymojiCommand ());
190- ClientCommandHandler .instance .registerCommand (new ClaimCommand ());
184+ commands = new ArrayList <>();
185+ commands .add (new HysentialsCommand ());
186+ commands .add (new GlobalChatCommand ());
187+ commands .add (new HypixelChatCommand ());
188+ commands .add (new VisitCommand ());
189+ commands .add (new VisitPlayerCommand ());
190+ commands .add (new RemoveGlowCommand ());
191+ commands .add (new QwestiiTestCommand ());
192+ commands .add (new GlowCommand ());
193+ commands .add (new SetLoreLineCommand ());
194+ commands .add (new RenameCommand ());
195+ commands .add (new RemoveNameCommand ());
196+ commands .add (new InsertLoreLineCommand ());
197+ commands .add (new RemoveLoreLineCommand ());
198+ commands .add (new OpenInvCommand ());
199+ commands .add (new SetTextureCommand ());
200+ commands .add (new HymojiCommand ());
201+ commands .add (new ClaimCommand ());
202+ for (ICommand command : commands ) {
203+ ClientCommandHandler .instance .registerCommand (command );
204+ }
191205 CommandManager .INSTANCE .registerCommand (new SBBoxesCommand ());
192206 CommandManager .INSTANCE .registerCommand (new ActionLibraryCommand ());
193207 CommandManager .INSTANCE .registerCommand (new ClubCommand ());
@@ -209,7 +223,12 @@ public void postInit(FMLPostInitializationEvent event) {
209223 isHytils = Loader .isModLoaded ("hytils-reborn" );
210224 chatHandler .init ();
211225
212- registerImages ();
226+ imageIconRenderer = new ImageIconRenderer ();
227+ minecraftFont = Minecraft .getMinecraft ().fontRendererObj ;
228+ if (FormattingConfig .fancyRendering ()) {
229+ Minecraft .getMinecraft ().fontRendererObj = imageIconRenderer ;
230+ }
231+
213232 llc .redstone .hysentials .htsl .Loader .registerLoaders ();
214233 Cluster .registerClusters ();
215234
@@ -218,6 +237,10 @@ public void postInit(FMLPostInitializationEvent event) {
218237
219238 LayerArmorBase armorBase ;
220239 LayerBipedArmor bipedArmor ;
240+
241+ if (config .macroWheelHud .position .getX () == 0 && config .macroWheelHud .position .getY () == 0 ) {
242+ config .macroWheelHud .position .setPosition ((Renderer .screen .getWidth () / 2f ) - (34 *5f ) / 2 , (Renderer .screen .getHeight () / 2f ) - (34 *5f ) / 2 );
243+ }
221244 }
222245
223246 @ Mod .EventHandler
@@ -226,6 +249,26 @@ public void finishedStarting(FMLLoadCompleteEvent event) {
226249 }
227250
228251 public static FontRenderer minecraftFont ;
252+
253+ public static void updateAndAdd () {
254+ try {
255+ for (ImageIcon icon : ImageIcon .imageIcons .values ()) {
256+ icon .handleImageIcon ();
257+ }
258+ } catch (Exception e ) {
259+ throw new RuntimeException (e );
260+ }
261+
262+ for (IconStuff icon : Hysentials .INSTANCE .config .iconsConfig .icons ) {
263+ if (icon .custom ) {
264+ if (icon .localPath == null || icon .name .isEmpty () || ImageIcon .imageIcons .containsKey (icon .name )) continue ;
265+ ImageIcon icon1 = new ImageIcon (icon .name , null , false );
266+ icon1 .width = icon .width ;
267+ icon1 .height = icon .height ;
268+ }
269+ }
270+ }
271+
229272 private void registerImages () {
230273 new ImageIcon ("front" , new ResourceLocation ("textures/icons/front.png" ));
231274 new ImageIcon ("back" , new ResourceLocation ("textures/icons/back.png" ));
@@ -323,11 +366,6 @@ private void registerImages() {
323366 for (int i = 0 ; i < 10 ; i ++) {
324367 new ImageIcon (String .valueOf (i ), new ResourceLocation ("textures/icons/" + i + ".png" ));
325368 }
326- imageIconRenderer = new ImageIconRenderer ();
327- minecraftFont = Minecraft .getMinecraft ().fontRendererObj ;
328- if (FormattingConfig .fancyRendering ()) {
329- Minecraft .getMinecraft ().fontRendererObj = imageIconRenderer ;
330- }
331369 }
332370
333371 private void registerHandlers () {
@@ -352,6 +390,7 @@ private void registerHandlers() {
352390 eventBus .register (new SbbRenderer ());
353391 eventBus .register (new llc .redstone .hysentials .handlers .SbbRenderer ());
354392 eventBus .register (new GuiScreenPost ());
393+ eventBus .register (new HousingJoinHandler ());
355394
356395
357396 eventBus .register (new Actionbar ());
0 commit comments