diff options
author | inglettronald <inglettronald@gmail.com> | 2023-07-23 08:28:08 -0500 |
---|---|---|
committer | inglettronald <inglettronald@gmail.com> | 2023-07-23 08:28:08 -0500 |
commit | 6028973423c664e4a4626c577f4884cc4d92cbe0 (patch) | |
tree | d09fa6974290af6cac621e4a33d77a334cb2456d /src/main/kotlin/com/dulkirfabric/util/HudRenderUtil.kt | |
parent | 4e8e3ae91f8be1906c298bf7b0aceb1b39d083d3 (diff) | |
download | DulkirMod-Fabric-6028973423c664e4a4626c577f4884cc4d92cbe0.tar.gz DulkirMod-Fabric-6028973423c664e4a4626c577f4884cc4d92cbe0.tar.bz2 DulkirMod-Fabric-6028973423c664e4a4626c577f4884cc4d92cbe0.zip |
performance improvements
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/util/HudRenderUtil.kt')
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/util/HudRenderUtil.kt | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/util/HudRenderUtil.kt b/src/main/kotlin/com/dulkirfabric/util/HudRenderUtil.kt index 40840d9..02b79f7 100644 --- a/src/main/kotlin/com/dulkirfabric/util/HudRenderUtil.kt +++ b/src/main/kotlin/com/dulkirfabric/util/HudRenderUtil.kt @@ -1,8 +1,6 @@ package com.dulkirfabric.util import com.dulkirfabric.DulkirModFabric.mc -import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext -import net.minecraft.client.font.TextRenderer import net.minecraft.client.gui.DrawContext import net.minecraft.text.Text @@ -11,11 +9,11 @@ object HudRenderUtil { val matrices = context.matrices val tr = mc.textRenderer val w = tr.getWidth(content) - val sf: Float = mc.window.scaledWidth / w.toFloat() + val sf: Float = mc.window.scaledWidth / w.toFloat() / 3 matrices.push() - matrices.translate(mc.currentScreen!!.width / 3f, mc.window.scaledHeight / 2f, - 0f) + matrices.translate(mc.window.scaledWidth / 3f, mc.window.scaledHeight / 2f, 0f) matrices.scale(sf, sf, 1f) context.drawText(tr, content, 0, -tr.fontHeight / 2, -1, true) + matrices.pop() } }
\ No newline at end of file |