diff --git a/src/main/java/me/topchetoeu/animatedchunks/animation/Animator.java b/src/main/java/me/topchetoeu/animatedchunks/animation/Animator.java index f86ea03..760ee41 100644 --- a/src/main/java/me/topchetoeu/animatedchunks/animation/Animator.java +++ b/src/main/java/me/topchetoeu/animatedchunks/animation/Animator.java @@ -160,7 +160,7 @@ public final class Animator { float _progress = EASES.getValue().ease(progress); ANIMATIONS.getValue().animate( _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 ); // matrices.translate(0, 0, 16); diff --git a/src/main/java/me/topchetoeu/animatedchunks/gui/ChunkPreview.java b/src/main/java/me/topchetoeu/animatedchunks/gui/ChunkPreview.java index 300cf59..42dad0f 100644 --- a/src/main/java/me/topchetoeu/animatedchunks/gui/ChunkPreview.java +++ b/src/main/java/me/topchetoeu/animatedchunks/gui/ChunkPreview.java @@ -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) { 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.translate(x * 16 - 8, 0, y * 16 - 8); // x += 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)); // if (progress < 0) progress = 0; diff --git a/src/main/java/me/topchetoeu/animatedchunks/mixin/WorldRendererMixin.java b/src/main/java/me/topchetoeu/animatedchunks/mixin/WorldRendererMixin.java index 32be951..948a8aa 100644 --- a/src/main/java/me/topchetoeu/animatedchunks/mixin/WorldRendererMixin.java +++ b/src/main/java/me/topchetoeu/animatedchunks/mixin/WorldRendererMixin.java @@ -12,6 +12,7 @@ import net.minecraft.client.render.WorldRenderer.ChunkInfo; import net.minecraft.client.render.chunk.ChunkBuilder.BuiltChunk; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.Vector3d; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Matrix4f; import org.spongepowered.asm.mixin.Mixin; @@ -55,7 +56,7 @@ public abstract class WorldRendererMixin { 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)) { // float progress = getProgressManager().getChunkProgress(x, 0, z);