aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung/dungeonsguide/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/features')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java4
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java7
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java18
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/TickListener.java5
4 files changed, 29 insertions, 5 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java
index 2facddbe..30b1a29a 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/AbstractFeature.java
@@ -37,7 +37,9 @@ public abstract class AbstractFeature {
public List<FeatureParameter> getParameters() { return new ArrayList<FeatureParameter>(parameters.values()); }
-
+ public <T> FeatureParameter<T> getParameter(String key) {
+ return parameters.get(key);
+ }
public void loadConfig(JsonObject jsonObject) { // gets key, calls it
enabled = jsonObject.get("$enabled").getAsBoolean();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
index 98f8af15..d9d964c1 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/GuiFeature.java
@@ -7,10 +7,12 @@ import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import org.lwjgl.opengl.GL11;
+import javax.sound.midi.MidiEvent;
import java.awt.*;
@Getter
@@ -66,6 +68,11 @@ public abstract class GuiFeature extends AbstractFeature implements ScreenRender
GL11.glScissor((x ) * scale, Minecraft.getMinecraft().displayHeight - (y + height) * scale, (width) * scale, height * scale);
}
+ public static FontRenderer getFontRenderer() {
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ return fr;
+ }
+
@Override
public void loadConfig(JsonObject jsonObject) {
super.loadConfig(jsonObject);
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java
index dc2b7dd8..76a942a2 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java
@@ -1,13 +1,18 @@
package kr.syeyoung.dungeonsguide.features.impl;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.features.GuiFeature;
+import kr.syeyoung.dungeonsguide.features.listener.TickListener;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import org.lwjgl.opengl.GL11;
-public class FeatureCooldownCounter extends GuiFeature {
+import java.awt.*;
+
+public class FeatureCooldownCounter extends GuiFeature implements TickListener {
public FeatureCooldownCounter() {
- super("QoL", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown", true, 100, 50);
+ super("QoL", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown", true, getFontRenderer().getStringWidth("Cooldown: 10s "), getFontRenderer().FONT_HEIGHT);
+ parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.white, "color"));
}
@Override
@@ -15,7 +20,7 @@ public class FeatureCooldownCounter extends GuiFeature {
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
GL11.glScaled(scale, scale, 0);
- fr.drawString("Cooldown: 1s", 0,0,0xFFFFFFFF);
+ fr.drawString("Cooldown: 1s", 0,0,this.<Color>getParameter("color").getValue().getRGB());
}
@Override
@@ -23,6 +28,11 @@ public class FeatureCooldownCounter extends GuiFeature {
FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT;
GL11.glScaled(scale, scale, 0);
- fr.drawString("Cooldown: 1s", 0,0,0xFFFFFFFF);
+ fr.drawString("Cooldown: 10s", 0,0,this.<Color>getParameter("color").getValue().getRGB());
+ }
+
+ @Override
+ public void onTick() {
+
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TickListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TickListener.java
new file mode 100644
index 00000000..dc040fc9
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/TickListener.java
@@ -0,0 +1,5 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+public interface TickListener {
+ void onTick();
+}