GuiRenderTickMixin:
- Added more comments - Removed unnecessary alpha calculations. - Replaced draw method with drawShadow. - Cleaned up variables - Made y offset to scale with window height.
This commit is contained in:
@ -26,19 +26,23 @@ public class GuiRenderTickMixin {
|
|||||||
RenderSystem.enableBlend();
|
RenderSystem.enableBlend();
|
||||||
RenderSystem.defaultBlendFunc();
|
RenderSystem.defaultBlendFunc();
|
||||||
|
|
||||||
// Render state
|
// Render player state text
|
||||||
poseStack.pushPose();
|
poseStack.pushPose();
|
||||||
poseStack.scale(5, 5, 5);
|
poseStack.scale(5, 5, 5);
|
||||||
Font font = Minecraft.getInstance().font;
|
|
||||||
int titleWidth = font.width(Proxy.Client.getPlayerState().toString());
|
|
||||||
float offset = -titleWidth / 2f;
|
|
||||||
int alpha = 255 << 24 & 0xFF000000;
|
|
||||||
|
|
||||||
|
// Initialize variables
|
||||||
|
Font font = Minecraft.getInstance().font;
|
||||||
|
float offsetX = -(font.width(Proxy.Client.getPlayerState().toString()) / 2f);
|
||||||
|
float offsetY = -((font.lineHeight / 2f) + ((Minecraft.getInstance().getWindow().getGuiScaledHeight() / 4f) / 5));
|
||||||
|
int argb = 0xFFFFFFFF;
|
||||||
|
|
||||||
|
// Draw player state if it's not active
|
||||||
if (!Proxy.Client.getPlayerState().equals(ProtectedPlayer.State.ACTIVE)) {
|
if (!Proxy.Client.getPlayerState().equals(ProtectedPlayer.State.ACTIVE)) {
|
||||||
font.draw(poseStack, Proxy.Client.getPlayerState().toString(), offset, -50, 0xFFFFFF | alpha);
|
font.drawShadow(poseStack, Proxy.Client.getPlayerState().toString(), offsetX, offsetY, argb);
|
||||||
}
|
}
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
|
|
||||||
|
// Finish
|
||||||
RenderSystem.disableBlend();
|
RenderSystem.disableBlend();
|
||||||
poseStack.popPose();
|
poseStack.popPose();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user