aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorForrick <69301168+Forrick@users.noreply.github.com>2023-01-13 05:12:07 +0100
committerGitHub <noreply@github.com>2023-01-13 05:12:07 +0100
commit4a47f275f8ae544e2bc3d95f6ce7e88c5474934e (patch)
tree9f64a070015335d25468f73b58e665681577e34b /src/main/java/at/hannibal2/skyhanni/utils
parent68908e24cc6b2739c34fc45c96284e7b2269407d (diff)
downloadskyhanni-4a47f275f8ae544e2bc3d95f6ce7e88c5474934e.tar.gz
skyhanni-4a47f275f8ae544e2bc3d95f6ce7e88c5474934e.tar.bz2
skyhanni-4a47f275f8ae544e2bc3d95f6ce7e88c5474934e.zip
Updated to 0.14.1 and Bazaar stuff. (#8)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt14
1 files changed, 9 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 ff28c52ab..e3052874f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -424,7 +424,7 @@ object RenderUtils {
return lastValue + (currentValue - lastValue) * multiplier
}
- fun Position.renderString(string: String?, offsetY: Int = 0) {
+ fun Position.renderString(string: String?, offsetY: Int = 0, center: Boolean = true) {
val minecraft = Minecraft.getMinecraft()
if (minecraft.gameSettings.keyBindPlayerList.isKeyDown) return
@@ -437,7 +437,11 @@ object RenderUtils {
val renderer = minecraft.renderManager.fontRenderer ?: return
- val offsetX = (200 - renderer.getStringWidth(display.removeColor())) / 2
+ val offsetX = if (center) {
+ (200 - renderer.getStringWidth(display.removeColor())) / 2
+ } else {
+ 0
+ }
val x = getAbsX(resolution, 200) + offsetX
val y = getAbsY(resolution, 16) + offsetY
@@ -448,13 +452,13 @@ object RenderUtils {
GlStateManager.popMatrix()
}
- fun Position.renderStrings(list: List<String>) {
+ fun Position.renderStrings(list: List<String>, extraSpace: Int = 0, center: Boolean = false) {
if (list.isEmpty()) return
var offsetY = 0
for (s in list) {
- renderString(s, offsetY)
- offsetY += 14
+ renderString(s, offsetY, center = center)
+ offsetY += 10 + extraSpace
}
}