From 1d11f5a65ba7ed2f14b9c4de0859eba9ffbeabb6 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Sun, 21 Jan 2024 15:04:19 +0600 Subject: [PATCH] (feature) limit unfocused fps --- .../silentclient/client/mixin/mixins/MinecraftMixin.java | 4 ++-- .../net/silentclient/client/mods/settings/FPSBoostMod.java | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java index 317558b..2c11666 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java @@ -332,8 +332,8 @@ public abstract class MinecraftMixin implements MinecraftExt { { if (this.theWorld == null && this.currentScreen != null) return this.currentScreen instanceof SilentScreen ? ((SilentScreen) this.currentScreen).getFpsLimit() : 30; - if(!Display.isActive()) { - return 60; + if(!Display.isActive() && Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Limit Unfocused FPS").getValBoolean()) { + return Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Unfocused FPS Limit").getValInt(); } return this.gameSettings.limitFramerate; diff --git a/src/main/java/net/silentclient/client/mods/settings/FPSBoostMod.java b/src/main/java/net/silentclient/client/mods/settings/FPSBoostMod.java index ca7e684..7209e04 100644 --- a/src/main/java/net/silentclient/client/mods/settings/FPSBoostMod.java +++ b/src/main/java/net/silentclient/client/mods/settings/FPSBoostMod.java @@ -38,6 +38,8 @@ public class FPSBoostMod extends Mod { @Override public void setup() { + this.setUpdated(true); + ArrayList lazyLoading = new ArrayList(); lazyLoading.add("Off"); @@ -57,6 +59,8 @@ public class FPSBoostMod extends Mod { this.addBooleanSetting("Low Graphics Mode", this, false); // ready this.addBooleanSetting("Hud Optimization", this, false); // ready this.addBooleanSetting("Optimized Entity Movement", this, true); + this.addBooleanSetting("Limit Unfocused FPS", this, true); + this.addSliderSetting("Unfocused FPS Limit", this, 60, 10, 200, true); this.addModeSetting("Lazy Chunk Loading", this, "Balance", lazyLoading); // ready this.addModeSetting("Occlusion Culling", this, "Balance", entityCulling); // ready this.addBooleanSetting("Hide Tall Grass", this, false); // ready @@ -107,7 +111,7 @@ public class FPSBoostMod extends Mod { return; } - if(setting.getName().equals("Optimized Entity Movement") || setting.getName().equals("Low Graphics Mode") || !setting.isCheck() || setting.getName().equals("Check glError") || setting.getName().equals("Do memory debug")) { + if(setting.getName().equals("Optimized Entity Movement") || setting.getName().equals("Low Graphics Mode") || !setting.isCheck() || setting.getName().equals("Check glError") || setting.getName().equals("Do memory debug") || setting.getName().equals("Limit Unfocused FPS")) { return; }