diff options
author | ingle <inglettronald@gmail.com> | 2022-11-28 10:14:44 -0600 |
---|---|---|
committer | ingle <inglettronald@gmail.com> | 2022-11-28 10:14:44 -0600 |
commit | 15b61517c59f8aa8135af82d6814739ad5da76b3 (patch) | |
tree | 19a13669ba1714cf9f763d632fafcfc6382eec54 /src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt | |
parent | 7df387ec0f015fc7b8179131f17a107be4d77f04 (diff) | |
download | DulkirMod-15b61517c59f8aa8135af82d6814739ad5da76b3.tar.gz DulkirMod-15b61517c59f8aa8135af82d6814739ad5da76b3.tar.bz2 DulkirMod-15b61517c59f8aa8135af82d6814739ad5da76b3.zip |
- 1.1.3
Diffstat (limited to 'src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt')
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt index d3c2761..e0febdd 100644 --- a/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt +++ b/src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt @@ -18,6 +18,7 @@ class WorldRenderUtils { text: String, depthTest: Boolean = true, scale: Float = 1f, + showDistance: Boolean = false, shadow: Boolean = false, renderBlackBox: Boolean = true, ) { @@ -66,6 +67,45 @@ class WorldRenderUtils { 0 ) } + + // for waypoints + if (showDistance) { + val distance = "§e${mc.thePlayer.positionVector.distanceTo(location).toInt()}m" + GlStateManager.translate(0.0, 8.66, 0.0) + GlStateManager.scale(.66, .66, .66) + + if (renderBlackBox) { + val j = mc.fontRendererObj.getStringWidth(distance) / 2 + disableTexture2D() + val worldRenderer = Tessellator.getInstance().worldRenderer + worldRenderer.begin(7, DefaultVertexFormats.POSITION_COLOR) + worldRenderer.pos((-j - 1).toDouble(), (-1).toDouble(), 0.0).color(0.0f, 0.0f, 0.0f, 0.25f) + .endVertex() + worldRenderer.pos((-j - 1).toDouble(), 8.toDouble(), 0.0).color(0.0f, 0.0f, 0.0f, 0.25f).endVertex() + worldRenderer.pos((j + 1).toDouble(), 8.toDouble(), 0.0).color(0.0f, 0.0f, 0.0f, 0.25f).endVertex() + worldRenderer.pos((j + 1).toDouble(), (-1).toDouble(), 0.0).color(0.0f, 0.0f, 0.0f, 0.25f) + .endVertex() + Tessellator.getInstance().draw() + enableTexture2D() + } + + if (shadow) { + mc.fontRendererObj.drawStringWithShadow( + distance, + -mc.fontRendererObj.getStringWidth(distance) / 2f, + 0f, + 0 + ) + } else { + mc.fontRendererObj.drawString( + distance, + -mc.fontRendererObj.getStringWidth(distance) / 2, + 0, + 0 + ) + } + } + GlStateManager.color(1f, 1f, 1f) GlStateManager.disableBlend() GlStateManager.popMatrix() |