Skip to content

Commit a5dffb4

Browse files
committed
Fix HUD info showing while GUI is hidden
1 parent 8d4c635 commit a5dffb4

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

platforms/common/src/main/java/dynamic_fps/impl/util/HudInfoRenderer.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ public final class HudInfoRenderer {
1717
private static final Minecraft minecraft = Minecraft.getInstance();
1818

1919
public static void renderInfo(GuiGraphics guiGraphics) {
20+
if (minecraft.options.hideGui || minecraft.screen != null) {
21+
return;
22+
}
23+
2024
if (DynamicFPSConfig.INSTANCE.batteryTracker().enabled()) {
2125
drawBatteryOverlay(guiGraphics);
2226
}
@@ -35,7 +39,7 @@ private static void drawCenteredText(GuiGraphics guiGraphics, Component componen
3539
}
3640

3741
private static void drawBatteryOverlay(GuiGraphics graphics) {
38-
if (minecraft.screen != null || minecraft.getDebugOverlay().showDebugScreen() || !BatteryTracker.hasBatteries()) {
42+
if (minecraft.getDebugOverlay().showDebugScreen() || !BatteryTracker.hasBatteries()) {
3943
return;
4044
}
4145

platforms/fabric/src/main/java/net/lostluma/dynamic_fps/impl/fabric/mixin/GuiMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class GuiMixin {
1515
* Render info on whether Dynamic FPS is disabled or always reducing the user's FPS.
1616
*/
1717
@Inject(method = "renderSavingIndicator", at = @At("HEAD"))
18-
private void renderSavingIndicator(CallbackInfo callbackInfo, @Local GuiGraphics guiGraphics) {
18+
private void renderSavingIndicator(CallbackInfo callbackInfo, @Local(argsOnly = true) GuiGraphics guiGraphics) {
1919
HudInfoRenderer.renderInfo(guiGraphics);
2020
}
2121
}

platforms/quilt/src/main/java/net/lostluma/dynamic_fps/impl/quilt/mixin/GuiMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class GuiMixin {
1515
* Render info on whether Dynamic FPS is disabled or always reducing the user's FPS.
1616
*/
1717
@Inject(method = "renderSavingIndicator", at = @At("HEAD"))
18-
private void renderSavingIndicator(CallbackInfo callbackInfo, @Local GuiGraphics guiGraphics) {
18+
private void renderSavingIndicator(CallbackInfo callbackInfo, @Local(argsOnly = true) GuiGraphics guiGraphics) {
1919
HudInfoRenderer.renderInfo(guiGraphics);
2020
}
2121
}

0 commit comments

Comments
 (0)