Skip to content

Commit fafd8e5

Browse files
committed
Fix active FPS limits feeling stuttery
Signed-off-by: Lilly Rose Berner <lilly@lostluma.net>
1 parent c1a1756 commit fafd8e5

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

platforms/common/src/main/java/dynamic_fps/impl/Constants.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ public class Constants {
88
public static final boolean DEBUG = Platform.getInstance().isDevelopmentEnvironment();
99

1010
// Miscellaneous
11-
// Minecraft considers limits >=260 as infinite
11+
12+
// Minimum limit, for lower FPS we cancel frames
13+
public static final int MIN_FRAME_RATE_LIMIT = 15;
14+
// Minecraft considers limits >=260 as unlimited
1215
public static final int NO_FRAME_RATE_LIMIT = 260;
1316

1417
// The Cloth Config mod ID has changed a few times

platforms/common/src/main/java/dynamic_fps/impl/DynamicFPSMod.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ private static boolean checkForRender(long timeSinceLastRender) {
307307
return false;
308308
}
309309

310-
// Disable frame rate limiting
311-
if (frameRateTarget == Constants.NO_FRAME_RATE_LIMIT) {
310+
// Disable mod-side frame rate limiting
311+
if (frameRateTarget >= Constants.MIN_FRAME_RATE_LIMIT) {
312312
return true;
313313
}
314314

platforms/common/src/main/java/dynamic_fps/impl/mixin/FramerateLimitTrackerMixin.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private void getFramerateLimit(CallbackInfoReturnable<Integer> callbackInfo) {
3636
if (state != PowerState.FOCUSED) {
3737
// Instruct Minecraft to render a minimum of 15 FPS
3838
// Going lower here makes resuming again feel sluggish
39-
callbackInfo.setReturnValue(Math.max(this.getFramerateTarget(), 15));
39+
callbackInfo.setReturnValue(Math.max(this.getFramerateTarget(), Constants.MIN_FRAME_RATE_LIMIT));
4040
} else {
4141
IdleCondition condition = DynamicFPSConfig.INSTANCE.idle().condition();
4242

0 commit comments

Comments
 (0)