aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-05-13 12:00:18 +0200
committerGitHub <noreply@github.com>2024-05-13 12:00:18 +0200
commit4fe2010286136dc4192234c404f19fc720503765 (patch)
tree55d31463691f447deb69273340cf46e9e92b04fb /src/main/java
parentda3c40aa2c9826ccda25b79f32449233981f9bfe (diff)
downloadskyhanni-4fe2010286136dc4192234c404f19fc720503765.tar.gz
skyhanni-4fe2010286136dc4192234c404f19fc720503765.tar.bz2
skyhanni-4fe2010286136dc4192234c404f19fc720503765.zip
Feature: simple ferocity display (#1765)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/combat/FerocityDisplayConfig.java25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt45
4 files changed, 77 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 986e7605d..fb0b49742 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -88,6 +88,7 @@ import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatFilter
import at.hannibal2.skyhanni.features.chat.playerchat.PlayerChatModifier
import at.hannibal2.skyhanni.features.chroma.ChromaManager
import at.hannibal2.skyhanni.features.combat.BestiaryData
+import at.hannibal2.skyhanni.features.combat.FerocityDisplay
import at.hannibal2.skyhanni.features.combat.HideDamageSplash
import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.features.combat.endernodetracker.EnderNodeTracker
@@ -684,6 +685,7 @@ class SkyHanniMod {
loadModule(FireVeilWandParticles())
loadModule(HideMobNames())
loadModule(HideDamageSplash())
+ loadModule(FerocityDisplay())
loadModule(InGameDateDisplay())
loadModule(ThunderSparksHighlight())
loadModule(BlazeSlayerDaggerHelper())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java
index 0504a918d..bf8e795d7 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/CombatConfig.java
@@ -45,6 +45,11 @@ public class CombatConfig {
public EnderNodeConfig enderNodeTracker = new EnderNodeConfig();
@Expose
+ @ConfigOption(name = "Ferocity Display", desc = "")
+ @Accordion
+ public FerocityDisplayConfig ferocityDisplay = new FerocityDisplayConfig();
+
+ @Expose
@ConfigOption(name = "Hide Damage Splash", desc = "Hide all damage splashes anywhere in SkyBlock.")
@ConfigEditorBoolean
@FeatureToggle
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/FerocityDisplayConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/FerocityDisplayConfig.java
new file mode 100644
index 000000000..42c8bb9a6
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/FerocityDisplayConfig.java
@@ -0,0 +1,25 @@
+package at.hannibal2.skyhanni.config.features.combat;
+
+import at.hannibal2.skyhanni.config.FeatureToggle;
+import at.hannibal2.skyhanni.config.core.config.Position;
+import com.google.gson.annotations.Expose;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigLink;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
+
+public class FerocityDisplayConfig {
+
+ @Expose
+ @ConfigOption(
+ name = "Enabled",
+ desc = "Show ferocity stat as single gui element. " +
+ "Requires tab list widget enabled and ferocity selected to work."
+ )
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean enabled = false;
+
+ @Expose
+ @ConfigLink(owner = FerocityDisplayConfig.class, field = "enabled")
+ public Position position = new Position(10, 80, false, true);
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt
new file mode 100644
index 000000000..c589922cf
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt
@@ -0,0 +1,45 @@
+package at.hannibal2.skyhanni.features.combat
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.events.TabListUpdateEvent
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.RenderUtils.renderString
+import at.hannibal2.skyhanni.utils.StringUtils.matchFirst
+import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class FerocityDisplay {
+ private val config get() = SkyHanniMod.feature.combat.ferocityDisplay
+
+ /**
+ * REGEX-TEST: Ferocity: §r§c⫽14
+ */
+ private val ferocityPattern by RepoPattern.pattern(
+ "combat.ferocity.tab",
+ " Ferocity: §r§c⫽(?<stat>.*)"
+ )
+
+ private var display = ""
+
+ @SubscribeEvent
+ fun onTabListUpdate(event: TabListUpdateEvent) {
+ if (!isEnabled()) return
+ display = ""
+ val stat = event.tabList.matchFirst(ferocityPattern) {
+ group("stat")
+ } ?: return
+
+ display = "§c⫽$stat"
+
+ }
+
+ @SubscribeEvent
+ fun onRenderOverlay(event: GuiRenderEvent) {
+ if (!isEnabled()) return
+
+ config.position.renderString(display, posLabel = "Ferocity Display")
+ }
+
+ fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled
+}