aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-02 12:54:34 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-06-02 12:54:34 +0200
commita6fce6eca80132823d941a7da620d7f67097229a (patch)
treedfcc61ded82a4e9f83190368bcdbc7fecbfe1480 /src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
parent746c82be7379eeea2208e1d82d4e375826ebdd1c (diff)
downloadskyhanni-a6fce6eca80132823d941a7da620d7f67097229a.tar.gz
skyhanni-a6fce6eca80132823d941a7da620d7f67097229a.tar.bz2
skyhanni-a6fce6eca80132823d941a7da620d7f67097229a.zip
Showing fished item names
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 7e56be09e..58e000ce7 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -85,13 +85,7 @@ object RenderUtils {
}
- fun getViewerPos(partialTicks: Float): LorenzVec {
- val viewer = Minecraft.getMinecraft().renderViewEntity
- val viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks
- val viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks
- val viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks
- return LorenzVec(viewerX, viewerY, viewerZ)
- }
+ fun getViewerPos(partialTicks: Float) = exactLocation(Minecraft.getMinecraft().renderViewEntity, partialTicks)
/**
* Taken from NotEnoughUpdates under Creative Commons Attribution-NonCommercial 3.0
@@ -791,5 +785,14 @@ object RenderUtils {
GlStateManager.enableDepth()
}
+ fun RenderWorldLastEvent.exactLocation(entity: Entity): LorenzVec {
+ return exactLocation(entity, partialTicks)
+ }
+ fun exactLocation(entity: Entity, partialTicks: Float): LorenzVec {
+ val x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks
+ val y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks
+ val z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks
+ return LorenzVec(x, y, z)
+ }
}