Fix shadow render distance reset to 32 (#856)

This commit is contained in:
TotallyNotOndre authored and GitHub committed 2025-01-31 11:18:09 -08:00
1 parent 0023fe3da2
commit 9ff1015d19
3 files changed
+14 -13

No files matched your search

@@ -1,6 +1,7 @@
package net.coderbot.iris.config;
import net.coderbot.iris.Iris;
import net.coderbot.iris.gui.option.IrisVideoSettings;
import java.io.IOException;
import java.io.InputStream;
@@ -122,13 +123,13 @@ public class IrisConfig {
enableShaders = !"false".equals(properties.getProperty("enableShaders"));
disableUpdateMessage = "true".equals(properties.getProperty("disableUpdateMessage"));
// TODO: GUI
// try {
// IrisVideoSettings.shadowDistance = Integer.parseInt(properties.getProperty("maxShadowRenderDistance", "32"));
// } catch (NumberFormatException e) {
// Iris.logger.error("Shadow distance setting reset; value is invalid.");
// IrisVideoSettings.shadowDistance = 32;
// save();
// }
try {
IrisVideoSettings.shadowDistance = Integer.parseInt(properties.getProperty("maxShadowRenderDistance", "32"));
} catch (NumberFormatException e) {
Iris.logger.error("Shadow distance setting reset; value is invalid.");
IrisVideoSettings.shadowDistance = 32;
save();
}
if (shaderPackName != null) {
if (shaderPackName.equals("(internal)") || shaderPackName.isEmpty()) {
@@ -147,8 +148,7 @@ public class IrisConfig {
properties.setProperty("shaderPack", getShaderPackName().orElse(""));
properties.setProperty("enableShaders", enableShaders ? "true" : "false");
properties.setProperty("disableUpdateMessage", disableUpdateMessage ? "true" : "false");
// properties.setProperty("maxShadowRenderDistance", String.valueOf(IrisVideoSettings.shadowDistance));
properties.setProperty("maxShadowRenderDistance", String.valueOf(32));
properties.setProperty("maxShadowRenderDistance", String.valueOf(IrisVideoSettings.shadowDistance));
// NB: This uses ISO-8859-1 with unicode escapes as the encoding
try (OutputStream os = Files.newOutputStream(propertiesPath)) {
properties.store(os, COMMENT);