Cleaned up and fixed screen text.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user