From 7a3aedaf167936287c16f07e6edcfc99674e4261 Mon Sep 17 00:00:00 2001 From: LostLuma Date: Mon, 30 Oct 2023 14:10:59 +0100 Subject: [PATCH] Remove suspended power state entirely --- src/main/java/dynamic_fps/impl/DynamicFPSMod.java | 10 +--------- src/main/java/dynamic_fps/impl/PowerState.java | 7 +------ src/main/java/dynamic_fps/impl/config/Config.java | 1 - .../dynamic_fps/impl/config/DynamicFPSConfig.java | 14 ++++---------- 4 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/main/java/dynamic_fps/impl/DynamicFPSMod.java b/src/main/java/dynamic_fps/impl/DynamicFPSMod.java index 8acbdaa0..121518aa 100644 --- a/src/main/java/dynamic_fps/impl/DynamicFPSMod.java +++ b/src/main/java/dynamic_fps/impl/DynamicFPSMod.java @@ -127,10 +127,6 @@ private static boolean isDisabledInternal() { return isDisabled || FREX.isFlawlessFramesActive(); } - private static boolean isPauseScreenOpened() { - return minecraft.screen instanceof PauseScreen; - } - private static boolean isLevelCoveredByScreen() { return minecraft.screen != null && minecraft.screen.dynamic_fps$rendersBackground(); } @@ -183,11 +179,7 @@ private static void checkForStateChanges() { } else if (isForcingLowFPS) { current = PowerState.UNFOCUSED; } else if (window.isFocused()) { - if (!isPauseScreenOpened()) { - current = PowerState.FOCUSED; - } else { - current = PowerState.SUSPENDED; - } + current = PowerState.FOCUSED; } else if (window.isHovered()) { current = PowerState.HOVERED; } else if (!window.isIconified()) { diff --git a/src/main/java/dynamic_fps/impl/PowerState.java b/src/main/java/dynamic_fps/impl/PowerState.java index 00a6d530..2fc1cee4 100644 --- a/src/main/java/dynamic_fps/impl/PowerState.java +++ b/src/main/java/dynamic_fps/impl/PowerState.java @@ -31,12 +31,7 @@ public enum PowerState { /* * Window minimized or otherwise hidden. */ - INVISIBLE(true), - - /* - * User is currently on the pause screen. - */ - SUSPENDED(false); + INVISIBLE(true); public final boolean configurable; diff --git a/src/main/java/dynamic_fps/impl/config/Config.java b/src/main/java/dynamic_fps/impl/config/Config.java index f6186d06..d01a3844 100644 --- a/src/main/java/dynamic_fps/impl/config/Config.java +++ b/src/main/java/dynamic_fps/impl/config/Config.java @@ -21,7 +21,6 @@ public final class Config { ).apply(instance, Config::new)); public static final Config ACTIVE = new Config(-1, 1.0f, GraphicsState.DEFAULT, true, false); - public static final Config SUSPENDED = new Config(60, 1.0f, GraphicsState.DEFAULT, true, false); public Config(int frameRateTarget, float volumeMultiplier, GraphicsState graphicsState, boolean showToasts, boolean runGarbageCollector) { this.frameRateTarget = frameRateTarget; diff --git a/src/main/java/dynamic_fps/impl/config/DynamicFPSConfig.java b/src/main/java/dynamic_fps/impl/config/DynamicFPSConfig.java index b030b860..747f5bff 100644 --- a/src/main/java/dynamic_fps/impl/config/DynamicFPSConfig.java +++ b/src/main/java/dynamic_fps/impl/config/DynamicFPSConfig.java @@ -39,16 +39,10 @@ private DynamicFPSConfig(Map configs) { } public Config get(PowerState state) { - switch (state) { - case FOCUSED: { - return Config.ACTIVE; - } - case SUSPENDED: { - return Config.SUSPENDED; - } - default: { - return configs.get(state); - } + if (state == PowerState.FOCUSED) { + return Config.ACTIVE; + } else { + return configs.get(state); } }