Skip to content

Commit

Permalink
clean up hud rendering methods
Browse files Browse the repository at this point in the history
  • Loading branch information
pcal43 committed Jul 12, 2024
1 parent 6b120f2 commit d30cf2a
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void setMinecraftClient(Minecraft client) {

@Override
public void renderMessageScreen(GuiGraphics drawContext, float tickDelta) {
onHudRender(drawContext, null);
renderHud(drawContext);
}

// ====================================================================
Expand Down Expand Up @@ -112,6 +112,13 @@ public Path getSavesDir() {

@Override
public void onHudRender(GuiGraphics drawContext, DeltaTracker tickDelta) {
renderHud(drawContext);
}

// ====================================================================
// Private

private void renderHud(GuiGraphics guiGraphics) {
if (this.client == null) return;
if (this.hudText == null) return;
if (!this.client.options.showAutosaveIndicator().get()) return;
Expand All @@ -121,6 +128,6 @@ public void onHudRender(GuiGraphics drawContext, DeltaTracker tickDelta) {
syslog().debug("hud text timed out. somebody forgot to clean up");
return;
}
drawContext.drawString(this.client.font, this.hudText, 2, 2, 1);
guiGraphics.drawString(this.client.font, this.hudText, 2, 2, 1);
}
}

0 comments on commit d30cf2a

Please sign in to comment.