aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
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
-class BurrowWarpHelper {
+@SkyHanniModule
+object BurrowWarpHelper {
+
+ private val config get() = SkyHanniMod.feature.event.diana
+ var currentWarp: WarpPoint? = null
private var lastWarpTime = SimpleTimeMark.farPast()
private var lastWarp: WarpPoint? = null
@@ -90,37 +95,31 @@ class BurrowWarpHelper {
event.addData(list)
}
- companion object {
-
- private val config get() = SkyHanniMod.feature.event.diana
- var currentWarp: WarpPoint? = null
-
- fun shouldUseWarps(target: LorenzVec, debug: MutableList<String>? = null) {
- debug?.add("target: ${target.printWithAccuracy(1)}")
- val playerLocation = LocationUtils.playerLocation()
- debug?.add("playerLocation: ${playerLocation.printWithAccuracy(1)}")
- val warpPoint = getNearestWarpPoint(target)
- debug?.add("warpPoint: ${warpPoint.displayName}")
-
- val playerDistance = playerLocation.distance(target)
- debug?.add("playerDistance: ${playerDistance.round(1)}")
- val warpDistance = warpPoint.distance(target)
- debug?.add("warpDistance: ${warpDistance.round(1)}")
- val difference = playerDistance - warpDistance
- debug?.add("difference: ${difference.round(1)}")
- val setWarpPoint = difference > 10
- debug?.add("setWarpPoint: $setWarpPoint")
- currentWarp = if (setWarpPoint) warpPoint else null
- }
+ fun shouldUseWarps(target: LorenzVec, debug: MutableList<String>? = null) {
+ debug?.add("target: ${target.printWithAccuracy(1)}")
+ val playerLocation = LocationUtils.playerLocation()
+ debug?.add("playerLocation: ${playerLocation.printWithAccuracy(1)}")
+ val warpPoint = getNearestWarpPoint(target)
+ debug?.add("warpPoint: ${warpPoint.displayName}")
+
+ val playerDistance = playerLocation.distance(target)
+ debug?.add("playerDistance: ${playerDistance.round(1)}")
+ val warpDistance = warpPoint.distance(target)
+ debug?.add("warpDistance: ${warpDistance.round(1)}")
+ val difference = playerDistance - warpDistance
+ debug?.add("difference: ${difference.round(1)}")
+ val setWarpPoint = difference > 10
+ debug?.add("setWarpPoint: $setWarpPoint")
+ currentWarp = if (setWarpPoint) warpPoint else null
+ }
- private fun getNearestWarpPoint(location: LorenzVec) =
- WarpPoint.entries.filter { it.unlocked && !it.ignored() }.map { it to it.distance(location) }
- .sorted().first().first
+ private fun getNearestWarpPoint(location: LorenzVec) =
+ WarpPoint.entries.filter { it.unlocked && !it.ignored() }.map { it to it.distance(location) }
+ .sorted().first().first
- fun resetDisabledWarps() {
- WarpPoint.entries.forEach { it.unlocked = true }
- ChatUtils.chat("Reset disabled burrow warps.")
- }
+ fun resetDisabledWarps() {
+ WarpPoint.entries.forEach { it.unlocked = true }
+ ChatUtils.chat("Reset disabled burrow warps.")
}
enum class WarpPoint(
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt
index 05e2b518a..f0601c557 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt
@@ -27,6 +27,7 @@ import at.hannibal2.skyhanni.events.GuiPositionMovedEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.utils.ChatUtils
import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle
import at.hannibal2.skyhanni.utils.DelayedRun.runDelayed
@@ -45,7 +46,8 @@ import kotlin.time.Duration.Companion.seconds
typealias ScoreboardElementType = Pair<String, HorizontalAlignment>
-class CustomScoreboard {
+@SkyHanniModule
+object CustomScoreboard {
private var display = emptyList<ScoreboardElementType>()
private var cache = emptyList<ScoreboardElementType>()
@@ -102,18 +104,16 @@ class CustomScoreboard {
UnknownLinesHandler.handleUnknownLines()
}
- companion object {
- internal val config get() = SkyHanniMod.feature.gui.customScoreboard
- internal val displayConfig get() = config.display
- internal val alignmentConfig get() = displayConfig.alignment
- internal val arrowConfig get() = displayConfig.arrow
- internal val eventsConfig get() = displayConfig.events
- internal val mayorConfig get() = displayConfig.mayor
- internal val partyConfig get() = displayConfig.party
- internal val maxwellConfig get() = displayConfig.maxwell
- internal val informationFilteringConfig get() = config.informationFiltering
- internal val backgroundConfig get() = config.background
- }
+ internal val config get() = SkyHanniMod.feature.gui.customScoreboard
+ internal val displayConfig get() = config.display
+ internal val alignmentConfig get() = displayConfig.alignment
+ internal val arrowConfig get() = displayConfig.arrow
+ internal val eventsConfig get() = displayConfig.events
+ internal val mayorConfig get() = displayConfig.mayor
+ internal val partyConfig get() = displayConfig.party
+ internal val maxwellConfig get() = displayConfig.maxwell
+ internal val informationFilteringConfig get() = config.informationFiltering
+ internal val backgroundConfig get() = config.background
private fun createLines() = buildList<ScoreboardElementType> {
for (element in config.scoreboardEntries) {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt
index cf6840f48..8aae8fe55 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt
@@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.config.features.gui.customscoreboard.DisplayConfig
import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.features.bingo.BingoAPI
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.displayConfig
+import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.displayConfig
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.formatDouble
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt
index a55cf8b65..3d4e6daad 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/RenderBackground.kt
@@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard
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.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.RenderUtils
import io.github.moulberry.notenoughupdates.util.Utils
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
index ef02cf2ba..467f752da 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
@@ -17,13 +17,13 @@ import at.hannibal2.skyhanni.data.QuiverAPI.asArrowPercentage
import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.data.SlayerAPI
import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.arrowConfig
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.config
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.displayConfig
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.informationFilteringConfig
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.maxwellConfig
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.mayorConfig
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.partyConfig
+import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.arrowConfig
+import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.config
+import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.displayConfig
+import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.informationFilteringConfig
+import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.maxwellConfig
+import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.mayorConfig
+import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.partyConfig
import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils.formatNum
import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils.getGroupFromPattern
import at.hannibal2.skyhanni.test.command.ErrorManager
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt
index 3e7fe1577..f8e7313d1 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardEvents.kt
@@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.ScoreboardData
import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
-import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.Companion.eventsConfig
+import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.eventsConfig
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardEvents.VOTING
import at.hannibal2.skyhanni.features.gui.customscoreboard.ScoreboardPattern
import at.hannibal2.skyhanni.features.misc.ServerRestartTitle
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt
index 8651d90c7..e463549bc 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MarkedPlayerManager.kt
@@ -19,6 +19,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@SkyHanniModule
object MarkedPlayerManager {
+
val config get() = SkyHanniMod.feature.gui.markedPlayers
private val playerNamesToMark = mutableListOf<String>()
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt
index eb7456b4c..ba8efc2b5 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderLivingEntityHelper.kt
@@ -1,75 +1,76 @@
package at.hannibal2.skyhanni.mixins.hooks
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.SkyHanniDebugsAndTests
import net.minecraft.entity.EntityLivingBase
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-class RenderLivingEntityHelper {
+@SkyHanniModule
+object RenderLivingEntityHelper {
+
+ private val entityColorMap = mutableMapOf<EntityLivingBase, Int>()
+ private val entityColorCondition = mutableMapOf<EntityLivingBase, () -> Boolean>()
+
+ private val entityNoHurtTimeCondition = mutableMapOf<EntityLivingBase, () -> Boolean>()
@SubscribeEvent
fun onWorldChange(event: LorenzWorldChangeEvent) {
entityColorMap.clear()
entityColorCondition.clear()
- entityNoHurTimeCondition.clear()
+ entityNoHurtTimeCondition.clear()
}
- companion object {
-
- private val entityColorMap = mutableMapOf<EntityLivingBase, Int>()
- private val entityColorCondition = mutableMapOf<EntityLivingBase, () -> Boolean>()
-
- private val entityNoHurTimeCondition = mutableMapOf<EntityLivingBase, () -> Boolean>()
-
- fun <T : EntityLivingBase> removeEntityColor(entity: T) {
- entityColorMap.remove(entity)
- entityColorCondition.remove(entity)
- }
+ fun <T : EntityLivingBase> removeEntityColor(entity: T) {
+ entityColorMap.remove(entity)
+ entityColorCondition.remove(entity)
+ }
- fun <T : EntityLivingBase> setEntityColor(entity: T, color: Int, condition: () -> Boolean) {
- entityColorMap[entity] = color
- entityColorCondition[entity] = condition
- }
+ fun <T : EntityLivingBase> setEntityColor(entity: T, color: Int, condition: () -> Boolean) {
+ entityColorMap[entity] = color
+ entityColorCondition[entity] = condition
+ }
- fun <T : EntityLivingBase> setNoHurtTime(entity: T, condition: () -> Boolean) {
- entityNoHurTimeCondition[entity] = condition
- }
+ fun <T : EntityLivingBase> setNoHurtTime(entity: T, condition: () -> Boolean) {
+ entityNoHurtTimeCondition[entity] = condition
+ }
- fun <T : EntityLivingBase> setEntityColorWithNoHurtTime(entity: T, color: Int, condition: () -> Boolean) {
- setEntityColor(entity, color, condition)
- setNoHurtTime(entity, condition)
- }
+ fun <T : EntityLivingBase> setEntityColorWithNoHurtTime(entity: T, color: Int, condition: () -> Boolean) {
+ setEntityColor(entity, color, condition)
+ setNoHurtTime(entity, condition)
+ }
- fun <T : EntityLivingBase> removeNoHurtTime(entity: T) {
- entityNoHurTimeCondition.remove(entity)
- }
+ fun <T : EntityLivingBase> removeNoHurtTime(entity: T) {
+ entityNoHurtTimeCondition.remove(entity)
+ }
- fun <T : EntityLivingBase> removeCustomRender(entity: T) {
- removeEntityColor(entity)
- removeNoHurtTime(entity)
- }
+ fun <T : EntityLivingBase> removeCustomRender(entity: T) {
+ removeEntityColor(entity)
+ removeNoHurtTime(entity)
+ }
- fun <T : EntityLivingBase> internalSetColorMultiplier(entity: T): Int {
- if (!SkyHanniDebugsAndTests.globalRender) return 0
- if (entityColorMap.containsKey(entity)) {
- val condition = entityColorCondition[entity]!!
- if (condition.invoke()) {
- return entityColorMap[entity]!!
- }
+ @JvmStatic
+ fun <T : EntityLivingBase> internalSetColorMultiplier(entity: T): Int {
+ if (!SkyHanniDebugsAndTests.globalRender) return 0
+ if (entityColorMap.containsKey(entity)) {
+ val condition = entityColorCondition[entity]!!
+ if (condition.invoke()) {
+ return entityColorMap[entity]!!
}
- return 0
}
+ return 0
+ }
- fun <T : EntityLivingBase> internalChangeHurtTime(entity: T): Int {
- if (!SkyHanniDebugsAndTests.globalRender) return entity.hurtTime
- run {
- val condition = entityNoHurTimeCondition[entity] ?: return@run
- if (condition.invoke()) {
- return 0
- }
+ @JvmStatic
+ fun <T : EntityLivingBase> internalChangeHurtTime(entity: T): Int {
+ if (!SkyHanniDebugsAndTests.globalRender) return entity.hurtTime
+ run {
+ val condition = entityNoHurtTimeCondition[entity] ?: return@run
+ if (condition.invoke()) {
+ return 0
}
- return entity.hurtTime
}
+ return entity.hurtTime
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java
index f23b290f1..5ef136e3f 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinRendererLivingEntity.java
@@ -23,12 +23,12 @@ public abstract class MixinRendererLivingEntity<T extends EntityLivingBase> exte
@Inject(method = "getColorMultiplier", at = @At("HEAD"), cancellable = true)
private void setColorMultiplier(T entity, float lightBrightness, float partialTickTime, CallbackInfoReturnable<Integer> cir) {
- cir.setReturnValue(RenderLivingEntityHelper.Companion.internalSetColorMultiplier(entity));
+ cir.setReturnValue(RenderLivingEntityHelper.internalSetColorMultiplier(entity));
}
@Redirect(method = "setBrightness", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/EntityLivingBase;hurtTime:I", opcode = Opcodes.GETFIELD))
private int changeHurtTime(EntityLivingBase entity) {
- return RenderLivingEntityHelper.Companion.internalChangeHurtTime(entity);
+ return RenderLivingEntityHelper.internalChangeHurtTime(entity);
}
@Inject(method = "renderLayers", at = @At("HEAD"), cancellable = true)
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index dbbc553e7..40e8ddab9 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -2,9 +2,9 @@ package at.hannibal2.skyhanni.utils
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.model.Graph
import at.hannibal2.skyhanni.data.model.toPositionsList
import at.hannibal2.skyhanni.events.GuiContainerEvent