From b79e61949903e365362c17338acfb8b09d84f54f Mon Sep 17 00:00:00 2001 From: Lorenz Date: Mon, 22 Aug 2022 04:18:51 +0200 Subject: added real time display --- .../java/at/hannibal2/skyhanni/SkyHanniMod.java | 6 ++---- .../at/hannibal2/skyhanni/config/Features.java | 5 +++++ .../hannibal2/skyhanni/config/features/Misc.java | 10 +++++++++ .../at/hannibal2/skyhanni/features/RealTime.kt | 24 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/features/RealTime.kt (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index a1423db65..7784dffb3 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -7,10 +7,7 @@ import at.hannibal2.skyhanni.data.HypixelData; import at.hannibal2.skyhanni.data.ItemRenderBackground; import at.hannibal2.skyhanni.data.ScoreboardData; import at.hannibal2.skyhanni.data.repo.RepoManager; -import at.hannibal2.skyhanni.features.ButtonOnPause; -import at.hannibal2.skyhanni.features.CurrentPetDisplay; -import at.hannibal2.skyhanni.features.ExpBottleOnGroundHider; -import at.hannibal2.skyhanni.features.SummoningSoulsName; +import at.hannibal2.skyhanni.features.*; import at.hannibal2.skyhanni.features.anvil.AnvilCombineHelper; import at.hannibal2.skyhanni.features.bazaar.BazaarApi; import at.hannibal2.skyhanni.features.bazaar.BazaarBestSellMethod; @@ -98,6 +95,7 @@ public class SkyHanniMod { registerEvent(new SummoningSoulsName()); registerEvent(new AshfangGravityOrbs()); registerEvent(new CrimsonArmorTier()); + registerEvent(new RealTime()); Commands.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 494acd36c..46ac5ab8e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -61,6 +61,11 @@ public class Features { editOverlay(activeConfigCategory, 200, 16, abilities.ashfangNextResetCooldownPos); return; } + + if (runnableId.equals("realTime")) { + editOverlay(activeConfigCategory, 200, 16, misc.realTimePos); + return; + } } @Expose diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java index 51c97f995..50e99729c 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -37,4 +37,14 @@ public class Misc { @ConfigOption(name = "Config Button", desc = "Add a button to the pause menu to configure SkyHanni.") @ConfigEditorBoolean public boolean configButtonOnPause = true; + + @Expose + @ConfigOption(name = "Real Time", desc = "Show the real time. Useful while playing in full screen mode") + @ConfigEditorBoolean + public boolean realTime = false; + + @Expose + @ConfigOption(name = "Ashfang Freeze Position", desc = "") + @ConfigEditorButton(runnableId = "realTime", buttonText = "Edit") + public Position realTimePos = new Position(10, 10, false, true); } \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt b/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt new file mode 100644 index 000000000..016e39b23 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/RealTime.kt @@ -0,0 +1,24 @@ +package at.hannibal2.skyhanni.features + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.utils.GuiRender.renderString +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraftforge.client.event.RenderGameOverlayEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import java.text.SimpleDateFormat + +class RealTime { + + private val format = SimpleDateFormat("HH:mm:ss") + + @SubscribeEvent + fun renderOverlay(event: RenderGameOverlayEvent.Post) { + if (!isEnabled()) return + + SkyHanniMod.feature.misc.realTimePos.renderString(format.format(System.currentTimeMillis())) + } + + private fun isEnabled(): Boolean { + return LorenzUtils.inSkyblock && SkyHanniMod.feature.misc.realTime + } +} \ No newline at end of file -- cgit