Custom FPS Limit in Silent Menu

This commit is contained in:
kirillsaint 2023-09-22 21:22:52 +06:00
parent be98355ab1
commit 8318d25350
3 changed files with 9 additions and 5 deletions

View File

@ -46,4 +46,8 @@ public class SilentScreen extends GuiScreen {
super.onGuiClosed();
Client.getInstance().getMouseCursorHandler().disableCursor();
}
public int getFpsLimit() {
return 120;
}
}

View File

@ -17,9 +17,9 @@ public class C17PacketCustomPayloadMixin {
@Inject(method = "processPacket(Lnet/minecraft/network/play/INetHandlerPlayServer;)V", at = @At("TAIL"))
private void silent$releaseData(INetHandlerPlayServer handler, CallbackInfo ci) {
// if (this.data != null) {
// this.data.release();
// }
if (this.data != null) {
this.data.release();
}
}
//#endif
}

View File

@ -318,13 +318,13 @@ public abstract class MinecraftMixin implements MinecraftExt {
@Overwrite
public int getLimitFramerate()
{
if (this.theWorld == null && this.currentScreen != null) return this.theWorld == null && this.currentScreen != null ? 30 : this.gameSettings.limitFramerate;
if (this.theWorld == null && this.currentScreen != null) return this.currentScreen instanceof SilentScreen ? ((SilentScreen) this.currentScreen).getFpsLimit() : 30;
if(!Display.isActive()) {
return 60;
}
return this.theWorld == null && this.currentScreen != null ? 30 : this.gameSettings.limitFramerate;
return this.gameSettings.limitFramerate;
}
@Override