diff options
Diffstat (limited to 'src/main/kotlin/dulkirmod/utils')
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/Utils.kt | 12 | ||||
-rw-r--r-- | src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt | 40 |
2 files changed, 52 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/utils/Utils.kt b/src/main/kotlin/dulkirmod/utils/Utils.kt index fcc8de0..81646cb 100644 --- a/src/main/kotlin/dulkirmod/utils/Utils.kt +++ b/src/main/kotlin/dulkirmod/utils/Utils.kt @@ -12,6 +12,8 @@ import java.awt.datatransfer.StringSelection import java.util.* object Utils { + + var area = "" fun stripColorCodes(string: String): String { return string.replace("§.".toRegex(), "") } @@ -82,4 +84,14 @@ object Utils { fun getColorString(int: Int): String { return if (int == 16) "§z" else EnumChatFormatting.values()[int].toString() } + + fun getArea() { + val scoreboardList: List<String?> = TabListUtils.fetchTabEntires().map { + it.displayName?.unformattedText + } + for (l in scoreboardList) { + if (l != null && l.startsWith("Area: ")) + area = l.substring(6) + } + } }
\ No newline at end of file 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() |