aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/mining
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-02-10 00:24:52 +0100
committerGitHub <noreply@github.com>2024-02-10 00:24:52 +0100
commit4559e5ff05e19817a21ae49f1c0d8a97d273f6a1 (patch)
treee72dac91d07fc84bea80548c89e13276caa68b81 /src/main/java/at/hannibal2/skyhanni/features/mining
parentd3a7cc4ab970b457b7950489da781539e45e0dce (diff)
downloadskyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.tar.gz
skyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.tar.bz2
skyhanni-4559e5ff05e19817a21ae49f1c0d8a97d273f6a1.zip
Splitting many utils functions from LorenzUtils up into other classes: ChatUtils, CollectionUtils, ConditionalUtils. And code cleanup #978
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/mining')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt9
6 files changed, 24 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt
index 18bffb4a4..9a6993853 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/DeepCavernsParkour.kt
@@ -9,9 +9,11 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
+import at.hannibal2.skyhanni.utils.ChatUtils
+import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
+import at.hannibal2.skyhanni.utils.ConditionalUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
-import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUItems.getItemStack
import at.hannibal2.skyhanni.utils.ParkourHelper
@@ -23,6 +25,7 @@ import net.minecraftforge.fml.common.eventhandler.EventPriority
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class DeepCavernsParkour {
+
private val config get() = SkyHanniMod.feature.mining.deepCavernsParkour
private var parkourHelper: ParkourHelper? = null
@@ -66,7 +69,7 @@ class DeepCavernsParkour {
@SubscribeEvent
fun onConfigLoad(event: ConfigLoadEvent) {
- LorenzUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) {
+ ConditionalUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) {
updateConfig()
}
}
@@ -91,7 +94,7 @@ class DeepCavernsParkour {
if (it.displayName != "§aObsidian Sanctuary") {
if (!show) {
start()
- LorenzUtils.chat("Automatically enabling Deep Caverns Parkour, helping you find the way to the bottom of Deep Caverns and the path to Ryst.")
+ ChatUtils.chat("Automatically enabling Deep Caverns Parkour, helping you find the way to the bottom of Deep Caverns and the path to Ryst.")
}
}
}
@@ -101,7 +104,7 @@ class DeepCavernsParkour {
show = true
parkourHelper?.reset()
if (parkourHelper == null) {
- LorenzUtils.clickableChat(
+ ChatUtils.clickableChat(
"DeepCavernsParkour missing in SkyHanni Repo! Try /shupdaterepo to fix it!",
"shupdaterepo",
prefixColor = "§c"
@@ -126,7 +129,7 @@ class DeepCavernsParkour {
fun onStackClick(event: SlotClickEvent) {
if (showStartIcon && event.slotId == 40) {
event.isCanceled = true
- LorenzUtils.chat("Manually enabled Deep Caverns Parkour.")
+ ChatUtils.chat("Manually enabled Deep Caverns Parkour.")
start()
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt
index 94726c640..3317cbff3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/HighlightMiningCommissionMobs.kt
@@ -21,6 +21,7 @@ import net.minecraft.entity.monster.EntitySlime
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class HighlightMiningCommissionMobs {
+
private val config get() = SkyHanniMod.feature.mining
private var active = listOf<MobType>()
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt
index 36eaa7a24..08f4c59e6 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/KingTalismanHelper.kt
@@ -6,12 +6,13 @@ import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.utils.ChatUtils
+import at.hannibal2.skyhanni.utils.CollectionUtils.sorted
+import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc
import at.hannibal2.skyhanni.utils.EntityUtils
import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
-import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
-import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
@@ -22,10 +23,12 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import java.util.Collections
class KingTalismanHelper {
+
private val config get() = SkyHanniMod.feature.mining.kingTalisman
private val storage get() = ProfileStorageData.profileSpecific?.mining
companion object {
+
private var currentOffset: Int? = null
private var skyblockYear = 0
@@ -38,7 +41,7 @@ class KingTalismanHelper {
fun kingFix() {
currentOffset = null
- LorenzUtils.chat("Reset internal offset of King Talisman Helper.")
+ ChatUtils.chat("Reset internal offset of King Talisman Helper.")
}
}
@@ -109,7 +112,7 @@ class KingTalismanHelper {
val currentKing = getCurrentKing()
val kingsTalkedTo = storage.kingsTalkedTo
if (currentKing !in kingsTalkedTo) {
- LorenzUtils.debug("Found new king!")
+ ChatUtils.debug("Found new king!")
kingsTalkedTo.add(currentKing)
update(kingsTalkedTo)
display = allKingsDisplay
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt
index 4647866e8..80b979087 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/crystalhollows/CrystalHollowsNamesInCore.kt
@@ -12,6 +12,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class CrystalHollowsNamesInCore {
+
private val config get() = SkyHanniMod.feature.mining
private val coreLocations = mapOf(
LorenzVec(550, 116, 550) to "§8Precursor Remnants",
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt
index 1fef5b2ee..86c51f365 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/eventtracker/MiningEventTracker.kt
@@ -136,10 +136,10 @@ class MiningEventTracker {
}
}
- private fun isEnabled() = (IslandType.DWARVEN_MINES.isInIsland() || IslandType.CRYSTAL_HOLLOWS.isInIsland()) && config.sendData
+ private fun isEnabled() = (IslandType.DWARVEN_MINES.isInIsland() || IslandType.CRYSTAL_HOLLOWS.isInIsland())
+ && config.sendData
// && config.enabled
-
private fun sendData(json: String) {
val response = APIUtil.postJSON("https://api.soopy.dev/skyblock/chevents/set", json)
if (!response.success) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
index 3c3b0dfd3..83e428b16 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
@@ -11,9 +11,9 @@ import at.hannibal2.skyhanni.events.IslandChangeEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
+import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList
+import at.hannibal2.skyhanni.utils.ConditionalUtils.afterChange
import at.hannibal2.skyhanni.utils.ConfigUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.addAsSingletonList
-import at.hannibal2.skyhanni.utils.LorenzUtils.afterChange
import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
@@ -88,6 +88,7 @@ object PowderTracker {
{ formatDisplay(drawDisplay(it)) }
class Data : TrackerData() {
+
override fun reset() {
rewards.clear()
totalChestPicked = 0
@@ -299,7 +300,7 @@ object PowderTracker {
private fun MutableList<List<Any>>.addPerHour(
map: MutableMap<PowderChestReward, Long>,
reward: PowderChestReward,
- info: ResourceInfo
+ info: ResourceInfo,
) {
val mithrilCount = map.getOrDefault(reward, 0).addSeparators()
val mithrilPerHour = format(info.perHour)
@@ -364,7 +365,7 @@ object PowderTracker {
var lastEstimated: Long,
var stoppedChecks: Int,
var perHour: Double,
- val perMin: MutableList<Long>
+ val perMin: MutableList<Long>,
)
private fun isEnabled() = IslandType.CRYSTAL_HOLLOWS.isInIsland() && config.enabled