summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorILike2WatchMemes <ilike2watchmemes@gmail.com>2024-03-10 20:48:46 +0100
committerGitHub <noreply@github.com>2024-03-10 20:48:46 +0100
commit504924b65b0b1cf6bc5deaf2a46e2162504d63bf (patch)
tree621119b07ab8c79d01f21d90f619074819fe0fb7 /src/main/java/at/hannibal2/skyhanni/features/misc
parent6b19f73c526fc4bbb196b7b547750ebe60feb76d (diff)
downloadskyhanni-504924b65b0b1cf6bc5deaf2a46e2162504d63bf.tar.gz
skyhanni-504924b65b0b1cf6bc5deaf2a46e2162504d63bf.tar.bz2
skyhanni-504924b65b0b1cf6bc5deaf2a46e2162504d63bf.zip
Feature: Lane Switching Notification (#1075)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt
index 0af985c67..a30635fb5 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt
@@ -3,43 +3,20 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.config.enums.OutsideSbFeature
import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
-import at.hannibal2.skyhanni.utils.LorenzUtils.round
-import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.RenderUtils.renderString
-import net.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-import kotlin.concurrent.fixedRateTimer
class MovementSpeedDisplay {
private val config get() = SkyHanniMod.feature.misc
- private var display = ""
-
- init {
- fixedRateTimer(name = "skyhanni-movement-speed-display", period = 250, initialDelay = 1_000) {
- checkSpeed()
- }
- }
-
- private fun checkSpeed() {
- if (!isEnabled()) return
-
- val distance = with(Minecraft.getMinecraft().thePlayer) {
- val oldPos = LorenzVec(prevPosX, prevPosY, prevPosZ)
- val newPos = LorenzVec(posX, posY, posZ)
-
- // Distance from previous tick, multiplied by TPS
- oldPos.distance(newPos) * 20
- }
- display = "Movement Speed: ${distance.round(2)}"
- }
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
if (!isEnabled()) return
- config.playerMovementSpeedPos.renderString(display, posLabel = "Movement Speed")
+ config.playerMovementSpeedPos.renderString("Movement Speed: ${LocationUtils.distanceFromPreviousTick()}", posLabel = "Movement Speed")
}
fun isEnabled() = LorenzUtils.onHypixel &&