aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-08-26 03:29:32 +0200
committerGitHub <noreply@github.com>2024-08-26 03:29:32 +0200
commit0c98d82a100c97f3b0042a75edd87bed57341fa2 (patch)
tree58924b42bf37940e563e3475d3ee328d3dc2e404 /src/main/java/at/hannibal2/skyhanni/utils
parent2b43ecc2a03c0e03fd51674cbd2b3cff3e9ba711 (diff)
downloadskyhanni-0c98d82a100c97f3b0042a75edd87bed57341fa2.tar.gz
skyhanni-0c98d82a100c97f3b0042a75edd87bed57341fa2.tar.bz2
skyhanni-0c98d82a100c97f3b0042a75edd87bed57341fa2.zip
Fix: Custom Scoreboard Issues (#2402)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt53
1 files changed, 1 insertions, 52 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index f4a57cb18..0d6417688 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -4,7 +4,6 @@ import at.hannibal2.skyhanni.config.core.config.Position
import at.hannibal2.skyhanni.data.GuiEditManager
import at.hannibal2.skyhanni.data.GuiEditManager.getAbsX
import at.hannibal2.skyhanni.data.GuiEditManager.getAbsY
-import at.hannibal2.skyhanni.data.GuiEditManager.getDummySize
import at.hannibal2.skyhanni.data.model.Graph
import at.hannibal2.skyhanni.data.model.toPositionsList
import at.hannibal2.skyhanni.events.GuiContainerEvent
@@ -542,37 +541,6 @@ object RenderUtils {
return renderer.getStringWidth(display)
}
- // Aligns using the width of element to render
- private fun Position.renderString0(
- string: String?,
- offsetX: Int = 0,
- offsetY: Int = 0,
- alignmentEnum: HorizontalAlignment,
- ): Int {
- val display = "§f$string"
- GlStateManager.pushMatrix()
- transform()
- val minecraft = Minecraft.getMinecraft()
- val renderer = minecraft.renderManager.fontRenderer
- val width = this.getDummySize().x / this.scale
-
- GlStateManager.translate(offsetX + 1.0, offsetY + 1.0, 0.0)
-
- val strLen: Int = renderer.getStringWidth(string)
- val x2 = when (alignmentEnum) {
- HorizontalAlignment.LEFT -> offsetX.toFloat()
- HorizontalAlignment.CENTER -> offsetX + width / 2f - strLen / 2f
- HorizontalAlignment.RIGHT -> offsetX + width - strLen.toFloat()
- else -> offsetX.toFloat()
- }
- GL11.glTranslatef(x2, 0f, 0f)
- renderer.drawStringWithShadow(display, 0f, 0f, 0)
-
- GlStateManager.popMatrix()
-
- return renderer.getStringWidth(display)
- }
-
fun Position.renderStrings(list: List<String>, extraSpace: Int = 0, posLabel: String) {
if (list.isEmpty()) return
@@ -588,25 +556,6 @@ object RenderUtils {
GuiEditManager.add(this, posLabel, longestX, offsetY)
}
- fun Position.renderStringsAlignedWidth(
- list: List<Pair<String, HorizontalAlignment>>,
- extraSpace: Int = 0,
- posLabel: String,
- ) {
- if (list.isEmpty()) return
-
- var offsetY = 0
- var longestX = 0
- for (pair in list) {
- val x = renderString0(pair.first, offsetY = offsetY, alignmentEnum = pair.second)
- if (x > longestX) {
- longestX = x
- }
- offsetY += 10 + extraSpace
- }
- GuiEditManager.add(this, posLabel, longestX, offsetY)
- }
-
fun Position.renderRenderables(
renderables: List<Renderable>,
extraSpace: Int = 0,
@@ -698,7 +647,7 @@ object RenderUtils {
/**
* Accepts a single line to print.
- * This line is a list of things to print. Can print String or ItemStack objects.
+ * This line is a list of things to print. Can print String or ItemStack objects.
*/
@Deprecated("use List<Renderable>", ReplaceWith(""))
fun Position.renderSingleLineWithItems(