aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/utils
diff options
context:
space:
mode:
authoringle <inglettronald@gmail.com>2022-11-28 10:14:44 -0600
committeringle <inglettronald@gmail.com>2022-11-28 10:14:44 -0600
commit15b61517c59f8aa8135af82d6814739ad5da76b3 (patch)
tree19a13669ba1714cf9f763d632fafcfc6382eec54 /src/main/kotlin/dulkirmod/utils
parent7df387ec0f015fc7b8179131f17a107be4d77f04 (diff)
downloadDulkirMod-15b61517c59f8aa8135af82d6814739ad5da76b3.tar.gz
DulkirMod-15b61517c59f8aa8135af82d6814739ad5da76b3.tar.bz2
DulkirMod-15b61517c59f8aa8135af82d6814739ad5da76b3.zip
- 1.1.3
Diffstat (limited to 'src/main/kotlin/dulkirmod/utils')
-rw-r--r--src/main/kotlin/dulkirmod/utils/Utils.kt12
-rw-r--r--src/main/kotlin/dulkirmod/utils/WorldRenderUtils.kt40
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()