Add an option to disable the post-effect shader

This commit is contained in:
Sollace 2024-02-11 11:01:35 +00:00
parent 989d1df294
commit 18f2865264
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
2 changed files with 18 additions and 1 deletions

View file

@ -48,6 +48,9 @@ public class Config extends com.minelittlepony.common.util.settings.Config {
public final Setting<Boolean> simplifiedPortals = value("compatibility", "simplifiedPortals", false) public final Setting<Boolean> simplifiedPortals = value("compatibility", "simplifiedPortals", false)
.addComment("Disables dynamic portal rendering"); .addComment("Disables dynamic portal rendering");
public final Setting<Boolean> disableShaders = value("compatibility", "disableShaders", false)
.addComment("Disables post-effect shaders used by the corruption mechanic");
public final Setting<Long> fancyPortalRefreshRate = value("client", "fancyPortalRefreshRate", -1L) public final Setting<Long> fancyPortalRefreshRate = value("client", "fancyPortalRefreshRate", -1L)
.addComment("Sets the refresh rate of portals when using fancy portal rendering") .addComment("Sets the refresh rate of portals when using fancy portal rendering")
.addComment("Set to -1 (default) for unlimited"); .addComment("Set to -1 (default) for unlimited");

View file

@ -43,14 +43,24 @@ public class ViewportShader implements SynchronousResourceReloader, Identifiable
} }
public void loadShader(@Nullable Identifier shaderId) { public void loadShader(@Nullable Identifier shaderId) {
if (shader != null) { if (shader != null) {
shader.close(); try {
shader.close();
} catch (Throwable ignored) {
} finally {
shader = null;
}
} }
if (shaderId == null) { if (shaderId == null) {
return; return;
} }
if (Unicopia.getConfig().disableShaders.get()) {
return;
}
try { try {
shader = new LoadedShader(client, shaderId); shader = new LoadedShader(client, shaderId);
} catch (IOException e) { } catch (IOException e) {
@ -67,6 +77,10 @@ public class ViewportShader implements SynchronousResourceReloader, Identifiable
} }
public void render(float tickDelta) { public void render(float tickDelta) {
if (Unicopia.getConfig().disableShaders.get()) {
return;
}
if (shader != null && client.player != null) { if (shader != null && client.player != null) {
RenderSystem.disableBlend(); RenderSystem.disableBlend();
RenderSystem.disableDepthTest(); RenderSystem.disableDepthTest();