Skip to content

Commit

Permalink
fix: frame limit out of game uncapped (#5495)
Browse files Browse the repository at this point in the history
This fixes an issue where the FPS of the main menu and other menus would be uncapped when not in-game, resulting in the main menu being drawn at, say, 2400 FPS. The FPS limit is now capped at the refresh rate, which is also the FPS at which the JCEF client is drawn, giving the appropriate smooth feel without wasting performance on unused frames.
  • Loading branch information
1zun4 authored Jan 31, 2025
1 parent 98b5604 commit 1884a4c
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,21 @@
*/
package net.ccbluex.liquidbounce.injection.mixins.minecraft.render;

import net.ccbluex.liquidbounce.utils.render.RefreshRateKt;
import net.minecraft.client.option.InactivityFpsLimiter;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(InactivityFpsLimiter.class)
public abstract class MixinInactivityFpsLimiter {

@Shadow
private int maxFps;

/**
* Removes frame rate limit
*/
@ModifyConstant(method = "update", constant = @Constant(intValue = 60))
private int getFramerateLimit(int original) {
return maxFps;
return RefreshRateKt.getRefreshRate();
}

}

0 comments on commit 1884a4c

Please sign in to comment.