aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--FEATURES.md1
-rw-r--r--build.gradle.kts2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt61
6 files changed, 71 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 153080c87..dc8edcaf6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
## Version 0.12.2
### Changes
++ Add Bonzo's Mask highlight timer
+ Made the config button in the forge mod list work.
+ Blaze slayer pillar warning text is now much bigger.
+ Hides the new 'you earn x event exp' message.
diff --git a/FEATURES.md b/FEATURES.md
index f03cb949e..6d62f009f 100644
--- a/FEATURES.md
+++ b/FEATURES.md
@@ -50,6 +50,7 @@
+ Show the amount of selected tuning points in the stats tuning inventory.
+ Highlight the selected template in the stats tuning inventory.
+ Show the type of stats for the tuning point templates.
++ Highlight depleted Bonzo's Masks in your inventory.
## Item Abilities
- Show the cooldown of items in the inventory.
diff --git a/build.gradle.kts b/build.gradle.kts
index 943d2c94a..81ccfe0ab 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -62,7 +62,7 @@ dependencies {
// If you don't want to log in with your real minecraft account, remove this line
modRuntimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.0")
- devenvMod("com.github.romangraef:notenoughupdates:b3e3583:all")
+ devenvMod("com.github.notenoughupdates:notenoughupdates:5a354b5:all")
}
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index 47122a9dc..de9d1c2e0 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -163,6 +163,7 @@ public class SkyHanniMod {
registerEvent(new GriffinBurrowHelper());
registerEvent(new GriffinBurrowParticleFinder());
registerEvent(new BurrowWarpHelper());
+ registerEvent(new HighlightBonzoMasks());
Commands.INSTANCE.init();
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
index 780db21e1..290492705 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/Inventory.java
@@ -115,4 +115,10 @@ public class Inventory {
desc = "Show a compact star count in the item name for all items")
@ConfigEditorBoolean
public boolean itemStars = false;
+
+ @Expose
+ @ConfigOption(name = "Highlight Depleted Bonzo's Masks",
+ desc = "Highlights used Bonzo's Masks with a background")
+ @ConfigEditorBoolean
+ public boolean highlightDepletedBonzosMasks = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt
new file mode 100644
index 000000000..371c0578d
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HighlightBonzoMasks.kt
@@ -0,0 +1,61 @@
+package at.hannibal2.skyhanni.features.inventory
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName
+import at.hannibal2.skyhanni.utils.RenderUtils.highlight
+import at.hannibal2.skyhanni.utils.RenderUtils.interpolate
+import net.minecraftforge.client.event.ClientChatReceivedEvent
+import net.minecraftforge.event.world.WorldEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.awt.Color
+import kotlin.time.Duration.Companion.seconds
+import kotlin.time.DurationUnit
+import kotlin.time.ExperimentalTime
+import kotlin.time.TimeMark
+import kotlin.time.TimeSource
+
+/**
+ * @author Linnea Gräf
+ */
+@OptIn(ExperimentalTime::class)
+class HighlightBonzoMasks {
+
+ val bonzoMaskTimers = mutableMapOf<String, TimeMark>()
+
+ // Technically this timer is overestimating since the cooldown is affected by mage level, however I do not care.
+ val bonzoMaskCooldown = 360.seconds
+ val bonzoMaskMessage = "Your (.*Bonzo's Mask) saved your life!".toRegex()
+
+ val greenHue = Color.RGBtoHSB(0, 255, 0, null)[0].toDouble()
+ val redHue = Color.RGBtoHSB(255, 0, 0, null)[0].toDouble()
+
+ @SubscribeEvent
+ fun onBackgroundDrawn(event: GuiContainerEvent.BackgroundDrawnEvent) {
+ if (!SkyHanniMod.feature.inventory.highlightDepletedBonzosMasks) return
+ for (slot in event.gui.inventorySlots.inventorySlots) {
+ val item = slot.stack ?: continue
+ val internalName = item.getInternalName()
+ if (!internalName.endsWith("BONZO_MASK")) continue
+ val timer = bonzoMaskTimers[internalName] ?: continue
+ if (timer.elapsedNow() < bonzoMaskCooldown) {
+ val progress =
+ timer.elapsedNow().toDouble(DurationUnit.SECONDS) / bonzoMaskCooldown.toDouble(DurationUnit.SECONDS)
+ val hue = interpolate(greenHue, redHue, progress.toFloat())
+ slot.highlight(Color(Color.HSBtoRGB(hue.toFloat(), 1F, 1F)))
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onChatReceived(event: ClientChatReceivedEvent) {
+ val match = bonzoMaskMessage.matchEntire(event.message.unformattedText) ?: return
+ val bonzoId = if ("⚚" in match.groupValues[1]) "STARRED_BONZO_MASK" else "BONZO_MASK"
+ bonzoMaskTimers[bonzoId] = TimeSource.Monotonic.markNow()
+ }
+
+ @SubscribeEvent
+ fun onJoinWorld(ignored: WorldEvent.Load) {
+ bonzoMaskTimers.clear()
+ }
+} \ No newline at end of file