aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-14 23:01:25 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-14 23:01:25 +0100
commitbbc55fb133197bfbe3bbf1748b4d33ce218fe1bf (patch)
treed5250144c355cb7134d997b5d757b0abba8c7c15
parent6a7d8d4b1878af419136727105e7660012fb4a6f (diff)
downloadskyhanni-bbc55fb133197bfbe3bbf1748b4d33ce218fe1bf.tar.gz
skyhanni-bbc55fb133197bfbe3bbf1748b4d33ce218fe1bf.tar.bz2
skyhanni-bbc55fb133197bfbe3bbf1748b4d33ce218fe1bf.zip
Added Warn When Close
-rw-r--r--CHANGELOG.md4
-rw-r--r--FEATURES.md1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt39
5 files changed, 53 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a07ed5b5..ac9617297 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,6 @@
+ Added support for tier 1 minions and title send for the minion craft helper.
+ Added Chicken head Timer.
+ Added **rancher boots** speed display.
-+ Added **Optimal Speed** - Show the optimal speed for your current tool in the hand. (Ty MelonKingDE for the values)
### Garden Features
+ Added **Copper Price** - Show copper to coin prices inside the Sky Mart inventory.
@@ -30,7 +29,8 @@
+ Added **Garden Level Display** - Show the current garden level and progress to the next level.
+ Added **Farming Weight and Leaderboard**, provided by the elite skyblock farmers.
+ Added **Dicer Counter** - Count RNG drops for Melon Dicer and Pumpkin Dicer.
-
++ Added **Optimal Speed** - Show the optimal speed for your current tool in the hand. (Ty MelonKingDE for the values)
++ Added **Warn When Close** - Warn with title and sound when the next crop milestone upgrade happens in 5 seconds. Useful for switching to a different pet for leveling.
### Features from other Mods
> *The following features are only there because I want them when testing SkyHanni features without other mods present.*
diff --git a/FEATURES.md b/FEATURES.md
index 4cff5d6ef..8b64a48c3 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -179,6 +179,7 @@
+ **Garden Level Display** - Show the current garden level and progress to the next level.
+ **Farming Weight and Leaderboard**, provided by the elite skyblock farmers.
+ **Dicer Counter** - Count RNG drops for Melon Dicer and Pumpkin Dicer.
++ **Warn When Close** - Warn with title and sound when the next crop milestone upgrade happens in 5 seconds. Useful for switching to a different pet for leveling.
## Commands
- /wiki (using hypixel-skyblock.fandom.com instead of Hypixel wiki)
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
index 6c8b941d4..69a2235f7 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
@@ -153,6 +153,16 @@ public class Garden {
public boolean cropMilestoneProgress = true;
@Expose
+ @ConfigOption(
+ name = "Warn When Close",
+ desc = "Warn with title and sound when the next crop milestone upgrade happens in 5 seconds. " +
+ "(Useful for switching to a different pet for leveling)")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 6)
+ public boolean cropMilestoneWarnClose = true;
+
+
+ @Expose
@ConfigOption(name = "Display Position", desc = "")
@ConfigEditorButton(runnableId = "cropMilestoneProgress", buttonText = "Edit")
@ConfigAccordionId(id = 6)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt
index e245c77dd..702b5fb8f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/BarnFishingTimer.kt
@@ -23,7 +23,7 @@ class BarnFishingTimer {
private var currentCount = 0
private var startTime = 0L
- private var sound = object : PositionedSound(ResourceLocation("random.orb")) {
+ private val sound = object : PositionedSound(ResourceLocation("random.orb")) {
init {
volume = 50f
repeat = false
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
index 156f3dd59..1913406e8 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt
@@ -2,12 +2,17 @@ package at.hannibal2.skyhanni.features.garden
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.data.GardenCropMilestones
+import at.hannibal2.skyhanni.data.SendTitleHelper
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUItems
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
+import at.hannibal2.skyhanni.utils.SoundUtils.playSound
import at.hannibal2.skyhanni.utils.TimeUtils
+import net.minecraft.client.audio.ISound
+import net.minecraft.client.audio.PositionedSound
import net.minecraft.item.ItemStack
+import net.minecraft.util.ResourceLocation
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.*
@@ -17,9 +22,34 @@ class GardenCropMilestoneDisplay {
private val cultivatingData = mutableMapOf<String, Int>()
private val config get() = SkyHanniMod.feature.garden
private val bestCropTime = GardenBestCropTime()
+// val cropMilestoneLevelUpPattern = Pattern.compile(" §r§b§lGARDEN MILESTONE §3(.*) §8XXIII➜§3(.*)")
+
+ private val sound = object : PositionedSound(ResourceLocation("random.orb")) {
+ init {
+ volume = 50f
+ repeat = false
+ repeatDelay = 0
+ attenuationType = ISound.AttenuationType.NONE
+ }
+ }
+ private var lastPlaySoundTime = 0L
private var needsInventory = false
+// @SubscribeEvent
+// fun onChatMessage(event: LorenzChatEvent) {
+// if (!isEnabled()) return
+// if (config.cropMilestoneWarnClose) {
+// val matcher = cropMilestoneLevelUpPattern.matcher(event.message)
+// if (matcher.matches()) {
+// val cropType = matcher.group(1)
+// val newLevel = matcher.group(2).romanToDecimalIfNeeded()
+// LorenzUtils.debug("found milestone messsage!")
+// SendTitleHelper.sendTitle("§b$cropType $newLevel", 1_500)
+// }
+// }
+// }
+
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) {
if (!isEnabled()) return
@@ -172,6 +202,15 @@ class GardenCropMilestoneDisplay {
val millis = missingTimeSeconds * 1000
bestCropTime.timeTillNextCrop[it] = millis
val duration = TimeUtils.formatDuration(millis)
+ if (config.cropMilestoneWarnClose) {
+ if (millis < 5_900) {
+ if (System.currentTimeMillis() > lastPlaySoundTime + 1_000) {
+ lastPlaySoundTime = System.currentTimeMillis()
+ sound.playSound()
+ }
+ SendTitleHelper.sendTitle("§b$it $nextTier in $duration", 1_500)
+ }
+ }
progressDisplay.add(Collections.singletonList("§7in §b$duration"))
val format = LorenzUtils.formatInteger(averageSpeedPerSecond * 60)