From 504924b65b0b1cf6bc5deaf2a46e2162504d63bf Mon Sep 17 00:00:00 2001 From: ILike2WatchMemes Date: Sun, 10 Mar 2024 20:48:46 +0100 Subject: Feature: Lane Switching Notification (#1075) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/misc/MovementSpeedDisplay.kt | 27 ++-------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc') 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 && -- cgit