-
Notifications
You must be signed in to change notification settings - Fork 822
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use eye coordinates when checking if the camera is within a loaded chunk
Fixes #2159
- Loading branch information
1 parent
b90ca83
commit d9081b4
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/main/java/me/jellysquid/mods/sodium/mixin/core/gui/DownloadingTerrainScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package me.jellysquid.mods.sodium.mixin.core.gui; | ||
|
||
import net.minecraft.client.gui.screen.DownloadingTerrainScreen; | ||
import net.minecraft.client.network.ClientPlayerEntity; | ||
import net.minecraft.util.math.BlockPos; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(DownloadingTerrainScreen.class) | ||
public class DownloadingTerrainScreenMixin { | ||
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getBlockPos()Lnet/minecraft/util/math/BlockPos;")) | ||
private BlockPos redirect$getPlayerBlockPosition(ClientPlayerEntity instance) { | ||
// Ensure the "eye" position (which the chunk rendering code is actually concerned about) is used instead of | ||
// the "feet" position. This solves a problem where the loading screen can become stuck waiting for the chunk | ||
// at the player's feet to load, when it is determined to not be visible due to the true location of the | ||
// player's eyes. | ||
return BlockPos.ofFloored(instance.getX(), instance.getEyeY(), instance.getY()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters