aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--FEATURES.md1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Garden.java45
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt38
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt13
7 files changed, 100 insertions, 18 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0e37bb21..9635d2ed0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -65,7 +65,7 @@
+ Added **Tooltip Tweaks Breakdown Hotkey** - When the keybind is pressed, show a breakdown of all fortune sources on a tool. (contributed by appable)
+ Added **Tooltip Tweaks Tooltip Format** - Show crop-specific farming fortune in tooltip. (contributed by appable)
+ Added command **/shcropspeedmeter** - Helps calculate the real farming fortune with the formula crops broken per block.
-
++ Added **Compost Low Notification** - Shows a notification as title when organic matter/fuel is low.
### 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 689d3b0ae..0cdeb1c06 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -210,6 +210,7 @@
+ **Tooltip Tweaks Compact Descriptions** - Hides redundant parts of reforge descriptions, generic counter description, and Farmhand perk explanation. (contributed by appable)
+ **Tooltip Tweaks Breakdown Hotkey** - When the keybind is pressed, show a breakdown of all fortune sources on a tool. (contributed by appable)
+ **Tooltip Tweaks Tooltip Format** - Show crop-specific farming fortune in tooltip. (contributed by appable)
++ **Compost Low Notification** - Shows a notification as title when organic matter/fuel is low.
## Commands
+ **/wiki <search term>** - 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 4ac5450ba..6fbe69ad2 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Garden.java
@@ -746,9 +746,6 @@ public class Garden {
public boolean composterHighLightUpgrade = true;
@Expose
- public Position composterDisplayPos = new Position(-363, 13, false, true);
-
- @Expose
@ConfigOption(
name = "Inventory Numbers",
desc = "Show the amount of Organic Matter, Fuel and Composts Available while inside the composter inventory."
@@ -758,6 +755,47 @@ public class Garden {
public boolean composterInventoryNumbers = true;
@Expose
+ @ConfigOption(name = "Notification When Low Composter", desc = "")
+ @ConfigAccordionId(id = 17)
+ @ConfigEditorAccordion(id = 21)
+ public boolean composterNotifyLow = false;
+
+ @Expose
+ @ConfigOption(name = "Enable", desc = "Show a notification when organic matter or fuel runs low in your composter.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 21)
+ public boolean composterNotifyLowEnabled = true;
+
+ @Expose
+ @ConfigOption(name = "Show Title", desc = "Send a title to notify.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 21)
+ public boolean composterNotifyLowTitle = false;
+
+ @Expose
+ @ConfigOption(name = "Min Organic Matter", desc = "Warn when Organic Matter is below this value.")
+ @ConfigEditorSlider(
+ minValue = 1_000,
+ maxValue = 80_000,
+ minStep = 1
+ )
+ @ConfigAccordionId(id = 21)
+ public int composterNotifyLowOrganicMatter = 20_000;
+
+ @Expose
+ @ConfigOption(name = "Min Fuel Cap", desc = "Warn when Fuel is below this value.")
+ @ConfigEditorSlider(
+ minValue = 500,
+ maxValue = 40_000,
+ minStep = 1
+ )
+ @ConfigAccordionId(id = 21)
+ public int composterNotifyLowFuel = 10_000;
+
+ @Expose
+ public Position composterDisplayPos = new Position(-363, 13, false, true);
+
+ @Expose
@ConfigOption(name = "True Farming Fortune", desc = "")
@ConfigEditorAccordion(id = 18)
public boolean farmingFortune = false;
@@ -828,6 +866,7 @@ public class Garden {
@ConfigEditorBoolean
public boolean deskInSkyBlockMenu = true;
+
@Expose
@ConfigOption(name = "Fungi Cutter Warning", desc = "Warn when breaking mushroom with the wrong Fungi Cutter mode.")
@ConfigEditorBoolean
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java b/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java
index 59133d122..4638f816d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Hidden.java
@@ -54,6 +54,12 @@ public class Hidden {
public Map<String, Integer> gardenDicerRngDrops = new HashMap<>();
@Expose
+ public long informedAboutLowMatter = 0;
+
+ @Expose
+ public long informedAboutLowFuel = 0;
+
+ @Expose
public Map<Long, List<CropType>> gardenJacobFarmingContestTimes = new HashMap<>();
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt
index e80551dec..d910a26bc 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/SkillExperience.kt
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.ProfileJoinEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -182,15 +183,3 @@ class SkillExperience {
}
}
-private fun String.formatNumber(): Long {
- var text = replace(",", "")
- val multiplier = if (text.endsWith("k")) {
- text = text.substring(0, text.length - 1)
- 1_000
- } else if (text.endsWith("m")) {
- text = text.substring(0, text.length - 1)
- 1_000_000
- } else 1
- val d = text.toDouble()
- return (d * multiplier).toLong()
-}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt
index 7f37c6867..23316166f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/ComposterDisplay.kt
@@ -1,24 +1,28 @@
package at.hannibal2.skyhanni.features.garden
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.data.SendTitleHelper
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.TabListUpdateEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
import at.hannibal2.skyhanni.utils.NEUItems
+import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
+import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.regex.Pattern
class ComposterDisplay {
private val config get() = SkyHanniMod.feature.garden
+ private val hidden get() = SkyHanniMod.feature.hidden
private var display = listOf<List<Any>>()
enum class DataType(val pattern: String, val icon: String) {
ORGANIC_MATTER(" Organic Matter: §r(.*)", "WHEAT"),
FUEL(" Fuel: §r(.*)", "OIL_BARREL"),
TIME_LEFT(" Time Left: §r(.*)", "WATCH"),
- STORED_COMPOST(" Stored Compost: §r(.*)", "COMPOST"),
- ;
+ STORED_COMPOST(" Stored Compost: §r(.*)", "COMPOST");
val displayItem by lazy {
NEUItems.getItemStack(icon)
@@ -71,6 +75,36 @@ class ComposterDisplay {
newList.add(DataType.STORED_COMPOST.addToList(data))
display = newList
+
+ notify(data)
+ }
+
+ private fun notify(data: MutableMap<DataType, String>) {
+ if (!config.composterNotifyLowEnabled) return
+
+ data[DataType.ORGANIC_MATTER]?.removeColor()?.formatNumber()?.let {
+ if (it <= config.composterNotifyLowOrganicMatter) {
+ if (System.currentTimeMillis() >= hidden.informedAboutLowMatter) {
+ if (config.composterNotifyLowTitle) {
+ SendTitleHelper.sendTitle("§cYour Organic Matter is low", 4_000)
+ }
+ LorenzUtils.chat("§e[SkyHanni] §cYour Organic Matter is low!")
+ hidden.informedAboutLowMatter = System.currentTimeMillis() + 30_000
+ }
+ }
+ }
+
+ data[DataType.FUEL]?.removeColor()?.formatNumber()?.let {
+ if (it <= config.composterNotifyLowFuel &&
+ System.currentTimeMillis() >= hidden.informedAboutLowFuel
+ ) {
+ if (config.composterNotifyLowTitle) {
+ SendTitleHelper.sendTitle("§cYour Fuel is low", 4_000)
+ }
+ LorenzUtils.chat("§e[SkyHanni] §cYour Fuel is low!")
+ hidden.informedAboutLowFuel = System.currentTimeMillis() + 30_000
+ }
+ }
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
index a3c86c0f4..0d09ea81d 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
@@ -177,4 +177,17 @@ object NumberUtil {
else -> LorenzColor.RED
}
}
+
+ fun String.formatNumber(): Long {
+ var text = replace(",", "")
+ val multiplier = if (text.endsWith("k")) {
+ text = text.substring(0, text.length - 1)
+ 1_000
+ } else if (text.endsWith("m")) {
+ text = text.substring(0, text.length - 1)
+ 1_000_000
+ } else 1
+ val d = text.toDouble()
+ return (d * multiplier).toLong()
+ }
} \ No newline at end of file