Skip to content

Commit

Permalink
Fix shadow render distance reset to 32 (#856)
Browse files Browse the repository at this point in the history
  • Loading branch information
TotallyNotOndre authored Jan 31, 2025
1 parent 0023fe3 commit 9ff1015
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
18 changes: 9 additions & 9 deletions src/main/java/net/coderbot/iris/config/IrisConfig.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -122,13 +123,13 @@ public void load() throws IOException {
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()) {
Expand All @@ -147,8 +148,7 @@ public void save() throws IOException {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class IrisVideoSettings {
public static int shadowDistance = 32;

// TODO: Tell the user to check in the shader options once that's supported.
private static final String DISABLED_TOOLTIP = I18n.format("options.iris.shadowDistance.disabled");
private static final String ENABLED_TOOLTIP = I18n.format("options.iris.shadowDistance.enabled");
// private static final String DISABLED_TOOLTIP = I18n.format("options.iris.shadowDistance.disabled");
// private static final String ENABLED_TOOLTIP = I18n.format("options.iris.shadowDistance.enabled");

public static int getOverriddenShadowDistance(int base) {
return Iris.getPipelineManager().getPipeline()
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/coderbot/iris/pipeline/ShadowRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Objects;
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
import net.coderbot.iris.Iris;
import net.coderbot.iris.gui.option.IrisVideoSettings;
import net.coderbot.iris.shaderpack.OptionalBoolean;
import net.coderbot.iris.shaderpack.PackDirectives;
import net.coderbot.iris.shaderpack.PackShadowDirectives;
Expand Down Expand Up @@ -284,8 +285,8 @@ private FrustumHolder createShadowFrustum(float renderMultiplier, FrustumHolder

if (renderMultiplier < 0) {
// TODO: GUI
// distance = IrisVideoSettings.shadowDistance * 16;
distance = 32 * 16;
distance = IrisVideoSettings.shadowDistance * 16; // can be zero :(
//distance = 32 * 16;
setter = "(set by user)";
}

Expand Down

0 comments on commit 9ff1015

Please sign in to comment.