diff options
Diffstat (limited to 'src/main/java/me/Danker/utils/RenderUtils.java')
-rw-r--r-- | src/main/java/me/Danker/utils/RenderUtils.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/utils/RenderUtils.java b/src/main/java/me/Danker/utils/RenderUtils.java index f117969..50b9786 100644 --- a/src/main/java/me/Danker/utils/RenderUtils.java +++ b/src/main/java/me/Danker/utils/RenderUtils.java @@ -363,4 +363,10 @@ public class RenderUtils { GlStateManager.disableRescaleNormal(); } + public static void drawCenteredText(String text, int screenWidth, int height, double scale) { + Minecraft mc = Minecraft.getMinecraft(); + int textWidth = mc.fontRendererObj.getStringWidth(text); + new TextRenderer(mc, text, screenWidth / 2 - textWidth / 2, height, scale); + } + } |