Skip to content

Commit

Permalink
Do not assume SodiumWorldRenderer to always be available (fixes Johni…
Browse files Browse the repository at this point in the history
  • Loading branch information
Johni0702 committed Mar 24, 2023
1 parent 60ef5e7 commit bbea940
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 4.0.5-SNAPSHOT
- Fix unloading of block entities without "Disable Block Entities" (#142)
- Fix crash when Sodium chunk_rendering mixins are disabled (#143)

### 4.0.4
- Update to Minecraft 1.19.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
public class SodiumChunkStatusListenerImpl implements ChunkStatusListener {
@Override
public void onChunkAdded(int x, int z) {
SodiumWorldRenderer sodiumRenderer = SodiumWorldRenderer.instance();
sodiumRenderer.onChunkAdded(x, z);
sodiumRenderer.onChunkLightAdded(x, z); // fake chunks have their light ready immediately
SodiumWorldRenderer sodiumRenderer = SodiumWorldRenderer.instanceNullable();
if (sodiumRenderer != null) {
sodiumRenderer.onChunkAdded(x, z);
sodiumRenderer.onChunkLightAdded(x, z); // fake chunks have their light ready immediately
}
}

@Override
public void onChunkRemoved(int x, int z) {
SodiumWorldRenderer.instance().onChunkRemoved(x, z);
SodiumWorldRenderer sodiumRenderer = SodiumWorldRenderer.instanceNullable();
if (sodiumRenderer != null) {
sodiumRenderer.onChunkRemoved(x, z);
}
}
}

0 comments on commit bbea940

Please sign in to comment.