From 0b7de9cc8daedd3fbe33f977dbe9a460d0ba0012 Mon Sep 17 00:00:00 2001 From: jellysquid3 Date: Sat, 12 Jun 2021 11:41:52 -0400 Subject: [PATCH 1/3] fix: Reload renderer on view distance change automatically Allows for F3 hotkeys to work, since they don't go through our video settings screen. This is kind of a hack, but it's what vanilla does anyways. --- .../mods/sodium/client/gui/SodiumGameOptionPages.java | 1 - .../mods/sodium/client/render/SodiumWorldRenderer.java | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java index edb096a0..3819e2db 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java @@ -34,7 +34,6 @@ public static OptionPage general() { .setControl(option -> new SliderControl(option, 2, 32, 1, ControlValueFormatter.quantity("Chunks"))) .setBinding((options, value) -> options.viewDistance = value, options -> options.viewDistance) .setImpact(OptionImpact.HIGH) - .setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD) .build()) .add(OptionImpl.createBuilder(int.class, vanillaOpts) .setName("Brightness") diff --git a/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java b/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java index 6f44d168..134a23ed 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/render/SodiumWorldRenderer.java @@ -44,6 +44,7 @@ public class SodiumWorldRenderer implements ChunkStatusListener { private final MinecraftClient client; private ClientWorld world; + private int renderDistance; private double lastCameraX, lastCameraY, lastCameraZ; private double lastCameraPitch, lastCameraYaw; @@ -125,6 +126,10 @@ public void updateChunks(Camera camera, Frustum frustum, boolean hasForcedFrustu this.useEntityCulling = SodiumClientMod.options().advanced.useEntityCulling; + if (this.client.options.viewDistance != this.renderDistance) { + this.reload(); + } + Profiler profiler = this.client.getProfiler(); profiler.push("camera_setup"); @@ -206,6 +211,8 @@ private void initRenderer() { this.chunkRenderBackend = null; } + this.renderDistance = this.client.options.viewDistance; + SodiumGameOptions opts = SodiumClientMod.options(); this.renderPassManager = BlockRenderPassManager.createDefaultMappings(); @@ -221,7 +228,7 @@ private void initRenderer() { this.chunkRenderBackend = createChunkRenderBackend(opts.advanced.chunkRendererBackend, vertexFormat); this.chunkRenderBackend.createShaders(); - this.chunkRenderManager = new ChunkRenderManager<>(this, this.chunkRenderBackend, this.renderPassManager, this.world, this.client.options.viewDistance); + this.chunkRenderManager = new ChunkRenderManager<>(this, this.chunkRenderBackend, this.renderPassManager, this.world, this.renderDistance); this.chunkRenderManager.restoreChunks(this.loadedChunkPositions); } From 869355cd48949722af61bd055855a6e6150ed2bb Mon Sep 17 00:00:00 2001 From: jellysquid3 Date: Thu, 17 Jun 2021 14:19:58 -0500 Subject: [PATCH 2/3] change: Always reload the renderer when changing view distance --- .../jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java index 3819e2db..edb096a0 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/SodiumGameOptionPages.java @@ -34,6 +34,7 @@ public static OptionPage general() { .setControl(option -> new SliderControl(option, 2, 32, 1, ControlValueFormatter.quantity("Chunks"))) .setBinding((options, value) -> options.viewDistance = value, options -> options.viewDistance) .setImpact(OptionImpact.HIGH) + .setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD) .build()) .add(OptionImpl.createBuilder(int.class, vanillaOpts) .setName("Brightness") From 14cf038c1f9eb9af7416973a8472d6db143ea2ee Mon Sep 17 00:00:00 2001 From: tildejustin Date: Fri, 24 May 2024 07:17:20 -0400 Subject: [PATCH 3/3] bump version to 1.2.2 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 9908747c..60b2b7f2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.parallel = true org.gradle.caching = true loom.mixin.useLegacyMixinAp = false -mod_version = 1.2.1 +mod_version = 1.2.2 minecraft_version = 20w14infinite yarn_mappings = 20w14infinite+build.4 loader_version = 0.15.6