aboutsummaryrefslogtreecommitdiff
path: root/loader/src/main/java/kr
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2022-11-20 01:10:31 +0900
committersyeyoung <cyoung06@naver.com>2022-11-20 01:10:31 +0900
commit1e5e7b1071b7e6c75f9dd26b716d14c5065fe282 (patch)
treecac4255d413c9161a090d88147f44b75731e1ee6 /loader/src/main/java/kr
parentbd077bc701eb937e577d76ebdf7575510a459bd5 (diff)
downloadSkyblock-Dungeons-Guide-1e5e7b1071b7e6c75f9dd26b716d14c5065fe282.tar.gz
Skyblock-Dungeons-Guide-1e5e7b1071b7e6c75f9dd26b716d14c5065fe282.tar.bz2
Skyblock-Dungeons-Guide-1e5e7b1071b7e6c75f9dd26b716d14c5065fe282.zip
- Devenv loader
- Fix notifications causing z-fight with inventory items - Fix notifications being unclickable with other mods Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'loader/src/main/java/kr')
-rwxr-xr-xloader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java11
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/NotificationManager.java7
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/DevEnvLoader.java78
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/JarLoader.java1
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java1
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/RemoteLoader.java2
6 files changed, 89 insertions, 11 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
index bdd2c21d..b5d76566 100755
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/Main.java
@@ -29,10 +29,7 @@ import kr.syeyoung.dungeonsguide.launcher.gui.screen.GuiLoadingError;
import kr.syeyoung.dungeonsguide.launcher.gui.screen.GuiUnloadingError;
import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.Notification;
import kr.syeyoung.dungeonsguide.launcher.gui.tooltip.NotificationManager;
-import kr.syeyoung.dungeonsguide.launcher.loader.IDGLoader;
-import kr.syeyoung.dungeonsguide.launcher.loader.JarLoader;
-import kr.syeyoung.dungeonsguide.launcher.loader.LocalLoader;
-import kr.syeyoung.dungeonsguide.launcher.loader.RemoteLoader;
+import kr.syeyoung.dungeonsguide.launcher.loader.*;
import lombok.Getter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.IReloadableResourceManager;
@@ -201,7 +198,7 @@ public class Main
NotificationManager.INSTANCE.updateNotification(UUID.randomUUID(), Notification.builder()
.title("Dungeons Guide Loaded!")
- .description("Successfully Loaded DugneonsGuide!\nLoader: "+currentLoader.loaderName()+"\nVersion: "+currentLoader.version())
+ .description("Successfully Loaded Dungeons Guide!\nLoader: "+currentLoader.loaderName()+"\nVersion: "+currentLoader.version())
.titleColor(0xFF00FF00)
.build());
@@ -261,7 +258,9 @@ public class Main
public IDGLoader obtainLoader(Configuration configuration) throws NoVersionFoundException, NoSuitableLoaderFoundException {
String loader = getLoaderName(configuration);
- if ("local".equals(loader) ||
+ if ("devenv".equals(loader)) {
+ return new DevEnvLoader();
+ } else if ("local".equals(loader) ||
(loader.equals("auto") && this.getClass().getResourceAsStream("/kr/syeyoung/dungeonsguide/mod/DungeonsGuide.class") != null)) {
return new LocalLoader();
} else if ("jar".equals(loader) ||
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/NotificationManager.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/NotificationManager.java
index 661ad93c..d386ac50 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/NotificationManager.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/tooltip/NotificationManager.java
@@ -7,6 +7,7 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
+import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.input.Mouse;
@@ -37,6 +38,7 @@ public class NotificationManager {
int widthX = fr.getStringWidth("X");
GlStateManager.pushMatrix();
+ GlStateManager.disableDepth();
GlStateManager.translate(sr.getScaledWidth() - 5, sr.getScaledHeight() -5, 0);
int currY = sr.getScaledHeight() - 5;
@@ -84,6 +86,7 @@ public class NotificationManager {
GlStateManager.translate(0, -5, 0);
}
+ GlStateManager.enableDepth();
GlStateManager.popMatrix();
}
@@ -94,6 +97,7 @@ public class NotificationManager {
int widthX = fr.getStringWidth("X");
GlStateManager.pushMatrix();
+ GlStateManager.disableDepth();
GlStateManager.translate(sr.getScaledWidth() - 5, sr.getScaledHeight() -5, 0);
int currY = sr.getScaledHeight() - 5;
@@ -146,13 +150,14 @@ public class NotificationManager {
GlStateManager.translate(0, -5, 0);
}
+ GlStateManager.enableDepth();
GlStateManager.popMatrix();
}
- @SubscribeEvent
+ @SubscribeEvent(priority = EventPriority.HIGHEST)
public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) {
ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/DevEnvLoader.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/DevEnvLoader.java
new file mode 100644
index 00000000..54969438
--- /dev/null
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/DevEnvLoader.java
@@ -0,0 +1,78 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.launcher.loader;
+
+import kr.syeyoung.dungeonsguide.launcher.DGInterface;
+import kr.syeyoung.dungeonsguide.launcher.exceptions.DungeonsGuideLoadingException;
+import kr.syeyoung.dungeonsguide.launcher.exceptions.DungeonsGuideUnloadingException;
+import net.minecraft.launchwrapper.LaunchClassLoader;
+import org.apache.commons.io.IOUtils;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.ref.PhantomReference;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+
+public class DevEnvLoader implements IDGLoader {
+ private DGInterface dgInterface;
+
+ @Override
+ public DGInterface loadDungeonsGuide() throws DungeonsGuideLoadingException {
+ if (dgInterface != null) throw new IllegalStateException("Already loaded");
+
+ try {
+ dgInterface = (DGInterface) Class.forName("kr.syeyoung.dungeonsguide.mod.DungeonsGuide").newInstance();
+
+ return dgInterface;
+ } catch (Throwable e) {
+ throw new DungeonsGuideLoadingException(e);
+ }
+ }
+
+ @Override
+ public DGInterface getInstance() {
+ return dgInterface;
+ }
+
+ @Override
+ public void unloadDungeonsGuide() throws DungeonsGuideUnloadingException {
+ }
+
+ @Override
+ public boolean isUnloadable() {
+ return false;
+ }
+
+ @Override
+ public boolean isLoaded() {
+ return dgInterface != null;
+ }
+
+ @Override
+ public String loaderName() {
+ return "devenv";
+ }
+
+ @Override
+ public String version() {
+ return "unknown";
+ }
+}
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/JarLoader.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/JarLoader.java
index eef478d1..e6d46b7d 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/JarLoader.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/JarLoader.java
@@ -39,7 +39,6 @@ public class JarLoader implements IDGLoader {
private ReferenceQueue<ClassLoader> refQueue = new ReferenceQueue<>();
private PhantomReference<ClassLoader> phantomReference;
- private boolean loaded;
public static class JarClassLoader extends DGClassLoader {
public JarClassLoader(LaunchClassLoader parent, ZipInputStream zipInputStream) throws IOException {
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java
index caf841a8..f1cabf1f 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/LocalLoader.java
@@ -37,7 +37,6 @@ public class LocalLoader implements IDGLoader {
private ReferenceQueue<ClassLoader> refQueue = new ReferenceQueue<>();
private PhantomReference<ClassLoader> phantomReference;
- private boolean loaded;
public static class LocalClassLoader extends DGClassLoader {
public LocalClassLoader(LaunchClassLoader parent) throws IOException {
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/RemoteLoader.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/RemoteLoader.java
index 12bb2b71..734e1463 100644
--- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/RemoteLoader.java
+++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/loader/RemoteLoader.java
@@ -43,8 +43,6 @@ public class RemoteLoader implements IDGLoader {
private ReferenceQueue<ClassLoader> refQueue = new ReferenceQueue<>();
private PhantomReference<ClassLoader> phantomReference;
- private boolean loaded;
-
public RemoteLoader(String friendlyBranchName, long branchId, long updateId) {
this.friendlyBranchName = friendlyBranchName;
this.branchId = branchId;