From 7a1d70b8abdaf65251c10d092875a425f7c39e69 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Thu, 29 Sep 2022 17:57:05 +0200 Subject: workaround for smaller displays --- .../features/slayer/blaze/BlazeSlayerDaggerHelper.kt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/main/java/at') 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() } } -- cgit