aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-11 22:14:40 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-11 22:14:40 +0100
commit8f3f2318352a2b24625566751daefd1c5e71e51a (patch)
tree0e1223b0e3a50a233b18427b4e9bbefa352347bb /src/main
parent53bac64d16fe7568e1dc24d0e58d4a02e05cf82e (diff)
downloadskyhanni-8f3f2318352a2b24625566751daefd1c5e71e51a.tar.gz
skyhanni-8f3f2318352a2b24625566751daefd1c5e71e51a.tar.bz2
skyhanni-8f3f2318352a2b24625566751daefd1c5e71e51a.zip
code cleanup
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)}"
}