aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-17 10:54:24 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-17 10:54:24 +0200
commitdc337e273420fbc987fabdfb07f42a78116da164 (patch)
tree077648c22dcf785b5ffc0f9fe392f634bdd67ed3 /src/main/java/at/hannibal2/skyhanni/features/misc
parente55b901cf4368f030dd10519946e54f1129ab78a (diff)
downloadskyhanni-dc337e273420fbc987fabdfb07f42a78116da164.tar.gz
skyhanni-dc337e273420fbc987fabdfb07f42a78116da164.tar.bz2
skyhanni-dc337e273420fbc987fabdfb07f42a78116da164.zip
migrate city project config into event and real time, tps display, and custom text box config into gui
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt19
3 files changed, 26 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt
index 7c05c6af1..eb78def01 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.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.ConfigLoadEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -9,7 +10,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class CustomTextBox {
- private val config get() = SkyHanniMod.feature.misc.textBox
+ private val config get() = SkyHanniMod.feature.gui.customTextBox
private var display = listOf<String>()
@SubscribeEvent
@@ -30,4 +31,9 @@ class CustomTextBox {
config.position.renderStrings(display, posLabel = "Custom Text Box")
}
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "misc.textBox", "gui.customTextBox")
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt
index 0ec010924..4f23411a0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt
@@ -17,7 +17,7 @@ import kotlin.time.Duration.Companion.days
import kotlin.time.Duration.Companion.seconds
class TimeFeatures {
- private val config get() = SkyHanniMod.feature.misc.timeConfigs
+ private val config get() = SkyHanniMod.feature.gui
private val winterConfig get() = SkyHanniMod.feature.event.winter
private val format = SimpleDateFormat("HH:mm:ss")
@@ -31,7 +31,7 @@ class TimeFeatures {
if (!LorenzUtils.inSkyBlock) return
if (config.realTime) {
- config.realTimePos.renderString(format.format(System.currentTimeMillis()), posLabel = "Real Time")
+ config.realTimePosition.renderString(format.format(System.currentTimeMillis()), posLabel = "Real Time")
}
if (winterConfig.islandCloseTime && IslandType.WINTER.isInIsland()) {
@@ -50,5 +50,8 @@ class TimeFeatures {
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
event.move(2, "misc.timeConfigs.winterTime", "event.winter.islandCloseTime")
event.move(2, "misc.timeConfigs.winterTimePos", "event.winter.islandCloseTimePosition")
+
+ event.move(2, "misc.timeConfigs.realTime", "gui.realTime")
+ event.move(2, "misc.timeConfigs.realTimePos", "gui.realTimePosition")
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt
index 864bdde72..726771f8c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.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.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.PacketEvent
@@ -12,6 +13,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.concurrent.fixedRateTimer
class TpsCounter {
+ private val config get() = SkyHanniMod.feature.gui
+
companion object {
private const val minDataAmount = 5
private const val waitAfterWorldSwitch = 6
@@ -27,7 +30,7 @@ class TpsCounter {
init {
fixedRateTimer(name = "skyhanni-tps-counter-seconds", period = 1000L) {
if (!LorenzUtils.inSkyBlock) return@fixedRateTimer
- if (!SkyHanniMod.feature.misc.tpsDisplayEnabled) return@fixedRateTimer
+ if (!config.tpsDisplay) return@fixedRateTimer
if (packetsFromLastSecond == 0) return@fixedRateTimer
if (ignoreFirstTicks > 0) {
@@ -57,7 +60,7 @@ class TpsCounter {
}
fixedRateTimer(name = "skyhanni-tps-counter-ticks", period = 50L) {
if (!LorenzUtils.inSkyBlock) return@fixedRateTimer
- if (!SkyHanniMod.feature.misc.tpsDisplayEnabled) return@fixedRateTimer
+ if (!config.tpsDisplay) return@fixedRateTimer
if (hasPacketReceived) {
hasPacketReceived = false
@@ -76,16 +79,22 @@ class TpsCounter {
@SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
fun onChatPacket(event: PacketEvent.ReceiveEvent) {
- if (!SkyHanniMod.feature.misc.tpsDisplayEnabled) return
+ if (!config.tpsDisplay) return
hasPacketReceived = true
}
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (!SkyHanniMod.feature.misc.tpsDisplayEnabled) return
+ if (!config.tpsDisplay) return
+
+ config.tpsDisplayPosition.renderString(display, posLabel = "Tps Display")
+ }
- SkyHanniMod.feature.misc.tpsDisplayPosition.renderString(display, posLabel = "Tps Display")
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "misc.tpsDisplayEnabled", "gui.tpsDisplay")
+ event.move(2, "misc.tpsDisplayPosition", "gui.tpsDisplayPosition")
}
private fun getColor(tps: Double): String {