diff --git a/src/main/java/dev/micle/loginprotection/mixin/GuiRenderTickMixin.java b/src/main/java/dev/micle/loginprotection/mixin/GuiRenderTickMixin.java index 40017b6..0e015a1 100644 --- a/src/main/java/dev/micle/loginprotection/mixin/GuiRenderTickMixin.java +++ b/src/main/java/dev/micle/loginprotection/mixin/GuiRenderTickMixin.java @@ -27,29 +27,30 @@ public class GuiRenderTickMixin { } // Initialize variables - double screenHalfWidth = Minecraft.getInstance().getWindow().getGuiScaledWidth() / 2.0; - double screenHalfHeight = Minecraft.getInstance().getWindow().getGuiScaledHeight() / 2.0; + Font font = Minecraft.getInstance().font; + float guiHalfWidth = Minecraft.getInstance().getWindow().getGuiScaledWidth() / 2f; + float guiHalfHeight = Minecraft.getInstance().getWindow().getGuiScaledHeight() / 2f; + int scale = Config.Client.GUI_SCREEN_TEXT_SCALE.get(); + float heightPositionScale = 1.5f; // Setup PoseStack poseStack = guiGraphics.pose(); poseStack.pushPose(); - poseStack.translate(screenHalfWidth, screenHalfHeight, 0); + poseStack.translate(guiHalfWidth, guiHalfHeight, 0); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); // Render player state text poseStack.pushPose(); - poseStack.scale(Config.Client.GUI_SCREEN_TEXT_SCALE.get(), Config.Client.GUI_SCREEN_TEXT_SCALE.get(), Config.Client.GUI_SCREEN_TEXT_SCALE.get()); + poseStack.scale(scale, scale, scale); // Check if we should draw the state if (Proxy.Client.getPlayerState() != null && !Proxy.Client.getPlayerState().equals(ProtectedPlayer.State.ACTIVE)) { // Initialize variables - Font font = Minecraft.getInstance().font; int textHalfWidth = font.width(Proxy.Client.getPlayerState().toString()) / 2; int textHalfHeight = font.lineHeight / 2; - float positionScale = 1.5f; int offsetX = -textHalfWidth; - int offsetY = (int)-((textHalfHeight + screenHalfHeight) / positionScale); + int offsetY = (int)-(textHalfHeight + ((guiHalfHeight / heightPositionScale) / scale)); int argb = 0xFFFFFFFF; // Draw the player's protection state