Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: simple ferocity display #1765

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -683,6 +684,7 @@ class SkyHanniMod {
loadModule(FireVeilWandParticles())
loadModule(HideMobNames())
loadModule(HideDamageSplash())
loadModule(FerocityDisplay())
loadModule(InGameDateDisplay())
loadModule(ThunderSparksHighlight())
loadModule(BlazeSlayerDaggerHelper())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public class CombatConfig {
@Accordion
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
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
@@ -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
}
Loading