GuiRenderTickMixin:
- Added additional check to player state. - Cleaned up the player state string when displaying.
This commit is contained in:
@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user