aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/features
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2020-12-31 12:46:10 +0900
committersyeyoung <cyong06@naver.com>2020-12-31 12:46:10 +0900
commita09e7553a93a177df7a6a3c7db5a1383b08a2416 (patch)
tree6e675c819c06438b8ca4303b9890a3d0261ccb34 /src/main/java/kr/syeyoung/dungeonsguide/features
parent60a6f9ce3bd9a87bc540397740bca13f1dbc4dc8 (diff)
downloadSkyblock-Dungeons-Guide-a09e7553a93a177df7a6a3c7db5a1383b08a2416.tar.gz
Skyblock-Dungeons-Guide-a09e7553a93a177df7a6a3c7db5a1383b08a2416.tar.bz2
Skyblock-Dungeons-Guide-a09e7553a93a177df7a6a3c7db5a1383b08a2416.zip
gui feature, listeners, and editing gui
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java3
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/FeatureCooldownCounter.java27
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java7
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListener.java7
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/ScreenRenderListener.java5
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/WorldRenderListener.java5
6 files changed, 50 insertions, 4 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java
index cec8492c..2e2105b6 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java
@@ -34,9 +34,6 @@ public abstract class AbstractFeature {
@Setter
private boolean enabled = true;
- public void drawWorld(float partialTicks) {}
- public void drawScreen(float partialTicks) {}
-
public List<FeatureParameter> getParameters() { return new ArrayList<FeatureParameter>(parameters.values()); }
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureCooldownCounter.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureCooldownCounter.java
new file mode 100644
index 00000000..e5e0b1b6
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureCooldownCounter.java
@@ -0,0 +1,27 @@
+package kr.syeyoung.dungeonsguide.features;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import org.lwjgl.opengl.GL11;
+
+public class FeatureCooldownCounter extends GuiFeature {
+ protected FeatureCooldownCounter() {
+ super("QoL", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown", true, 100, 50);
+ }
+
+ @Override
+ public void drawHUD(float partialTicks) {
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ fr.drawString("Cooldown: 1s", 0,0,0xFFFFFFFF);
+ }
+
+ @Override
+ public void drawDemo(float partialTicks) {
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
+ GL11.glScaled(scale, scale, 0);
+ fr.drawString("Cooldown: 1s", 0,0,0xFFFFFFFF);
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
index f74e417d..d47b6c34 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
@@ -2,6 +2,7 @@ package kr.syeyoung.dungeonsguide.features;
import com.google.gson.JsonObject;
import kr.syeyoung.dungeonsguide.config.types.TypeConverterRegistry;
+import kr.syeyoung.dungeonsguide.features.listener.ScreenRenderListener;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
@@ -13,7 +14,7 @@ import org.lwjgl.opengl.GL11;
import java.awt.*;
@Getter
-public abstract class GuiFeature extends AbstractFeature {
+public abstract class GuiFeature extends AbstractFeature implements ScreenRenderListener {
@Setter
private Rectangle featureRect;
@Setter(value = AccessLevel.PROTECTED)
@@ -22,17 +23,21 @@ public abstract class GuiFeature extends AbstractFeature {
private int defaultWidth;
@Setter(value = AccessLevel.PROTECTED)
private int defaultHeight;
+ private double defaultRatio;
protected GuiFeature(String category, String name, String description, String key, boolean keepRatio, int width, int height) {
super(category, name, description, key);
this.keepRatio = keepRatio;
this.defaultWidth = width;
this.defaultHeight = height;
+ this.defaultRatio = defaultWidth / (double)defaultHeight;
this.featureRect = new Rectangle(0, 0, width, height);
}
@Override
public void drawScreen(float partialTicks) {
+ if (!isEnabled()) return;
+
clip(new ScaledResolution(Minecraft.getMinecraft()), featureRect.x, featureRect.y, featureRect.width, featureRect.height);
GL11.glPushAttrib(GL11.GL_SCISSOR_BIT);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListener.java
new file mode 100644
index 00000000..13989245
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ChatListener.java
@@ -0,0 +1,7 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+
+public interface ChatListener {
+ void onChat(ClientChatReceivedEvent clientChatReceivedEvent);
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ScreenRenderListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ScreenRenderListener.java
new file mode 100644
index 00000000..4a659a80
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/ScreenRenderListener.java
@@ -0,0 +1,5 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+public interface ScreenRenderListener {
+ void drawScreen(float partialTicks);
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/WorldRenderListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/WorldRenderListener.java
new file mode 100644
index 00000000..3815453d
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/WorldRenderListener.java
@@ -0,0 +1,5 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+public interface WorldRenderListener {
+ void drawWorld(float partialTicks);
+}