Skip to content

Commit

Permalink
Fix sky rendering with render distance greater than 32 (fixes Johni07…
Browse files Browse the repository at this point in the history
  • Loading branch information
Johni0702 committed Apr 1, 2023
1 parent 3ec9467 commit 3cfff04
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### 4.0.6-SNAPSHOT
- Fix sky fog rendering incorrectly as render distance goes beyond 32 (#152)

### 4.0.5
- Fix unloading of block entities without "Disable Block Entities" (#142)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package de.johni0702.minecraft.bobby.mixin;

import net.minecraft.client.render.BackgroundRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

@Mixin(BackgroundRenderer.class)
public abstract class BackgroundRendererMixin {
@ModifyVariable(method = "render", at = @At("HEAD"), argsOnly = true)
private static int clampMaxValue(int viewDistance) {
return Math.min(viewDistance, 32);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package de.johni0702.minecraft.bobby.mixin;

import net.minecraft.client.render.WorldRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;

@Mixin(WorldRenderer.class)
public abstract class WorldRendererMixin {
@ModifyArg(method = "method_37365", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/BackgroundRenderer;applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZF)V"), index = 2)
private static float clampMaxValue(float viewDistance) {
return Math.min(viewDistance, 32 * 16);
}
}
2 changes: 2 additions & 0 deletions src/main/resources/bobby.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"compatibilityLevel": "JAVA_17",
"plugin": "de.johni0702.minecraft.bobby.MixinConfigPlugin",
"client": [
"BackgroundRendererMixin",
"BiomeAccessAccessor",
"ChunkLightProviderMixin",
"ClientChunkManagerMixin",
Expand All @@ -16,6 +17,7 @@
"MinecraftClientMixin",
"SimpleOptionAccessor",
"ValidatingIntSliderCallbacksAccessor",
"WorldRendererMixin",
"sodium.SodiumChunkManagerMixin",
"sodium.SodiumClientPlayNetworkHandlerMixin",
"sodium.SodiumGameOptionPagesMixin"
Expand Down

0 comments on commit 3cfff04

Please sign in to comment.