GuiRenderTickMixin:

- Added additional check to player state.
- Cleaned up the player state string when displaying.
This commit is contained in:
Micle
2022-10-25 19:17:19 +01:00
parent 2bdaa544f6
commit 5616512efa

View File

@ -30,15 +30,16 @@ public class GuiRenderTickMixin {
poseStack.pushPose();
poseStack.scale(5, 5, 5);
// 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;
// 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;
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)) {
font.drawShadow(poseStack, Proxy.Client.getPlayerState().toString(), offsetX, offsetY, argb);
// Draw the player's protection state
font.drawShadow(poseStack, Proxy.Client.getPlayerState().toString().replace("_", " "), offsetX, offsetY, argb);
}
poseStack.popPose();