aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt14
1 files changed, 6 insertions, 8 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 a5aca0f56..cf50b53f4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/MovementSpeedDisplay.kt
@@ -2,7 +2,6 @@ package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
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
@@ -24,14 +23,13 @@ class MovementSpeedDisplay {
private fun checkSpeed() {
if (!isEnabled()) return
- val player = Minecraft.getMinecraft().thePlayer
-
- val oldPos = LorenzVec(player.prevPosX, player.prevPosY, player.prevPosZ)
- val newPos = LorenzVec(player.posX, player.posY, player.posZ)
-
- // Distance from previous tick, multiplied by TPS
- val distance = oldPos.distance(newPos) * 20
+ 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)}"
}