From 252d91861bd6f921eb06b60e8182af13ad72e8f1 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Fri, 6 Oct 2023 07:35:32 -0400 Subject: [PATCH 1/2] Check shouldCull when culling particles --- .../mixin/features/particle/cull/MixinParticleManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/jellysquid/mods/sodium/mixin/features/particle/cull/MixinParticleManager.java b/src/main/java/me/jellysquid/mods/sodium/mixin/features/particle/cull/MixinParticleManager.java index 5a365d136..ff22f26e6 100644 --- a/src/main/java/me/jellysquid/mods/sodium/mixin/features/particle/cull/MixinParticleManager.java +++ b/src/main/java/me/jellysquid/mods/sodium/mixin/features/particle/cull/MixinParticleManager.java @@ -68,7 +68,7 @@ private V filterParticleList(Map> map, Box box = particle.getBoundingBox(); // Hack: Grow the particle's bounding box in order to work around mis-behaved particles - if (this.cullingFrustum.isVisible(box.minX - 1.0D, box.minY - 1.0D, box.minZ - 1.0D, box.maxX + 1.0D, box.maxY + 1.0D, box.maxZ + 1.0D)) { + if (!particle.shouldCull() || this.cullingFrustum.isVisible(box.minX - 1.0D, box.minY - 1.0D, box.minZ - 1.0D, box.maxX + 1.0D, box.maxY + 1.0D, box.maxZ + 1.0D)) { filtered.add(particle); } } From e270c3acc82958b102a839d104280af26b032426 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Fri, 6 Oct 2023 19:34:21 -0400 Subject: [PATCH 2/2] Prevent crashing when config file is corrupt --- .../mods/sodium/client/gui/SodiumGameOptions.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptions.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptions.java index 8396f88cd..edfd2c368 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptions.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptions.java @@ -3,6 +3,8 @@ import com.google.gson.FieldNamingPolicy; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.JsonSyntaxException; +import me.jellysquid.mods.sodium.client.SodiumClientMod; import me.jellysquid.mods.sodium.client.gui.options.FormattedTextProvider; import me.jellysquid.mods.sodium.client.gui.options.TextProvider; import net.minecraft.client.option.GraphicsMode; @@ -104,12 +106,17 @@ public Text getLocalizedName() { public static SodiumGameOptions load(Path path) { SodiumGameOptions config; + boolean resaveConfig = true; if (Files.exists(path)) { try (FileReader reader = new FileReader(path.toFile())) { config = GSON.fromJson(reader, SodiumGameOptions.class); } catch (IOException e) { throw new RuntimeException("Could not parse config", e); + } catch (JsonSyntaxException e) { + SodiumClientMod.logger().error("Could not parse config, will fallback to default settings", e); + config = new SodiumGameOptions(); + resaveConfig = false; } } else { config = new SodiumGameOptions(); @@ -118,7 +125,8 @@ public static SodiumGameOptions load(Path path) { config.configPath = path; try { - config.writeChanges(); + if(resaveConfig) + config.writeChanges(); } catch (IOException e) { throw new RuntimeException("Couldn't update config file", e); }