From 6c8f2698d697c3ffaca7022f29644c6317435494 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 18 Jun 2023 19:31:51 -0700 Subject: [PATCH] cherry pick remainWithExistingLookDirection from fork --- src/api/java/baritone/api/Settings.java | 6 ++++++ src/api/java/baritone/api/utils/RotationUtils.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index bcd3eaa63..824dfd7e2 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -729,6 +729,12 @@ public final class Settings { */ public final Setting blockFreeLook = new Setting<>(false); + /** + * When true, the player will remain with its existing look direction as often as possible. + * Although, in some cases this can get it stuck, hence this setting to disable that behavior. + */ + public final Setting remainWithExistingLookDirection = new Setting<>(true); + /** * Will cause some minor behavioral differences to ensure that Baritone works on anticheats. *

diff --git a/src/api/java/baritone/api/utils/RotationUtils.java b/src/api/java/baritone/api/utils/RotationUtils.java index 1991ab878..b3b67d9ca 100644 --- a/src/api/java/baritone/api/utils/RotationUtils.java +++ b/src/api/java/baritone/api/utils/RotationUtils.java @@ -161,7 +161,7 @@ public final class RotationUtils { } public static Optional reachable(IPlayerContext ctx, BlockPos pos, double blockReachDistance, boolean wouldSneak) { - if (ctx.isLookingAt(pos)) { + if (BaritoneAPI.getSettings().remainWithExistingLookDirection.value && ctx.isLookingAt(pos)) { /* * why add 0.0001? * to indicate that we actually have a desired pitch