summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-06-08 23:46:53 +1000
committerGitHub <noreply@github.com>2024-06-08 23:46:53 +1000
commita2f29b2bfe846c9d0cd2a45b2b8352bab556da37 (patch)
tree53f830999399a1d005e16a53beec041337629285 /src/main/java
parentf5aa000de598fd4f367ca37cb8f2e1935f64b634 (diff)
downloadskyhanni-a2f29b2bfe846c9d0cd2a45b2b8352bab556da37.tar.gz
skyhanni-a2f29b2bfe846c9d0cd2a45b2b8352bab556da37.tar.bz2
skyhanni-a2f29b2bfe846c9d0cd2a45b2b8352bab556da37.zip
Even more annotation (#2031)
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt113
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt105
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt53
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt107
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt63
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt59
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt95
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt6
17 files changed, 329 insertions, 349 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 85e1d1452..dde349f04 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -6,10 +6,8 @@ import at.hannibal2.skyhanni.config.ConfigManager
import at.hannibal2.skyhanni.config.Features
import at.hannibal2.skyhanni.config.SackData
import at.hannibal2.skyhanni.config.commands.Commands
-import at.hannibal2.skyhanni.data.GuiEditManager
import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.OtherInventoryData
-import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.data.SkillExperience
import at.hannibal2.skyhanni.data.jsonobjects.local.FriendsJson
import at.hannibal2.skyhanni.data.jsonobjects.local.JacobContestsJson
@@ -18,16 +16,10 @@ import at.hannibal2.skyhanni.data.jsonobjects.local.VisualWordsJson
import at.hannibal2.skyhanni.data.repo.RepoManager
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.utils.PreInitFinishedEvent
-import at.hannibal2.skyhanni.features.bingo.card.BingoCardDisplay
-import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.BingoNextStepHelper
import at.hannibal2.skyhanni.features.chat.Translator
-import at.hannibal2.skyhanni.features.combat.damageindicator.DamageIndicatorManager
-import at.hannibal2.skyhanni.features.event.diana.BurrowWarpHelper
import at.hannibal2.skyhanni.features.garden.farming.FarmingWeightDisplay
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard
import at.hannibal2.skyhanni.features.misc.CollectionTracker
import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper
-import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
import at.hannibal2.skyhanni.skyhannimodule.LoadedModules
import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests
import at.hannibal2.skyhanni.test.command.ErrorManager
@@ -71,21 +63,13 @@ class SkyHanniMod {
// data
loadModule(HypixelData())
- loadModule(ScoreboardData())
- loadModule(RenderLivingEntityHelper())
loadModule(SkillExperience())
- loadModule(GuiEditManager())
// features
- loadModule(DamageIndicatorManager())
- loadModule(BurrowWarpHelper())
loadModule(CollectionTracker())
loadModule(CrimsonIsleReputationHelper(this))
- loadModule(BingoCardDisplay())
- loadModule(BingoNextStepHelper())
loadModule(FarmingWeightDisplay())
loadModule(Translator())
- loadModule(CustomScoreboard())
// test stuff
loadModule(SkyHanniDebugsAndTests())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
index 4378fe36e..e0e8c28a5 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/core/config/gui/GuiPositionEditor.kt
@@ -20,9 +20,9 @@ package at.hannibal2.skyhanni.config.core.config.gui
import at.hannibal2.skyhanni.config.core.config.Position
import at.hannibal2.skyhanni.data.GuiEditManager
-import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsX
-import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getAbsY
-import at.hannibal2.skyhanni.data.GuiEditManager.Companion.getDummySize
+import at.hannibal2.skyhanni.data.GuiEditManager.getAbsX
+import at.hannibal2.skyhanni.data.GuiEditManager.getAbsY
+import at.hannibal2.skyhanni.data.GuiEditManager.getDummySize
import at.hannibal2.skyhanni.data.OtherInventoryData
import at.hannibal2.skyhanni.mixins.transformers.gui.AccessorGuiContainer
import at.hannibal2.skyhanni.utils.GuiRenderUtils
diff --git a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt
index 38da02e08..9f249ee7a 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/GuiEditManager.kt
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.events.GuiPositionMovedEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isRancherSign
@@ -31,10 +32,15 @@ import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds
-class GuiEditManager {
+@SkyHanniModule
+object GuiEditManager {
private var lastHotkeyPressed = SimpleTimeMark.farPast()
+ private var currentPositions = TimeLimitedCache<String, Position>(15.seconds)
+ private var currentBorderSize = mutableMapOf<String, Pair<Int, Int>>()
+ private var lastMovedGui: String? = null
+
@SubscribeEvent
fun onKeyClick(event: LorenzKeyPressEvent) {
if (event.keyCode != SkyHanniMod.feature.gui.keyBindOpen) return
@@ -71,77 +77,70 @@ class GuiEditManager {
}
}
- companion object {
-
- private var currentPositions = TimeLimitedCache<String, Position>(15.seconds)
- private var currentBorderSize = mutableMapOf<String, Pair<Int, Int>>()
- private var lastMovedGui: String? = null
-
- @JvmStatic
- fun add(position: Position, posLabel: String, x: Int, y: Int) {
- var name = position.internalName
- if (name == null) {
- name = if (posLabel == "none") "none " + UUID.randomUUID() else posLabel
- position.internalName = name
- }
- currentPositions[name] = position
- currentBorderSize[posLabel] = Pair(x, y)
+ @JvmStatic
+ fun add(position: Position, posLabel: String, x: Int, y: Int) {
+ var name = position.internalName
+ if (name == null) {
+ name = if (posLabel == "none") "none " + UUID.randomUUID() else posLabel
+ position.internalName = name
}
+ currentPositions[name] = position
+ currentBorderSize[posLabel] = Pair(x, y)
+ }
- private var lastHotkeyReminded = SimpleTimeMark.farPast()
-
- @JvmStatic
- fun openGuiPositionEditor(hotkeyReminder: Boolean) {
- SkyHanniMod.screenToOpen = GuiPositionEditor(
- currentPositions.values().toList(),
- 2,
- Minecraft.getMinecraft().currentScreen as? GuiContainer
+ private var lastHotkeyReminded = SimpleTimeMark.farPast()
+
+ @JvmStatic
+ fun openGuiPositionEditor(hotkeyReminder: Boolean) {
+ SkyHanniMod.screenToOpen = GuiPositionEditor(
+ currentPositions.values().toList(),
+ 2,
+ Minecraft.getMinecraft().currentScreen as? GuiContainer
+ )
+ if (hotkeyReminder && lastHotkeyReminded.passedSince() > 30.minutes) {
+ lastHotkeyReminded = SimpleTimeMark.now()
+ ChatUtils.chat(
+ "§eTo edit hidden GUI elements:\n" +
+ " §7- §e1. Set a key in /sh edit.\n" +
+ " §7- §e2. Click that key while the GUI element is visible."
)
- if (hotkeyReminder && lastHotkeyReminded.passedSince() > 30.minutes) {
- lastHotkeyReminded = SimpleTimeMark.now()
- ChatUtils.chat(
- "§eTo edit hidden GUI elements:\n" +
- " §7- §e1. Set a key in /sh edit.\n" +
- " §7- §e2. Click that key while the GUI element is visible."
- )
- }
}
+ }
- @JvmStatic
- fun renderLast() {
- if (!isInGui()) return
- if (!SkyHanniDebugsAndTests.globalRender) return
+ @JvmStatic
+ fun renderLast() {
+ if (!isInGui()) return
+ if (!SkyHanniDebugsAndTests.globalRender) return
- GlStateManager.translate(0f, 0f, 200f)
+ GlStateManager.translate(0f, 0f, 200f)
- GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch()
+ GuiRenderEvent.GuiOverlayRenderEvent().postAndCatch()
- GlStateManager.pushMatrix()
- GlStateManager.enableDepth()
- GuiRenderEvent.ChestGuiOverlayRenderEvent().postAndCatch()
- GlStateManager.popMatrix()
+ GlStateManager.pushMatrix()
+ GlStateManager.enableDepth()
+ GuiRenderEvent.ChestGuiOverlayRenderEvent().postAndCatch()
+ GlStateManager.popMatrix()
- GlStateManager.translate(0f, 0f, -200f)
- }
+ GlStateManager.translate(0f, 0f, -200f)
+ }
- fun isInGui() = Minecraft.getMinecraft().currentScreen is GuiPositionEditor
+ fun isInGui() = Minecraft.getMinecraft().currentScreen is GuiPositionEditor
- fun Position.getDummySize(random: Boolean = false): Vector2i {
- if (random) return Vector2i(5, 5)
- val (x, y) = currentBorderSize[internalName] ?: return Vector2i(1, 1)
- return Vector2i((x * effectiveScale).toInt(), (y * effectiveScale).toInt())
- }
+ fun Position.getDummySize(random: Boolean = false): Vector2i {
+ if (random) return Vector2i(5, 5)
+ val (x, y) = currentBorderSize[internalName] ?: return Vector2i(1, 1)
+ return Vector2i((x * effectiveScale).toInt(), (y * effectiveScale).toInt())
+ }
- fun Position.getAbsX() = getAbsX0(getDummySize(true).x)
+ fun Position.getAbsX() = getAbsX0(getDummySize(true).x)
- fun Position.getAbsY() = getAbsY0(getDummySize(true).y)
+ fun Position.getAbsY() = getAbsY0(getDummySize(true).y)
- fun GuiProfileViewer.anyTextBoxFocused() =
- this.getPropertiesWithType<GuiElementTextField>().any { it.focus }
+ fun GuiProfileViewer.anyTextBoxFocused() =
+ this.getPropertiesWithType<GuiElementTextField>().any { it.focus }
- fun handleGuiPositionMoved(guiName: String) {
- lastMovedGui = guiName
- }
+ fun handleGuiPositionMoved(guiName: String) {
+ lastMovedGui = guiName
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
index a69210f6d..72abf6bab 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.ScoreboardChangeEvent
import at.hannibal2.skyhanni.events.ScoreboardRawChangeEvent
import at.hannibal2.skyhanni.events.minecraft.packet.PacketReceivedEvent
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import net.minecraft.client.Minecraft
import net.minecraft.network.play.server.S3CPacketUpdateScore
@@ -14,63 +15,42 @@ import net.minecraft.scoreboard.ScorePlayerTeam
import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-class ScoreboardData {
-
- companion object {
-
- private val minecraftColorCodesPattern = "(?i)[0-9a-fkmolnr]".toPattern()
-
- // TODO USE SH-REPO
- private val splitIcons = listOf(
- "\uD83C\uDF6B",
- "\uD83D\uDCA3",
- "\uD83D\uDC7D",
- "\uD83D\uDD2E",
- "\uD83D\uDC0D",
- "\uD83D\uDC7E",
- "\uD83C\uDF20",
- "\uD83C\uDF6D",
- "⚽",
- "\uD83C\uDFC0",
- "\uD83D\uDC79",
- "\uD83C\uDF81",
- "\uD83C\uDF89",
- "\uD83C\uDF82",
- "\uD83D\uDD2B",
- )
-
- fun formatLines(rawList: List<String>): List<String> {
- val list = mutableListOf<String>()
- for (line in rawList) {
- val separator = splitIcons.find { line.contains(it) } ?: continue
- val split = line.split(separator)
- val start = split[0]
- var end = split[1]
- // get last color code in start
- val lastColorIndex = start.lastIndexOf('§')
- val lastColor = if (lastColorIndex != -1
- && lastColorIndex + 1 < start.length
- && (minecraftColorCodesPattern.matches(start[lastColorIndex + 1].toString()))
- ) start.substring(lastColorIndex, lastColorIndex + 2)
- else ""
-
- // remove first color code from end, when it is the same as the last color code in start
- end = end.removePrefix(lastColor)
-
- list.add(start + end)
- }
+@SkyHanniModule
+object ScoreboardData {
- return list
- }
+ var sidebarLinesFormatted: List<String> = emptyList()
- var sidebarLinesFormatted: List<String> = emptyList()
+ private var sidebarLines: List<String> = emptyList() // TODO rename to raw
+ var sidebarLinesRaw: List<String> = emptyList() // TODO delete
+ var objectiveTitle = ""
- var sidebarLines: List<String> = emptyList() // TODO rename to raw
- var sidebarLinesRaw: List<String> = emptyList() // TODO delete
- var objectiveTitle = ""
- }
+ private var dirty = false
+
+ private val minecraftColorCodesPattern = "(?i)[0-9a-fkmolnr]".toPattern()
+
+ fun formatLines(rawList: List<String>): List<String> {
+ val list = mutableListOf<String>()
+ for (line in rawList) {
+ val separator = splitIcons.find { line.contains(it) } ?: continue
+ val split = line.split(separator)
+ val start = split[0]
+ var end = split[1]
+ // get last color code in start
+ val lastColorIndex = start.lastIndexOf('§')
+ val lastColor = if (lastColorIndex != -1
+ && lastColorIndex + 1 < start.length
+ && (minecraftColorCodesPattern.matches(start[lastColorIndex + 1].toString()))
+ ) start.substring(lastColorIndex, lastColorIndex + 2)
+ else ""
- var dirty = false
+ // remove first color code from end, when it is the same as the last color code in start
+ end = end.removePrefix(lastColor)
+
+ list.add(start + end)
+ }
+
+ return list
+ }
@HandleEvent(receiveCancelled = true)
fun onPacketReceive(event: PacketReceivedEvent) {
@@ -127,4 +107,23 @@ class ScoreboardData {
ScorePlayerTeam.formatPlayerName(scoreboard.getPlayersTeam(it.playerName), it.playerName)
}
}
+
+ // TODO USE SH-REPO
+ private val splitIcons = listOf(
+ "\uD83C\uDF6B",
+ "\uD83D\uDCA3",
+ "\uD83D\uDC7D",
+ "\uD83D\uDD2E",
+ "\uD83D\uDC0D",
+ "\uD83D\uDC7E",
+ "\uD83C\uDF20",
+ "\uD83C\uDF6D",
+ "⚽",
+ "\uD83C\uDFC0",
+ "\uD83D\uDC79",
+ "\uD83C\uDF81",
+ "\uD83C\uDF89",
+ "\uD83C\uDF82",
+ "\uD83D\uDD2B",
+ )
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt
index 72d8fb955..94bd4f6dd 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt
@@ -10,6 +10,7 @@ import at.hannibal2.skyhanni.events.bingo.BingoCardUpdateEvent
import at.hannibal2.skyhanni.features.bingo.BingoAPI
import at.hannibal2.skyhanni.features.bingo.card.goals.BingoGoal
import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.BingoNextStepHelper
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle
import at.hannibal2.skyhanni.utils.HypixelCommands
@@ -28,45 +29,43 @@ import net.minecraft.client.gui.inventory.GuiInventory
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.days
-class BingoCardDisplay {
+@SkyHanniModule
+object BingoCardDisplay {
private var display = emptyList<Renderable>()
private var hasHiddenPersonalGoals = false
- companion object {
+ private const val MAX_PERSONAL_GOALS = 20
+ private const val MAX_COMMUNITY_GOALS = 5
- private const val MAX_PERSONAL_GOALS = 20
- private const val MAX_COMMUNITY_GOALS = 5
+ private val config get() = SkyHanniMod.feature.event.bingo.bingoCard
+ private var displayMode = 0
- private val config get() = SkyHanniMod.feature.event.bingo.bingoCard
- private var displayMode = 0
+ fun command() {
+ reload()
+ }
- fun command() {
- reload()
- }
+ private fun reload() {
+ BingoAPI.bingoGoals.clear()
+ }
- private fun reload() {
- BingoAPI.bingoGoals.clear()
+ fun toggleCommand() {
+ if (!LorenzUtils.isBingoProfile) {
+ ChatUtils.userError("This command only works on a bingo profile!")
+ return
}
-
- fun toggleCommand() {
- if (!LorenzUtils.isBingoProfile) {
- ChatUtils.userError("This command only works on a bingo profile!")
- return
- }
- if (!config.enabled) {
- ChatUtils.userError("Bingo Card is disabled in the config!")
- return
- }
- toggleMode()
+ if (!config.enabled) {
+ ChatUtils.userError("Bingo Card is disabled in the config!")
+ return
}
+ toggleMode()
+ }
- private fun toggleMode() {
- displayMode++
- if (displayMode == 3) {
- displayMode = 0
- }
+ private fun toggleMode() {
+ displayMode++
+ if (displayMode == 3) {
+ displayMode = 0
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
index b723a41c0..427fbb902 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/BingoNextStepHelper.kt
@@ -17,6 +17,7 @@ import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.ObtainCrys
import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.PartialProgressItemsStep
import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.ProgressionStep
import at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps.SkillLevelStep
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
import at.hannibal2.skyhanni.utils.InventoryUtils
@@ -29,7 +30,8 @@ import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-class BingoNextStepHelper {
+@SkyHanniModule
+object BingoNextStepHelper {
private val config get() = SkyHanniMod.feature.event.bingo.bingoCard
private var dirty = true
@@ -61,72 +63,69 @@ class BingoNextStepHelper {
private val islands = mutableMapOf<IslandType, IslandVisitStep>()
private val rhysTaskName = "30x Enchanted Minerals (Redstone, Lapis Lazuli, Coal) (for Rhys)"
- companion object {
+ private val finalSteps = mutableListOf<NextStep>()
+ private var currentSteps = emptyList<NextStep>()
+ var currentHelp = emptyList<String>()
- private val finalSteps = mutableListOf<NextStep>()
- private var currentSteps = emptyList<NextStep>()
- var currentHelp = emptyList<String>()
-
- fun command() {
- updateResult(true)
- }
+ fun command() {
+ updateResult(true)
+ }
- private fun updateResult(print: Boolean = false) {
+ private fun updateResult(print: Boolean = false) {
+ if (print) println()
+ currentSteps = listOf()
+ for (step in finalSteps) {
+ printRequirements(step, print)
if (print) println()
- currentSteps = listOf()
- for (step in finalSteps) {
- printRequirements(step, print)
- if (print) println()
- }
-
- currentHelp = drawDisplay(print)
}
- private fun drawDisplay(print: Boolean): MutableList<String> {
- val newCurrentHelp = mutableListOf<String>()
- newCurrentHelp.add("§6Bingo Step Helper:")
+ currentHelp = drawDisplay(print)
+ }
- if (currentSteps.isEmpty()) {
- newCurrentHelp.add("§cOpen the §e/bingo §ccard.")
- }
- for (currentStep in currentSteps) {
- val text = getName(currentStep)
- newCurrentHelp.add(" §7$text")
- if (print) println(text)
- }
- if (print) println()
- return newCurrentHelp
- }
+ private fun drawDisplay(print: Boolean): MutableList<String> {
+ val newCurrentHelp = mutableListOf<String>()
+ newCurrentHelp.add("§6Bingo Step Helper:")
- private fun printRequirements(step: NextStep, print: Boolean, parentDone: Boolean = false, depth: Int = 0) {
- if (print) println(getName(step, parentDone, depth))
- var requirementsToDo = 0
- for (requirement in step.requirements) {
- printRequirements(requirement, print, step.done || parentDone, depth + 1)
- if (!requirement.done) {
- requirementsToDo++
- }
- }
+ if (currentSteps.isEmpty()) {
+ newCurrentHelp.add("§cOpen the §e/bingo §ccard.")
+ }
+ for (currentStep in currentSteps) {
+ val text = getName(currentStep)
+ newCurrentHelp.add(" §7$text")
+ if (print) println(text)
+ }
+ if (print) println()
+ return newCurrentHelp
+ }
- if (!step.done && !parentDone && requirementsToDo == 0 && !currentSteps.contains(step)) {
- currentSteps = currentSteps.editCopy { add(step) }
+ private fun printRequirements(step: NextStep, print: Boolean, parentDone: Boolean = false, depth: Int = 0) {
+ if (print) println(getName(step, parentDone, depth))
+ var requirementsToDo = 0
+ for (requirement in step.requirements) {
+ printRequirements(requirement, print, step.done || parentDone, depth + 1)
+ if (!requirement.done) {
+ requirementsToDo++
}
}
- private fun getName(step: NextStep, parentDone: Boolean = false, depth: Int = 0): String {
- val prefix = " ".repeat(depth) + if (step.done) "[DONE] " else if (parentDone) "[done] " else ""
- val suffix = if (step is ProgressionStep) progressDisplay(step) else ""
- return prefix + step.displayName + suffix
+ if (!step.done && !parentDone && requirementsToDo == 0 && !currentSteps.contains(step)) {
+ currentSteps = currentSteps.editCopy { add(step) }
}
+ }
- private fun progressDisplay(step: ProgressionStep): String {
- val having = step.amountHaving
- return if (having > 0) {
- val needed = step.amountNeeded
- val percentage = LorenzUtils.formatPercentage(having.toDouble() / needed)
- " $percentage (${having.addSeparators()}/${needed.addSeparators()})"
- } else ""
- }
+ private fun getName(step: NextStep, parentDone: Boolean = false, depth: Int = 0): String {
+ val prefix = " ".repeat(depth) + if (step.done) "[DONE] " else if (parentDone) "[done] " else ""
+ val suffix = if (step is ProgressionStep) progressDisplay(step) else ""
+ return prefix + step.displayName + suffix
+ }
+
+ private fun progressDisplay(step: ProgressionStep): String {
+ val having = step.amountHaving
+ return if (having > 0) {
+ val needed = step.amountNeeded
+ val percentage = LorenzUtils.formatPercentage(having.toDouble() / needed)
+ " $percentage (${having.addSeparators()}/${needed.addSeparators()})"
+ } else ""
}
init {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt
index 80b912aa5..33bb20a52 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt
@@ -20,6 +20,7 @@ import at.hannibal2.skyhanni.events.entity.EntityEnterWorldEvent
import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
import at.hannibal2.skyhanni.features.slayer.blaze.HellionShield
import at.hannibal2.skyhanni.features.slayer.blaze.HellionShieldHelper.setHellionShield
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy
import at.hannibal2.skyhanni.utils.CollectionUtils.put
@@ -64,7 +65,8 @@ import kotlin.math.max
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
-class DamageIndicatorManager {
+@SkyHanniModule
+object DamageIndicatorManager {
private var mobFinder: MobFinder? = null
private val maxHealth = mutableMapOf<UUID, Long>()
@@ -72,45 +74,42 @@ class DamageIndicatorManager {
private val enderSlayerHitsNumberPattern = ".* §[5fd]§l(?<hits>\\d+) Hits?".toPattern()
- companion object {
+ private var data = mapOf<UUID, EntityData>()
+ private val damagePattern = "[✧✯]?(\\d+[⚔+✧❤♞☄✷ﬗ✯]*)".toPattern()
- private var data = mapOf<UUID, EntityData>()
- private val damagePattern = "[✧✯]?(\\d+[⚔+✧❤♞☄✷ﬗ✯]*)".toPattern()
+ fun isBoss(entity: EntityLivingBase) = data.values.any { it.entity == entity }
- fun isBoss(entity: EntityLivingBase) = data.values.any { it.entity == entity }
+ fun isDamageSplash(entity: EntityLivingBase): Boolean {
+ if (entity.ticksExisted > 300 || entity !is EntityArmorStand) return false
+ if (!entity.hasCustomName()) return false
+ if (entity.isDead) return false
+ val name = entity.customNameTag.removeColor().replace(",", "")
- fun isDamageSplash(entity: EntityLivingBase): Boolean {
- if (entity.ticksExisted > 300 || entity !is EntityArmorStand) return false
- if (!entity.hasCustomName()) return false
- if (entity.isDead) return false
- val name = entity.customNameTag.removeColor().replace(",", "")
-
- return damagePattern.matcher(name).matches()
- }
+ return damagePattern.matcher(name).matches()
+ }
- fun isBossSpawned(type: BossType) = data.entries.find { it.value.bossType == type } != null
+ fun isBossSpawned(type: BossType) = data.entries.find { it.value.bossType == type } != null
- fun isBossSpawned(vararg types: BossType) = types.any { isBossSpawned(it) }
+ fun isBossSpawned(vararg types: BossType) = types.any { isBossSpawned(it) }
- fun getDistanceTo(vararg types: BossType): Double {
- val playerLocation = LocationUtils.playerLocation()
- return data.values.filter { it.bossType in types }
- .map { it.entity.getLorenzVec().distance(playerLocation) }
- .let { list ->
- if (list.isEmpty()) Double.MAX_VALUE else list.minOf { it }
- }
- }
+ fun getDistanceTo(vararg types: BossType): Double {
+ val playerLocation = LocationUtils.playerLocation()
+ return data.values.filter { it.bossType in types }
+ .map { it.entity.getLorenzVec().distance(playerLocation) }
+ .let { list ->
+ if (list.isEmpty()) Double.MAX_VALUE else list.minOf { it }
+ }
+ }
- fun getNearestDistanceTo(location: LorenzVec): Double {
- return data.values
- .map { it.entity.getLorenzVec() }
- .minOfOrNull { it.distance(location) } ?: Double.MAX_VALUE
- }
+ fun getNearestDistanceTo(location: LorenzVec): Double {
+ return data.values
+ .map { it.entity.getLorenzVec() }
+ .minOfOrNull { it.distance(location) } ?: Double.MAX_VALUE
+ }
- fun removeDamageIndicator(type: BossType) {
- data = data.editCopy {
- values.removeIf { it.bossType == type }
- }
+ fun removeDamageIndicator(type: BossType) {
+ data = data.editCopy {
+ values.removeIf { it.bossType == type }
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
index 11973f2c7..be8d77a6a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/BurrowWarpHelper.kt
@@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.events.DebugDataCollectEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzKeyPressEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.CollectionUtils.sorted
import at.hannibal2.skyhanni.utils.HypixelCommands
@@ -18,7 +19,11 @@ import net.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.time.Duration.Companion.seconds