Skip to content

Commit

Permalink
fix(performance): clamp glint render distance to 8 chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
sylv256 committed Mar 10, 2025
1 parent 2c4ad4e commit e543152
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.minecraft.client.renderer.chunk.SectionRenderDispatcher;
import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
import net.minecraft.util.Mth;

import java.util.Set;
import java.util.stream.Collectors;
Expand All @@ -36,7 +37,7 @@ public final class SodiumCompatibility {
*/
public static Set<SectionPos> getRenderedSections(LevelRenderer levelRenderer) {
if (Constants.hasSodium() && Minecraft.getInstance().cameraEntity != null) {
int renderDistance = Minecraft.getInstance().options.getEffectiveRenderDistance();
int renderDistance = Mth.clamp(Minecraft.getInstance().options.getEffectiveRenderDistance(), 0, 8);
return SectionPos.cube(SectionPos.of(Minecraft.getInstance().cameraEntity.position()), renderDistance)
.filter(sectionPos -> {
BlockPos origin = sectionPos.origin();
Expand Down

0 comments on commit e543152

Please sign in to comment.