From b313e8ba0db1c66d97a15097824fcdc9ed561ba2 Mon Sep 17 00:00:00 2001 From: flogic Date: Sun, 1 Nov 2020 16:42:59 -0700 Subject: [PATCH] Fix nearby chunks & translation amount config options --- .../smoothchunks/client/config/SmoothChunksConfig.java | 4 ++-- .../client/handler/ChunkAnimationHandler.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/cc/flogi/dev/smoothchunks/client/config/SmoothChunksConfig.java b/src/main/java/cc/flogi/dev/smoothchunks/client/config/SmoothChunksConfig.java index 1e7495e..28a98a7 100644 --- a/src/main/java/cc/flogi/dev/smoothchunks/client/config/SmoothChunksConfig.java +++ b/src/main/java/cc/flogi/dev/smoothchunks/client/config/SmoothChunksConfig.java @@ -37,7 +37,7 @@ public class SmoothChunksConfig implements ConfigData { * * @return The translation amount as an int 1 to 10 where higher = more translation. */ - public int getTranslationAmount() { - return translationAmount / 5; + public double getTranslationAmount() { + return (double) translationAmount / 5d; } } \ No newline at end of file diff --git a/src/main/java/cc/flogi/dev/smoothchunks/client/handler/ChunkAnimationHandler.java b/src/main/java/cc/flogi/dev/smoothchunks/client/handler/ChunkAnimationHandler.java index 7d9bebd..9650135 100644 --- a/src/main/java/cc/flogi/dev/smoothchunks/client/handler/ChunkAnimationHandler.java +++ b/src/main/java/cc/flogi/dev/smoothchunks/client/handler/ChunkAnimationHandler.java @@ -62,9 +62,11 @@ public final class ChunkAnimationHandler { AnimationController controller = animations.get(chunk); if (controller == null || MinecraftClient.getInstance().getCameraEntity() == null) return; + BlockPos finalPos = controller.getFinalPos(); + if (config.isDisableNearby()) { - BlockPos cameraPos = MinecraftClient.getInstance().getCameraEntity().getBlockPos(); - BlockPos chunkPos = chunk.getOrigin(); + Vec3i cameraPos = MinecraftClient.getInstance().getCameraEntity().getBlockPos(); + Vec3i chunkPos = new Vec3i(finalPos.getX() + 8, cameraPos.getY(), finalPos.getZ() + 8); if (chunkPos.isWithinDistance(cameraPos, 32)) return; } @@ -72,8 +74,6 @@ public final class ChunkAnimationHandler { double completion = (double) (System.currentTimeMillis() - controller.getStartTime()) / config.getDuration() / 1000d; completion = UtilEasing.easeOutSine(Math.min(completion, 1.0)); - BlockPos finalPos = controller.getFinalPos(); - switch (config.getLoadAnimation()) { default: case DOWNWARD: