aboutsummaryrefslogtreecommitdiff
path: root/mod/src/main/java/kr/syeyoung/dungeonsguide
diff options
context:
space:
mode:
Diffstat (limited to 'mod/src/main/java/kr/syeyoung/dungeonsguide')
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java71
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/IDungeonGuide.java10
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java4
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebuggableMap.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java1
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompManager.java4
6 files changed, 48 insertions, 44 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
index 4f50ac84..408ae9d7 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.java
@@ -19,7 +19,8 @@
package kr.syeyoung.dungeonsguide.mod;
import com.google.common.collect.Sets;
-import kr.syeyoung.dungeonsguide.Main;
+import kr.syeyoung.dungeonsguide.launcher.DGInterface;
+import kr.syeyoung.dungeonsguide.launcher.Main;
import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor;
import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter;
import kr.syeyoung.dungeonsguide.mod.commands.CommandDgDebug;
@@ -43,6 +44,7 @@ import lombok.Getter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
import net.minecraft.client.resources.IReloadableResourceManager;
+import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraftforge.client.ClientCommandHandler;
@@ -59,7 +61,7 @@ import java.io.IOException;
import java.util.List;
import java.util.Set;
-public class DungeonsGuide implements IDungeonGuide {
+public class DungeonsGuide implements DGInterface {
@Getter
private static boolean firstTimeUsingDG = false;
@@ -91,8 +93,28 @@ public class DungeonsGuide implements IDungeonGuide {
- public void init() {
+ public void init(File f) {
ProgressManager.ProgressBar progressbar = ProgressManager.push("DungeonsGuide", 4);
+
+ progressbar.step("Creating Configuration");
+
+ File configFile = new File(Main.getConfigDir(), "config.json");
+ if (!configFile.exists()) {
+ Main.getConfigDir().mkdirs();
+ firstTimeUsingDG = true;
+ }
+
+ Config.f = configFile;
+ Minecraft.getMinecraft().getFramebuffer().enableStencil();
+
+ try {
+ List<IResourcePack> resourcePackList = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks", "aA", "field_110449_ao");
+ resourcePackList.add(new DGTexturePack());
+ Minecraft.getMinecraft().refreshResources();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
MinecraftForge.EVENT_BUS.register(this);
progressbar.step("Registering Events & Commands");
@@ -133,8 +155,7 @@ public class DungeonsGuide implements IDungeonGuide {
MinecraftForge.EVENT_BUS.register(command);
MinecraftForge.EVENT_BUS.register(commandDungeonsGuide);
- commandReparty = new CommandReparty();
- MinecraftForge.EVENT_BUS.register(commandReparty);
+ MinecraftForge.EVENT_BUS.register(commandReparty = new CommandReparty());
MinecraftForge.EVENT_BUS.register(new FeatureListener());
MinecraftForge.EVENT_BUS.register(new PacketListener());
@@ -148,8 +169,7 @@ public class DungeonsGuide implements IDungeonGuide {
progressbar.step("Opening connection");
- cosmeticsManager = new CosmeticsManager();
- MinecraftForge.EVENT_BUS.register(cosmeticsManager);
+ MinecraftForge.EVENT_BUS.register(cosmeticsManager = new CosmeticsManager());
progressbar.step("Loading Config");
@@ -170,11 +190,22 @@ public class DungeonsGuide implements IDungeonGuide {
MinecraftForge.EVENT_BUS.register(RichPresenceManager.INSTANCE);
TimeScoreUtil.init();
- Main.finishUpProgressBar(progressbar);
-
ProgressManager.pop(progressbar);
- ((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(resourceManager -> GLCursors.setupCursors());
+ }
+
+ @Override
+ public void unload() {
+ // have FUN!
+
+// bar.step("Instantiating...");
+// partialLoad(obtainLoader(configuration));
+ throw new UnsupportedOperationException("Who the heck registered events in features?? This will stay unsupported for now");
+ }
+
+ @Override
+ public void onResourceReload(IResourceManager a) {
+ GLCursors.setupCursors();
}
private boolean showedStartUpGuide;
@@ -227,26 +258,6 @@ public class DungeonsGuide implements IDungeonGuide {
}
- public void preinit(){
-
- File configFile = new File(Main.getConfigDir(), "config.json");
- if (!configFile.exists()) {
- Main.getConfigDir().mkdirs();
- firstTimeUsingDG = true;
- }
-
- Config.f = configFile;
- Minecraft.getMinecraft().getFramebuffer().enableStencil();
-
- try {
- List<IResourcePack> resourcePackList = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks", "aA", "field_110449_ao");
- resourcePackList.add(new DGTexturePack());
- Minecraft.getMinecraft().refreshResources();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
public SkyblockStatus getSkyblockStatus() {
return skyblockStatus;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/IDungeonGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/IDungeonGuide.java
deleted file mode 100644
index d4ee724d..00000000
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/IDungeonGuide.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package kr.syeyoung.dungeonsguide.mod;
-
-/**
- * This exists, so we can reload the mod/ download a more recent version
- */
-public interface IDungeonGuide {
- void init();
- void preinit();
-
-}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java
index 3b23e0b8..4908a170 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/cosmetics/CosmeticsManager.java
@@ -22,6 +22,10 @@ package kr.syeyoung.dungeonsguide.mod.cosmetics;
import kr.syeyoung.dungeonsguide.mod.cosmetics.chatreplacers.*;
import kr.syeyoung.dungeonsguide.mod.events.impl.PlayerListItemPacketEvent;
+import kr.syeyoung.dungeonsguide.mod.events.impl.StompConnectedEvent;
+import kr.syeyoung.dungeonsguide.mod.stomp.StompHeader;
+import kr.syeyoung.dungeonsguide.mod.stomp.StompManager;
+import kr.syeyoung.dungeonsguide.mod.stomp.StompPayload;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebuggableMap.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebuggableMap.java
index 36a361e0..b4ad5708 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebuggableMap.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/advanced/FeatureDebuggableMap.java
@@ -24,6 +24,8 @@ import kr.syeyoung.dungeonsguide.mod.SkyblockStatus;
import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.mod.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.mod.utils.MapUtils;
+import kr.syeyoung.dungeonsguide.mod.utils.RenderUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiChat;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java
index 7b8c12d2..873ce17b 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/resources/DGTexturePack.java
@@ -18,7 +18,6 @@
package kr.syeyoung.dungeonsguide.mod.resources;
-import kr.syeyoung.dungeonsguide.launcher.auth.ResourceManager;
import lombok.AllArgsConstructor;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.data.IMetadataSection;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompManager.java
index 37e2792e..e7248484 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompManager.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/stomp/StompManager.java
@@ -16,7 +16,6 @@ import java.util.concurrent.TimeUnit;
public class StompManager {
Logger logger = LogManager.getLogger("StompManager");
public static final String STOMP_URL = "wss://dungeons.guide/ws";
- // private String stompURL = "ws://localhost/ws";
static StompManager instance;
public static StompManager getInstance() {
@@ -62,12 +61,11 @@ public class StompManager {
if (stompConnection != null) {
stompConnection.disconnect();
}
- stompConnection = new StompClient(new URI(StompManager.STOMP_URL), AuthManager.getInstance().getToken());
+ stompConnection = new StompClient(new URI(StompManager.STOMP_URL), AuthManager.getInstance().getWorkingTokenOrNull());
MinecraftForge.EVENT_BUS.post(new StompConnectedEvent(stompConnection));
} catch (Exception e) {
logger.error("Failed to connect to Stomp with message: {}", String.valueOf(Throwables.getRootCause(e)));
}
-
}, 5L, TimeUnit.SECONDS);
}
}