diff options
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | FEATURES.md | 3 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java | 1 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/Features.java | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/Misc.java | 17 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/ChickenHeadTimer.kt | 65 |
6 files changed, 92 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 28dec21ab..f4f901808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ + Added **Time to Kill** - Show the time it takes to kill the Slayer boss. + Added skill and collection level as item stack. + Added **Auction Highlighter** - Highlight own items that are sold in green and that are expired in red. -+ Add support for tier 1 minions and title send for the minion craft helper. ++ Added support for tier 1 minions and title send for the minion craft helper. ++ Added Chicken head Timer. ### Garden Features + Added **Copper Price** - Show copper to coin prices inside the Sky Mart inventory. diff --git a/FEATURES.md b/FEATURES.md index 13f0a32cc..861b6d878 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -198,4 +198,5 @@ + **Tia Relay Helper** - Helps with solving the sound puzzle. + **Hide dead entities** - Similar to Skytil's feature for inside dungeon, but for everywhere. + **Tps Display** - Show the Tps of the current server. -+ **Particle Hider** - Hide blaze particles, fire block particles, fireball particles, near redstone particles, far particles or smoke particles.
\ No newline at end of file ++ **Particle Hider** - Hide blaze particles, fire block particles, fireball particles, near redstone particles, far particles or smoke particles. ++ Chicken Head Timer.
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java index dc0ed523b..6e44421e8 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -213,6 +213,7 @@ public class SkyHanniMod { loadModule(new GardenNextPlotPrice()); loadModule(new GardenCropMilestoneDisplay()); loadModule(new GardenCustomKeybinds()); + loadModule(new ChickenHeadTimer()); Commands.INSTANCE.init(); diff --git a/src/main/java/at/hannibal2/skyhanni/config/Features.java b/src/main/java/at/hannibal2/skyhanni/config/Features.java index 9eb7554cf..cf5f62502 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/Features.java +++ b/src/main/java/at/hannibal2/skyhanni/config/Features.java @@ -193,6 +193,11 @@ public class Features extends Config { Minecraft.getMinecraft().thePlayer.closeScreen(); return; } + + if (runnableId.equals("chickenHeadTimer")) { + editOverlay(activeConfigCategory, 200, 16, misc.chickenHeadTimerPosition); + 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 3b54afd09..b72565cfa 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/Misc.java @@ -202,6 +202,23 @@ public class Misc { public boolean hideCloseRedstoneparticles = true; @Expose + @ConfigOption(name = "Chicken Head Timer", desc = "") + @ConfigEditorAccordion(id = 10) + public boolean chickenHeadTimer = false; + + @Expose + @ConfigOption(name = "Enabled", desc = "Show the cooldown until the next time you can lay an egg with the chicken head.") + @ConfigEditorBoolean + @ConfigAccordionId(id = 10) + public boolean chickenHeadTimerDisplay = false; + + @Expose + @ConfigOption(name = "Timer Position", desc = "") + @ConfigEditorButton(runnableId = "chickenHeadTimer", buttonText = "Edit") + @ConfigAccordionId(id = 10) + public Position chickenHeadTimerPosition = new Position(-372, 73, false, true); + + @Expose @ConfigOption(name = "Exp Bottles", desc = "Hides all the experience bottles lying on the ground.") @ConfigEditorBoolean public boolean hideExpBottles = false; diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ChickenHeadTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ChickenHeadTimer.kt new file mode 100644 index 000000000..d9e68a1e3 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ChickenHeadTimer.kt @@ -0,0 +1,65 @@ +package at.hannibal2.skyhanni.features.misc + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.utils.ItemUtils.name +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.RenderUtils.renderString +import at.hannibal2.skyhanni.utils.TimeUtils +import net.minecraft.client.Minecraft +import net.minecraftforge.event.world.WorldEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.gameevent.TickEvent + +class ChickenHeadTimer { + + private var tick = 0 + private var hasChickenHead = false + private var lastTime = 0L + + @SubscribeEvent + fun onTick(event: TickEvent.ClientTickEvent) { + if (!isEnabled()) return + if (tick++ % 5 != 0) return + + val itemStack = Minecraft.getMinecraft().thePlayer.inventory.armorInventory[3] + val name = itemStack?.name ?: "" + hasChickenHead = name.contains("Chicken Head") + } + + @SubscribeEvent + fun onWorldLoad(event: WorldEvent.Load) { + lastTime = System.currentTimeMillis() + } + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!isEnabled()) return + if (!hasChickenHead) return + if (event.message == "§aYou laid an egg!") { + lastTime = System.currentTimeMillis() + } + } + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { + if (!isEnabled()) return + if (!hasChickenHead) return + + val sinceLastTime = System.currentTimeMillis() - lastTime + val cooldown = 20_000 + val remainingTime = cooldown - sinceLastTime + + val displayText = if (remainingTime < 0) { + "Chicken Head Timer: §aNow" + } else { + val formatDuration = TimeUtils.formatDuration(remainingTime) + "Chicken Head Timer: §b$formatDuration" + } + + SkyHanniMod.feature.misc.chickenHeadTimerPosition.renderString(displayText) + } + + fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.misc.chickenHeadTimerDisplay +}
\ No newline at end of file |