Update framerate limit to be like optifine

This commit is contained in:
PeytonPlayz595 2024-06-04 12:52:23 -04:00
parent c94f03e0e0
commit f2b1319d3b
3 changed files with 39 additions and 27 deletions

View File

@ -94,7 +94,7 @@ public class GameSettings {
public boolean viewBobbing = true; public boolean viewBobbing = true;
public boolean anaglyph; public boolean anaglyph;
public boolean fboEnable = true; public boolean fboEnable = true;
public int limitFramerate = 260; public int limitFramerate = 120;
/**+ /**+
* Clouds flag * Clouds flag
*/ */
@ -298,6 +298,7 @@ public class GameSettings {
this.language = EagRuntime.getConfiguration().getDefaultLocale(); this.language = EagRuntime.getConfiguration().getDefaultLocale();
this.forceUnicodeFont = false; this.forceUnicodeFont = false;
this.mc = mcIn; this.mc = mcIn;
this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
GameSettings.Options.RENDER_DISTANCE.setValueMax(18.0F); GameSettings.Options.RENDER_DISTANCE.setValueMax(18.0F);
this.renderDistanceChunks = 4; this.renderDistanceChunks = 4;
@ -354,6 +355,12 @@ public class GameSettings {
if (parOptions == GameSettings.Options.FRAMERATE_LIMIT) { if (parOptions == GameSettings.Options.FRAMERATE_LIMIT) {
this.limitFramerate = (int) parFloat1; this.limitFramerate = (int) parFloat1;
this.enableVsync = false;
if (this.limitFramerate <= 0) {
this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
this.enableVsync = true;
}
} }
if (parOptions == GameSettings.Options.CHAT_OPACITY) { if (parOptions == GameSettings.Options.CHAT_OPACITY) {
@ -922,10 +929,6 @@ public class GameSettings {
this.mc.getRenderManager().setEnableFNAWSkins(this.mc.getEnableFNAWSkins()); this.mc.getRenderManager().setEnableFNAWSkins(this.mc.getEnableFNAWSkins());
} }
if (parOptions == GameSettings.Options.EAGLER_VSYNC) {
this.enableVsync = !this.enableVsync;
}
if(parOptions == GameSettings.Options.FULLBRIGHT) { if(parOptions == GameSettings.Options.FULLBRIGHT) {
this.fullBright = !this.fullBright; this.fullBright = !this.fullBright;
} }
@ -971,7 +974,7 @@ public class GameSettings {
: (parOptions == GameSettings.Options.CHAT_HEIGHT_UNFOCUSED ? this.chatHeightUnfocused : (parOptions == GameSettings.Options.CHAT_HEIGHT_UNFOCUSED ? this.chatHeightUnfocused
: (parOptions == GameSettings.Options.CHAT_SCALE ? this.chatScale : (parOptions == GameSettings.Options.CHAT_SCALE ? this.chatScale
: (parOptions == GameSettings.Options.CHAT_WIDTH ? this.chatWidth : (parOptions == GameSettings.Options.CHAT_WIDTH ? this.chatWidth
: (parOptions == GameSettings.Options.FRAMERATE_LIMIT ? (float) this.limitFramerate : (parOptions == GameSettings.Options.FRAMERATE_LIMIT ? ((float)this.limitFramerate == GameSettings.Options.FRAMERATE_LIMIT.getValueMax() && this.enableVsync ? 0.0F : (float)this.limitFramerate)
: (parOptions == GameSettings.Options.MIPMAP_LEVELS ? (float) this.mipmapLevels : (parOptions == GameSettings.Options.MIPMAP_LEVELS ? (float) this.mipmapLevels
: (parOptions == GameSettings.Options.RENDER_DISTANCE ? (float) this.renderDistanceChunks : (parOptions == GameSettings.Options.RENDER_DISTANCE ? (float) this.renderDistanceChunks
: (parOptions == GameSettings.Options.AO_LEVEL ? this.ofAoLevel : (parOptions == GameSettings.Options.AO_LEVEL ? this.ofAoLevel
@ -1082,8 +1085,6 @@ public class GameSettings {
return hidePassword; return hidePassword;
case FNAW_SKINS: case FNAW_SKINS:
return this.enableFNAWSkins; return this.enableFNAWSkins;
case EAGLER_VSYNC:
return this.enableVsync;
case FULLBRIGHT: case FULLBRIGHT:
return this.fullBright; return this.fullBright;
case LEFT_HAND: case LEFT_HAND:
@ -1137,7 +1138,7 @@ public class GameSettings {
float f = parOptions.normalizeValue(f1); float f = parOptions.normalizeValue(f1);
return parOptions == GameSettings.Options.SENSITIVITY ? (f == 0.0F ? s + I18n.format("options.sensitivity.min", new Object[0]) : (f == 1.0F ? s + I18n.format("options.sensitivity.max", new Object[0]) : s + (int) (f * 200.0F) + "%")) return parOptions == GameSettings.Options.SENSITIVITY ? (f == 0.0F ? s + I18n.format("options.sensitivity.min", new Object[0]) : (f == 1.0F ? s + I18n.format("options.sensitivity.max", new Object[0]) : s + (int) (f * 200.0F) + "%"))
: (parOptions == GameSettings.Options.FOV ? (f1 == 70.0F ? s + I18n.format("options.fov.min", new Object[0]) : (f1 == 110.0F ? s + I18n.format("options.fov.max", new Object[0]) : s + (int) f1)) : (parOptions == GameSettings.Options.FOV ? (f1 == 70.0F ? s + I18n.format("options.fov.min", new Object[0]) : (f1 == 110.0F ? s + I18n.format("options.fov.max", new Object[0]) : s + (int) f1))
: (parOptions == GameSettings.Options.FRAMERATE_LIMIT ? (f1 == parOptions.valueMax ? s + I18n.format("options.framerateLimit.max", new Object[0]) : s + (int) f1 + " fps") : (parOptions == GameSettings.Options.FRAMERATE_LIMIT ? (f1 == 0.0f ? s + "VSync" : f1 == parOptions.valueMax ? s + I18n.format("options.framerateLimit.max", new Object[0]) : s + (int)f1 + " fps")
: (parOptions == GameSettings.Options.RENDER_CLOUDS ? (f1 == parOptions.valueMin ? s + I18n.format("options.cloudHeight.min", new Object[0]) : s + ((int) f1 + 128)) : (parOptions == GameSettings.Options.RENDER_CLOUDS ? (f1 == parOptions.valueMin ? s + I18n.format("options.cloudHeight.min", new Object[0]) : s + ((int) f1 + 128))
: (parOptions == GameSettings.Options.GAMMA ? (f == 0.0F ? s + I18n.format("options.gamma.min", new Object[0]) : (f == 1.0F ? s + I18n.format("options.gamma.max", new Object[0]) : s + "+" + (int) (f * 100.0F) + "%")) : (parOptions == GameSettings.Options.GAMMA ? (f == 0.0F ? s + I18n.format("options.gamma.min", new Object[0]) : (f == 1.0F ? s + I18n.format("options.gamma.max", new Object[0]) : s + "+" + (int) (f * 100.0F) + "%"))
: (parOptions == GameSettings.Options.SATURATION ? s + (int) (f * 400.0F) + "%" : (parOptions == GameSettings.Options.SATURATION ? s + (int) (f * 400.0F) + "%"
@ -1454,6 +1455,12 @@ public class GameSettings {
if (astring[0].equals("maxFps")) { if (astring[0].equals("maxFps")) {
this.limitFramerate = Integer.parseInt(astring[1]); this.limitFramerate = Integer.parseInt(astring[1]);
this.enableVsync = false;
if (this.limitFramerate <= 0) {
this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
this.enableVsync = true;
}
} }
if (astring[0].equals("fboEnable")) { if (astring[0].equals("fboEnable")) {
@ -1558,7 +1565,7 @@ public class GameSettings {
} }
if (astring[0].equals("enableVsyncEag")) { if (astring[0].equals("enableVsyncEag")) {
this.enableVsync = astring[1].equals("true"); //this.enableVsync = astring[1].equals("true");
} }
if (astring[0].equals("hideServerAddress")) { if (astring[0].equals("hideServerAddress")) {
@ -2099,7 +2106,7 @@ public class GameSettings {
printwriter.println("chatLinksPrompt:" + this.chatLinksPrompt); printwriter.println("chatLinksPrompt:" + this.chatLinksPrompt);
printwriter.println("chatOpacity:" + this.chatOpacity); printwriter.println("chatOpacity:" + this.chatOpacity);
printwriter.println("snooperEnabled:" + this.snooperEnabled); printwriter.println("snooperEnabled:" + this.snooperEnabled);
printwriter.println("enableVsyncEag:" + this.enableVsync); //printwriter.println("enableVsyncEag:" + this.enableVsync);
printwriter.println("hideServerAddress:" + this.hideServerAddress); printwriter.println("hideServerAddress:" + this.hideServerAddress);
printwriter.println("advancedItemTooltips:" + this.advancedItemTooltips); printwriter.println("advancedItemTooltips:" + this.advancedItemTooltips);
printwriter.println("pauseOnLostFocus:" + this.pauseOnLostFocus); printwriter.println("pauseOnLostFocus:" + this.pauseOnLostFocus);
@ -2308,7 +2315,7 @@ public class GameSettings {
RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 16.0F, 1.0F), RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 16.0F, 1.0F),
VIEW_BOBBING("options.viewBobbing", false, true), VIEW_BOBBING("options.viewBobbing", false, true),
ANAGLYPH("options.anaglyph", false, true), ANAGLYPH("options.anaglyph", false, true),
FRAMERATE_LIMIT("options.framerateLimit", true, false, 10.0F, 260.0F, 10.0F), FRAMERATE_LIMIT("options.framerateLimit", true, false, 0.0F, 260.0F, 5.0F),
FBO_ENABLE("options.fboEnable", false, true), FBO_ENABLE("options.fboEnable", false, true),
RENDER_CLOUDS("options.renderClouds", false, false), RENDER_CLOUDS("options.renderClouds", false, false),
GRAPHICS("options.graphics", false, false), GRAPHICS("options.graphics", false, false),
@ -2412,7 +2419,6 @@ public class GameSettings {
CUSTOM_COLORS("Custom Colors", false, false), CUSTOM_COLORS("Custom Colors", false, false),
HIDE_PASSWORD("Hide Password", false, false), HIDE_PASSWORD("Hide Password", false, false),
FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true), FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true),
EAGLER_VSYNC("options.vsync", false, true),
FULLBRIGHT("Fullbright", false, true), FULLBRIGHT("Fullbright", false, true),
LEFT_HAND("Main Hand", false, true), LEFT_HAND("Main Hand", false, true),
ENTITY_CULLING("Entity Culling", false, true), ENTITY_CULLING("Entity Culling", false, true),

View File

@ -49,7 +49,7 @@ public class GuiVideoSettings extends GuiScreen {
GameSettings.Options.AO_LEVEL, GameSettings.Options.AO_LEVEL,
GameSettings.Options.VIEW_BOBBING, GameSettings.Options.VIEW_BOBBING,
GameSettings.Options.GUI_SCALE, GameSettings.Options.GUI_SCALE,
GameSettings.Options.EAGLER_VSYNC, GameSettings.Options.USE_VBO,
GameSettings.Options.GAMMA, GameSettings.Options.GAMMA,
GameSettings.Options.BLOCK_ALTERNATIVES, GameSettings.Options.BLOCK_ALTERNATIVES,
GameSettings.Options.FOG_FANCY, GameSettings.Options.FOG_FANCY,

View File

@ -96,7 +96,7 @@ public class GameSettings extends ModData {
public boolean viewBobbing = true; public boolean viewBobbing = true;
public boolean anaglyph; public boolean anaglyph;
public boolean fboEnable = true; public boolean fboEnable = true;
public int limitFramerate = 260; public int limitFramerate = 120;
/**+ /**+
* Clouds flag * Clouds flag
*/ */
@ -300,6 +300,7 @@ public class GameSettings extends ModData {
this.language = EagRuntime.getConfiguration().getDefaultLocale(); this.language = EagRuntime.getConfiguration().getDefaultLocale();
this.forceUnicodeFont = false; this.forceUnicodeFont = false;
this.mc = mcIn; this.mc = mcIn;
this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
GameSettings.Options.RENDER_DISTANCE.setValueMax(18.0F); GameSettings.Options.RENDER_DISTANCE.setValueMax(18.0F);
this.renderDistanceChunks = 4; this.renderDistanceChunks = 4;
@ -518,6 +519,12 @@ public class GameSettings extends ModData {
if (parOptions == GameSettings.Options.FRAMERATE_LIMIT) { if (parOptions == GameSettings.Options.FRAMERATE_LIMIT) {
this.limitFramerate = (int) parFloat1; this.limitFramerate = (int) parFloat1;
this.enableVsync = false;
if (this.limitFramerate <= 0) {
this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
this.enableVsync = true;
}
} }
if (parOptions == GameSettings.Options.CHAT_OPACITY) { if (parOptions == GameSettings.Options.CHAT_OPACITY) {
@ -1086,10 +1093,6 @@ public class GameSettings extends ModData {
this.mc.getRenderManager().setEnableFNAWSkins(this.mc.getEnableFNAWSkins()); this.mc.getRenderManager().setEnableFNAWSkins(this.mc.getEnableFNAWSkins());
} }
if (parOptions == GameSettings.Options.EAGLER_VSYNC) {
this.enableVsync = !this.enableVsync;
}
if(parOptions == GameSettings.Options.FULLBRIGHT) { if(parOptions == GameSettings.Options.FULLBRIGHT) {
this.fullBright = !this.fullBright; this.fullBright = !this.fullBright;
} }
@ -1135,7 +1138,7 @@ public class GameSettings extends ModData {
: (parOptions == GameSettings.Options.CHAT_HEIGHT_UNFOCUSED ? this.chatHeightUnfocused : (parOptions == GameSettings.Options.CHAT_HEIGHT_UNFOCUSED ? this.chatHeightUnfocused
: (parOptions == GameSettings.Options.CHAT_SCALE ? this.chatScale : (parOptions == GameSettings.Options.CHAT_SCALE ? this.chatScale
: (parOptions == GameSettings.Options.CHAT_WIDTH ? this.chatWidth : (parOptions == GameSettings.Options.CHAT_WIDTH ? this.chatWidth
: (parOptions == GameSettings.Options.FRAMERATE_LIMIT ? (float) this.limitFramerate : (parOptions == GameSettings.Options.FRAMERATE_LIMIT ? ((float)this.limitFramerate == GameSettings.Options.FRAMERATE_LIMIT.getValueMax() && this.enableVsync ? 0.0F : (float)this.limitFramerate)
: (parOptions == GameSettings.Options.MIPMAP_LEVELS ? (float) this.mipmapLevels : (parOptions == GameSettings.Options.MIPMAP_LEVELS ? (float) this.mipmapLevels
: (parOptions == GameSettings.Options.RENDER_DISTANCE ? (float) this.renderDistanceChunks : (parOptions == GameSettings.Options.RENDER_DISTANCE ? (float) this.renderDistanceChunks
: (parOptions == GameSettings.Options.AO_LEVEL ? this.ofAoLevel : (parOptions == GameSettings.Options.AO_LEVEL ? this.ofAoLevel
@ -1244,8 +1247,6 @@ public class GameSettings extends ModData {
return this.ofCustomColors; return this.ofCustomColors;
case FNAW_SKINS: case FNAW_SKINS:
return this.enableFNAWSkins; return this.enableFNAWSkins;
case EAGLER_VSYNC:
return this.enableVsync;
case FULLBRIGHT: case FULLBRIGHT:
return this.fullBright; return this.fullBright;
case LEFT_HAND: case LEFT_HAND:
@ -1301,7 +1302,7 @@ public class GameSettings extends ModData {
float f = parOptions.normalizeValue(f1); float f = parOptions.normalizeValue(f1);
return parOptions == GameSettings.Options.SENSITIVITY ? (f == 0.0F ? s + I18n.format("options.sensitivity.min", new Object[0]) : (f == 1.0F ? s + I18n.format("options.sensitivity.max", new Object[0]) : s + (int) (f * 200.0F) + "%")) return parOptions == GameSettings.Options.SENSITIVITY ? (f == 0.0F ? s + I18n.format("options.sensitivity.min", new Object[0]) : (f == 1.0F ? s + I18n.format("options.sensitivity.max", new Object[0]) : s + (int) (f * 200.0F) + "%"))
: (parOptions == GameSettings.Options.FOV ? (f1 == 70.0F ? s + I18n.format("options.fov.min", new Object[0]) : (f1 == 110.0F ? s + I18n.format("options.fov.max", new Object[0]) : s + (int) f1)) : (parOptions == GameSettings.Options.FOV ? (f1 == 70.0F ? s + I18n.format("options.fov.min", new Object[0]) : (f1 == 110.0F ? s + I18n.format("options.fov.max", new Object[0]) : s + (int) f1))
: (parOptions == GameSettings.Options.FRAMERATE_LIMIT ? (f1 == parOptions.valueMax ? s + I18n.format("options.framerateLimit.max", new Object[0]) : s + (int) f1 + " fps") : (parOptions == GameSettings.Options.FRAMERATE_LIMIT ? (f1 == 0.0f ? s + "VSync" : f1 == parOptions.valueMax ? s + I18n.format("options.framerateLimit.max", new Object[0]) : s + (int)f1 + " fps")
: (parOptions == GameSettings.Options.RENDER_CLOUDS ? (f1 == parOptions.valueMin ? s + I18n.format("options.cloudHeight.min", new Object[0]) : s + ((int) f1 + 128)) : (parOptions == GameSettings.Options.RENDER_CLOUDS ? (f1 == parOptions.valueMin ? s + I18n.format("options.cloudHeight.min", new Object[0]) : s + ((int) f1 + 128))
: (parOptions == GameSettings.Options.GAMMA ? (f == 0.0F ? s + I18n.format("options.gamma.min", new Object[0]) : (f == 1.0F ? s + I18n.format("options.gamma.max", new Object[0]) : s + "+" + (int) (f * 100.0F) + "%")) : (parOptions == GameSettings.Options.GAMMA ? (f == 0.0F ? s + I18n.format("options.gamma.min", new Object[0]) : (f == 1.0F ? s + I18n.format("options.gamma.max", new Object[0]) : s + "+" + (int) (f * 100.0F) + "%"))
: (parOptions == GameSettings.Options.SATURATION ? s + (int) (f * 400.0F) + "%" : (parOptions == GameSettings.Options.SATURATION ? s + (int) (f * 400.0F) + "%"
@ -1618,6 +1619,12 @@ public class GameSettings extends ModData {
if (astring[0].equals("maxFps")) { if (astring[0].equals("maxFps")) {
this.limitFramerate = Integer.parseInt(astring[1]); this.limitFramerate = Integer.parseInt(astring[1]);
this.enableVsync = false;
if (this.limitFramerate <= 0) {
this.limitFramerate = (int)GameSettings.Options.FRAMERATE_LIMIT.getValueMax();
this.enableVsync = true;
}
} }
if (astring[0].equals("fboEnable")) { if (astring[0].equals("fboEnable")) {
@ -1722,7 +1729,7 @@ public class GameSettings extends ModData {
} }
if (astring[0].equals("enableVsyncEag")) { if (astring[0].equals("enableVsyncEag")) {
this.enableVsync = astring[1].equals("true"); //this.enableVsync = astring[1].equals("true");
} }
if (astring[0].equals("hideServerAddress")) { if (astring[0].equals("hideServerAddress")) {
@ -2263,7 +2270,7 @@ public class GameSettings extends ModData {
printwriter.println("chatLinksPrompt:" + this.chatLinksPrompt); printwriter.println("chatLinksPrompt:" + this.chatLinksPrompt);
printwriter.println("chatOpacity:" + this.chatOpacity); printwriter.println("chatOpacity:" + this.chatOpacity);
printwriter.println("snooperEnabled:" + this.snooperEnabled); printwriter.println("snooperEnabled:" + this.snooperEnabled);
printwriter.println("enableVsyncEag:" + this.enableVsync); //printwriter.println("enableVsyncEag:" + this.enableVsync);
printwriter.println("hideServerAddress:" + this.hideServerAddress); printwriter.println("hideServerAddress:" + this.hideServerAddress);
printwriter.println("advancedItemTooltips:" + this.advancedItemTooltips); printwriter.println("advancedItemTooltips:" + this.advancedItemTooltips);
printwriter.println("pauseOnLostFocus:" + this.pauseOnLostFocus); printwriter.println("pauseOnLostFocus:" + this.pauseOnLostFocus);
@ -2472,7 +2479,7 @@ public class GameSettings extends ModData {
RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 16.0F, 1.0F), RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 16.0F, 1.0F),
VIEW_BOBBING("options.viewBobbing", false, true), VIEW_BOBBING("options.viewBobbing", false, true),
ANAGLYPH("options.anaglyph", false, true), ANAGLYPH("options.anaglyph", false, true),
FRAMERATE_LIMIT("options.framerateLimit", true, false, 10.0F, 260.0F, 10.0F), FRAMERATE_LIMIT("options.framerateLimit", true, false, 0.0F, 260.0F, 5.0F),
FBO_ENABLE("options.fboEnable", false, true), FBO_ENABLE("options.fboEnable", false, true),
RENDER_CLOUDS("options.renderClouds", false, false), RENDER_CLOUDS("options.renderClouds", false, false),
GRAPHICS("options.graphics", false, false), GRAPHICS("options.graphics", false, false),
@ -2576,7 +2583,6 @@ public class GameSettings extends ModData {
CUSTOM_COLORS("Custom Colors", false, false), CUSTOM_COLORS("Custom Colors", false, false),
HIDE_PASSWORD("Hide Password", false, false), HIDE_PASSWORD("Hide Password", false, false),
FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true), FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true),
EAGLER_VSYNC("options.vsync", false, true),
FULLBRIGHT("Fullbright", false, true), FULLBRIGHT("Fullbright", false, true),
LEFT_HAND("Main Hand", false, true), LEFT_HAND("Main Hand", false, true),
ENTITY_CULLING("Entity Culling", false, true), ENTITY_CULLING("Entity Culling", false, true),