From 997220275d9164271d3ceb636e90f18913038912 Mon Sep 17 00:00:00 2001 From: syeyoung Date: Sat, 2 Jan 2021 00:09:42 +0900 Subject: cooldown! --- src/main/java/kr/syeyoung/dungeonsguide/e.java | 11 ++++++----- .../dungeonsguide/eventlistener/FeatureListener.java | 2 +- .../features/impl/FeatureCooldownCounter.java | 16 ++++++++++++++-- 3 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src/main/java/kr') diff --git a/src/main/java/kr/syeyoung/dungeonsguide/e.java b/src/main/java/kr/syeyoung/dungeonsguide/e.java index 8e5bb478..1d7f78f7 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/e.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/e.java @@ -47,11 +47,6 @@ public class e implements c { public void init(FMLInitializationEvent event) { - try { - Config.loadConfig( null ); - } catch (IOException e) { - e.printStackTrace(); - } dungeonsGuide = this; skyblockStatus = new SkyblockStatus(); @@ -83,6 +78,12 @@ public class e implements c { } Keybinds.register(); + + try { + Config.loadConfig( null ); + } catch (IOException e) { + e.printStackTrace(); + } } public void pre(FMLPreInitializationEvent event) { configDir = new File(event.getModConfigurationDirectory(),"dungeonsguide"); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java index 4bf332c8..362e1ae8 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java @@ -82,7 +82,7 @@ public class FeatureListener { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent tick) { - if (tick.phase == TickEvent.Phase.END && tick.type == TickEvent.Type.PLAYER ) { + if (tick.phase == TickEvent.Phase.END && tick.type == TickEvent.Type.CLIENT ) { try { SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); if (!skyblockStatus.isOnSkyblock()) return; 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 76a942a2..6b79487d 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java @@ -1,5 +1,7 @@ package kr.syeyoung.dungeonsguide.features.impl; +import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.GuiFeature; import kr.syeyoung.dungeonsguide.features.listener.TickListener; @@ -15,12 +17,15 @@ public class FeatureCooldownCounter extends GuiFeature implements TickListener { parameters.put("color", new FeatureParameter("color", "Color", "Color of text", Color.white, "color")); } + private long leftDungeonTime = 0L; + private boolean wasInDungeon = false; @Override public void drawHUD(float partialTicks) { + if (System.currentTimeMillis() - leftDungeonTime > 10000) return; FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; double scale = getFeatureRect().getHeight() / fr.FONT_HEIGHT; GL11.glScaled(scale, scale, 0); - fr.drawString("Cooldown: 1s", 0,0,this.getParameter("color").getValue().getRGB()); + fr.drawString("Cooldown: "+(10 - (System.currentTimeMillis() - leftDungeonTime) / 1000)+"s", 0,0,this.getParameter("color").getValue().getRGB()); } @Override @@ -31,8 +36,15 @@ public class FeatureCooldownCounter extends GuiFeature implements TickListener { fr.drawString("Cooldown: 10s", 0,0,this.getParameter("color").getValue().getRGB()); } + SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus(); @Override public void onTick() { - + if (wasInDungeon && !skyblockStatus.isOnDungeon()) { + if (skyblockStatus.isOnSkyblock()) + leftDungeonTime = System.currentTimeMillis(); + else return; + System.out.println("think he left"); + } + wasInDungeon = skyblockStatus.isOnDungeon(); } } -- cgit