Skip to content

Commit

Permalink
Merge pull request #18 from tildejustin/mac/1.16.1
Browse files Browse the repository at this point in the history
fix WorldRenderer not reloading on F3 + F
  • Loading branch information
tildejustin authored May 24, 2024
2 parents 3ebce9a + 939ffbe commit e04e7ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ yarn_mappings=1.16.1+build.21
loader_version=0.15.7

# Mod Properties
mod_version=3.1.1
mod_version=3.1.2
maven_group=me.jellysquid.mods
archives_base_name=sodium-fabric
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,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;
Expand Down Expand Up @@ -148,6 +149,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");

Expand Down Expand Up @@ -229,6 +234,8 @@ private void initRenderer() {
this.chunkRenderBackend = null;
}

this.renderDistance = this.client.options.viewDistance;

SodiumGameOptions opts = SodiumClientMod.options();

this.renderPassManager = BlockRenderPassManager.createDefaultMappings();
Expand All @@ -244,7 +251,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);
}

Expand Down

0 comments on commit e04e7ab

Please sign in to comment.