Skip to content

Commit

Permalink
Fix HUD info showing while GUI is hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
LostLuma committed Jun 23, 2024
1 parent 8d4c635 commit a5dffb4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public final class HudInfoRenderer {
private static final Minecraft minecraft = Minecraft.getInstance();

public static void renderInfo(GuiGraphics guiGraphics) {
if (minecraft.options.hideGui || minecraft.screen != null) {
return;
}

if (DynamicFPSConfig.INSTANCE.batteryTracker().enabled()) {
drawBatteryOverlay(guiGraphics);
}
Expand All @@ -35,7 +39,7 @@ private static void drawCenteredText(GuiGraphics guiGraphics, Component componen
}

private static void drawBatteryOverlay(GuiGraphics graphics) {
if (minecraft.screen != null || minecraft.getDebugOverlay().showDebugScreen() || !BatteryTracker.hasBatteries()) {
if (minecraft.getDebugOverlay().showDebugScreen() || !BatteryTracker.hasBatteries()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class GuiMixin {
* Render info on whether Dynamic FPS is disabled or always reducing the user's FPS.
*/
@Inject(method = "renderSavingIndicator", at = @At("HEAD"))
private void renderSavingIndicator(CallbackInfo callbackInfo, @Local GuiGraphics guiGraphics) {
private void renderSavingIndicator(CallbackInfo callbackInfo, @Local(argsOnly = true) GuiGraphics guiGraphics) {
HudInfoRenderer.renderInfo(guiGraphics);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class GuiMixin {
* Render info on whether Dynamic FPS is disabled or always reducing the user's FPS.
*/
@Inject(method = "renderSavingIndicator", at = @At("HEAD"))
private void renderSavingIndicator(CallbackInfo callbackInfo, @Local GuiGraphics guiGraphics) {
private void renderSavingIndicator(CallbackInfo callbackInfo, @Local(argsOnly = true) GuiGraphics guiGraphics) {
HudInfoRenderer.renderInfo(guiGraphics);
}
}

0 comments on commit a5dffb4

Please sign in to comment.