aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-29 17:57:05 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-29 17:57:05 +0200
commit7a1d70b8abdaf65251c10d092875a425f7c39e69 (patch)
treeb0924b7a7f46f1a90101c6fae52c72cfe44bf60a /src/main/java/at
parentdc7aec0e85e0d7201b7bcd173392ced9cd362fd1 (diff)
downloadskyhanni-7a1d70b8abdaf65251c10d092875a425f7c39e69.tar.gz
skyhanni-7a1d70b8abdaf65251c10d092875a425f7c39e69.tar.bz2
skyhanni-7a1d70b8abdaf65251c10d092875a425f7c39e69.zip
workaround for smaller displays
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
index 16cf1d8f1..cdd3a44d0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerDaggerHelper.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.core.util.render.TextRenderUtils
import at.hannibal2.skyhanni.events.PacketEvent
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.EntityPlayerSP
import net.minecraft.client.gui.ScaledResolution
@@ -178,15 +179,17 @@ class BlazeSlayerDaggerHelper {
fun renderOverlay(event: RenderGameOverlayEvent.Post) {
if (event.type != RenderGameOverlayEvent.ElementType.ALL) return
if (!isEnabled()) return
+ if (textTopLeft.isEmpty()) return
if (Minecraft.getMinecraft().currentScreen != null) return
if (Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindPlayerList.keyCode)) return
-
val scaledResolution = ScaledResolution(Minecraft.getMinecraft())
val width = scaledResolution.scaledWidth
val height = scaledResolution.scaledHeight
+ val sizeFactor = (width.toFloat() / 960f).roundToPrecision(3)
+
GlStateManager.enableBlend()
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0)
val renderer = Minecraft.getMinecraft().fontRendererObj
@@ -194,25 +197,25 @@ class BlazeSlayerDaggerHelper {
GlStateManager.pushMatrix()
GlStateManager.translate(((width / 2) / 1.18).toFloat(), (height / 3.8).toFloat(), 0.0f)
GlStateManager.scale(4.0f, 4.0f, 4.0f)
- TextRenderUtils.drawStringCenteredScaledMaxWidth(textTopLeft, renderer, 0f, 0f, false, 60, 0)
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(textTopLeft, renderer, 0f, 0f, false, (60f * sizeFactor).toInt(), 0)
GlStateManager.popMatrix()
GlStateManager.pushMatrix()
GlStateManager.translate(((width / 2) * 1.18).toFloat(), (height / 3.8).toFloat(), 0.0f)
GlStateManager.scale(4.0f, 4.0f, 4.0f)
- TextRenderUtils.drawStringCenteredScaledMaxWidth(textTopRight, renderer, 0f, 0f, false, 60, 0)
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(textTopRight, renderer, 0f, 0f, false, (60f * sizeFactor).toInt(), 0)
GlStateManager.popMatrix()
GlStateManager.pushMatrix()
GlStateManager.translate(((width / 2) / 1.18).toFloat(), (height / 3.0).toFloat(), 0.0f)
GlStateManager.scale(4.0f, 4.0f, 4.0f)
- TextRenderUtils.drawStringCenteredScaledMaxWidth(textBottomLeft, renderer, 0f, 0f, false, 20, 0)
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(textBottomLeft, renderer, 0f, 0f, false, (20f * sizeFactor).toInt(), 0)
GlStateManager.popMatrix()
GlStateManager.pushMatrix()
GlStateManager.translate(((width / 2) * 1.18).toFloat(), (height / 3.0).toFloat(), 0.0f)
GlStateManager.scale(4.0f, 4.0f, 4.0f)
- TextRenderUtils.drawStringCenteredScaledMaxWidth(textBottomRight, renderer, 0f, 0f, false, 20, 0)
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(textBottomRight, renderer, 0f, 0f, false, (20f * sizeFactor).toInt(), 0)
GlStateManager.popMatrix()
}
}