fix: some rendering issues due to refactoring

This commit is contained in:
TopchetoEU 2023-01-15 21:33:52 +02:00
parent 40dbb1f8d6
commit 0e0e8f0e0f
3 changed files with 8 additions and 4 deletions

View File

@ -160,7 +160,7 @@ public final class Animator {
float _progress = EASES.getValue().ease(progress); float _progress = EASES.getValue().ease(progress);
ANIMATIONS.getValue().animate( ANIMATIONS.getValue().animate(
_progress, matrices, _progress, matrices,
chunkPos.getX() * 16, 0, chunkPos.getZ() * 16, chunkPos.getX() * 16, chunkPos.getY() * 16, chunkPos.getZ() * 16,
(float)playerPos.x, (float)playerPos.y, (float)playerPos.z (float)playerPos.x, (float)playerPos.y, (float)playerPos.z
); );
// matrices.translate(0, 0, 16); // matrices.translate(0, 0, 16);

View File

@ -162,14 +162,17 @@ public class ChunkPreview extends DrawableHelper implements Drawable, Element, S
} }
private void renderChunk(MatrixStack matrices, int x, int y, int n, float delta) { private void renderChunk(MatrixStack matrices, int x, int y, int n, float delta) {
duration = animator.getDuration(); duration = animator.getDuration();
float progress = globalProgress / duration - (float)Math.sqrt(x * x + y * y) / (float)n / 2;
if (progress > 1) progress = 1;
if (progress <= 0) return;
matrices.push(); matrices.push();
matrices.translate(x * 16 - 8, 0, y * 16 - 8); matrices.translate(x * 16 - 8, 0, y * 16 - 8);
// x += n; // x += n;
// y += n; // y += n;
float progress = globalProgress / duration - (float)Math.sqrt(x * x + y * y) / (float)n / 2;
animator.animate(matrices, progress, new BlockPos(x * 16, 0, y * 16)); animator.animate(matrices, progress, new BlockPos(x * 16, 0, y * 16));
// if (progress < 0) progress = 0; // if (progress < 0) progress = 0;

View File

@ -12,6 +12,7 @@ import net.minecraft.client.render.WorldRenderer.ChunkInfo;
import net.minecraft.client.render.chunk.ChunkBuilder.BuiltChunk; import net.minecraft.client.render.chunk.ChunkBuilder.BuiltChunk;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3d; import net.minecraft.client.util.math.Vector3d;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Matrix4f; import net.minecraft.util.math.Matrix4f;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
@ -55,7 +56,7 @@ public abstract class WorldRendererMixin {
matrices.push(); matrices.push();
AnimatedChunks.getInstance().animator.animate(matrices, chunk.getOrigin(), new Vector3d(playerX, playerY, playerZ)); AnimatedChunks.getInstance().animator.animate(matrices, new BlockPos(chunk.getOrigin().getX(), 0, chunk.getOrigin().getZ()), new Vector3d(playerX, playerY, playerZ));
// if (getProgressManager().isChunkLoaded(x, 0, z)) { // if (getProgressManager().isChunkLoaded(x, 0, z)) {
// float progress = getProgressManager().getChunkProgress(x, 0, z); // float progress = getProgressManager().getChunkProgress(x, 0, z);