Skip to content

Commit

Permalink
Fix the infinite fps bug
Browse files Browse the repository at this point in the history
  • Loading branch information
N4TH4NOT committed Jun 3, 2024
1 parent e90b332 commit 4909b22
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@ public class WindowMixin {
*/
@Inject(method = "getFramerateLimit", at = @At("RETURN"), cancellable = true)
private void onGetFramerateLimit(CallbackInfoReturnable<Integer> callbackInfo) {
int target = DynamicFPSMod.targetFrameRate();

if (target != -1) {
// We're currently reducing the frame rate
// Instruct Minecraft to render max 15 FPS
// Going lower here makes resuming feel sluggish
callbackInfo.setReturnValue(Math.max(target, 15));
}
// We're currently reducing the frame rate
// Instruct Minecraft to render max 15 FPS
// Going lower here makes resuming feel sluggish
callbackInfo.setReturnValue(Math.max(Math.min(callbackInfo.getReturnValue(), DynamicFPSMod.targetFrameRate()), 15));
}
}

0 comments on commit 4909b22

Please sign in to comment.