aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-17 10:03:22 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-17 10:03:22 +0200
commitb292fbe448ebf15c5a00c4b552579bc15c525a2d (patch)
tree7ee5c44234ba29a5e7f3e2f03d88ab5247d3c532 /src/main/java/at/hannibal2/skyhanni/features
parent92c9d6e7982bbebf619c6b6352e06d0ac6b28228 (diff)
downloadskyhanni-b292fbe448ebf15c5a00c4b552579bc15c525a2d.tar.gz
skyhanni-b292fbe448ebf15c5a00c4b552579bc15c525a2d.tar.bz2
skyhanni-b292fbe448ebf15c5a00c4b552579bc15c525a2d.zip
migrate tia relay and harp config into inventory helper
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt21
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt7
3 files changed, 30 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt
index b05908f9d..72cad7e00 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/HarpFeatures.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.RenderItemTipEvent
import at.hannibal2.skyhanni.utils.InventoryUtils.openInventoryName
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -16,7 +17,7 @@ import kotlin.time.Duration.Companion.milliseconds
// Delaying key presses by 300ms comes from NotEnoughUpdates
class HarpFeatures {
- private val config get() = SkyHanniMod.feature.misc
+ private val config get() = SkyHanniMod.feature.inventory.helper.harp
private var lastClick = SimpleTimeMark.farPast()
private val keys = listOf(
@@ -34,7 +35,7 @@ class HarpFeatures {
@SubscribeEvent
fun onGui(event: GuiScreenEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (!config.harpKeybinds) return
+ if (!config.keybinds) return
if (!openInventoryName().startsWith("Harp")) return
val chest = event.gui as? GuiChest ?: return
@@ -58,7 +59,7 @@ class HarpFeatures {
@SubscribeEvent
fun onRenderItemTip(event: RenderItemTipEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (!config.harpNumbers) return
+ if (!config.showNumbers) return
if (!openInventoryName().startsWith("Harp")) return
if (Item.getIdFromItem(event.stack.item) != 159) return // Stained hardened clay item id = 159
@@ -68,4 +69,10 @@ class HarpFeatures {
event.stackTip = (index + 1).toString()
}
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "misc.harpKeybinds", "inventory.helper.harp.keybinds")
+ event.move(2, "misc.harpNumbers", "inventory.helper.harp.showNumbers")
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt
index 0d725b7d8..be912f393 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayHelper.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.misc.tiarelay
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.PlaySoundEvent
@@ -12,6 +13,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.sorted
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class TiaRelayHelper {
+ private val config get() = SkyHanniMod.feature.inventory.helper.tiaRelay
private var inInventory = false
private var lastClickSlot = 0
@@ -25,13 +27,13 @@ class TiaRelayHelper {
if (!LorenzUtils.inSkyBlock) return
val soundName = event.soundName
- if (SkyHanniMod.feature.misc.tiaRelayMute) {
+ if (config.tiaRelayMute) {
if (soundName == "mob.wolf.whine") {
event.isCanceled = true
}
}
- if (!SkyHanniMod.feature.misc.tiaRelayHelper) return
+ if (!config.soundHelper) return
if (!inInventory) return
val distance = event.distanceToPlayer
@@ -52,7 +54,7 @@ class TiaRelayHelper {
@SubscribeEvent
fun onTick(event: LorenzTickEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (!SkyHanniMod.feature.misc.tiaRelayHelper) return
+ if (!config.soundHelper) return
if (event.repeatSeconds(1)) {
if (InventoryUtils.openInventoryName().contains("Network Relay")) {
@@ -94,7 +96,7 @@ class TiaRelayHelper {
@SubscribeEvent
fun onRenderItemTip(event: RenderInventoryItemTipEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (!SkyHanniMod.feature.misc.tiaRelayHelper) return
+ if (!config.soundHelper) return
if (!inInventory) return
val slot = event.slot
@@ -125,7 +127,7 @@ class TiaRelayHelper {
@SubscribeEvent
fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (!SkyHanniMod.feature.misc.tiaRelayHelper) return
+ if (!config.soundHelper) return
if (!inInventory) return
// only listen to right clicks
@@ -135,5 +137,14 @@ class TiaRelayHelper {
lastClickTime = System.currentTimeMillis()
}
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "misc.tiaRelayMute", "inventory.helper.tiaRelay.tiaRelayMute")
+ event.move(2, "misc.tiaRelayHelper", "inventory.helper.tiaRelay.soundHelper")
+
+ event.move(2, "misc.tiaRelayNextWaypoint", "inventory.helper.tiaRelay.nextWaypoint")
+ event.move(2, "misc.tiaRelayAllWaypoints", "inventory.helper.tiaRelay.allWaypoints")
+ }
+
class Sound(val name: String, val pitch: Float)
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt
index 7bfc45ae9..ff411c44b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/tiarelay/TiaRelayWaypoints.kt
@@ -12,6 +12,7 @@ import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class TiaRelayWaypoints {
+ private val config get() = SkyHanniMod.feature.inventory.helper.tiaRelay
private var waypoint: LorenzVec? = null
private var waypointName: String? = null
private var island = IslandType.NONE
@@ -19,7 +20,7 @@ class TiaRelayWaypoints {
@SubscribeEvent
fun onChatMessage(event: LorenzChatEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (!SkyHanniMod.feature.misc.tiaRelayNextWaypoint) return
+ if (!config.nextWaypoint) return
val message = event.message
for (relay in Relay.entries) {
@@ -41,7 +42,7 @@ class TiaRelayWaypoints {
fun onRenderWorld(event: RenderWorldLastEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (SkyHanniMod.feature.misc.tiaRelayAllWaypoints) {
+ if (config.allWaypoints) {
for (relay in Relay.entries) {
if (relay.island == LorenzUtils.skyBlockIsland) {
event.drawWaypointFilled(relay.waypoint, LorenzColor.LIGHT_PURPLE.toColor())
@@ -51,7 +52,7 @@ class TiaRelayWaypoints {
return
}
- if (!SkyHanniMod.feature.misc.tiaRelayNextWaypoint) return
+ if (!config.nextWaypoint) return
if (LorenzUtils.skyBlockIsland != island) return
waypoint?.let {