diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index 47bdb3976..224d9269e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -1335,8 +1335,10 @@ object RenderUtils { } } - class LineDrawer @PublishedApi internal constructor(val tessellator: Tessellator) { + class LineDrawer @PublishedApi internal constructor(val tessellator: Tessellator, val inverseView: LorenzVec) { + val worldRenderer = tessellator.worldRenderer + fun drawPath(path: List<LorenzVec>, color: Color, lineWidth: Int, depth: Boolean, bezierPoint: Double = 1.0) { if (bezierPoint < 0) { path.zipWithNext().forEach { @@ -1380,6 +1382,9 @@ object RenderUtils { } } + fun draw3DLineFromPlayer(lorenzVec: LorenzVec, color: Color, lineWidth: Int, depth: Boolean) = + draw3DLine(inverseView.add(y = Minecraft.getMinecraft().thePlayer.eyeHeight.toDouble()), lorenzVec, color, lineWidth, depth) + fun drawBezier2( p1: LorenzVec, p2: LorenzVec, @@ -1426,7 +1431,7 @@ object RenderUtils { companion object { inline fun draw3D( partialTicks: Float = 0F, - crossinline quads: LineDrawer.() -> Unit, + crossinline draws: LineDrawer.() -> Unit, ) { GlStateManager.enableBlend() @@ -1439,10 +1444,10 @@ object RenderUtils { val tessellator = Tessellator.getInstance() GlStateManager.pushMatrix() - RenderUtils.translate(getViewerPos(partialTicks).negated()) - getViewerPos(partialTicks) + val inverseView = getViewerPos(partialTicks) + RenderUtils.translate(inverseView.negated()) - quads.invoke(LineDrawer(Tessellator.getInstance())) + draws.invoke(LineDrawer(Tessellator.getInstance(), inverseView)) GlStateManager.popMatrix() |