@@ -661,27 +661,28 @@ static void moveTowards(IPlayerContext ctx, MovementState state, BlockPos pos) {
661661 }
662662
663663 static void moveTowardsWithoutRotation (IPlayerContext ctx , MovementState state , BlockPos dest ) {
664- float ax = Mth .sin (ctx .playerRotations ().getYaw () * DEG_TO_RAD_F );
665- float az = Mth .cos (ctx .playerRotations ().getYaw () * DEG_TO_RAD_F );
666- Rotation blockRotation = RotationUtils .calcRotationFromVec3d (ctx .playerHead (),
664+ float idealYaw = RotationUtils .calcRotationFromVec3d (
665+ ctx .playerHead (),
667666 VecUtils .getBlockPosCenter (dest ),
668- ctx .playerRotations ());
669- boolean canSprint = Baritone .settings ().allowSprint .value ;
670- Arrays .stream (new MovementOption []{
671- new MovementOption (Input .MOVE_FORWARD , canSprint ? ax * 1.3f : ax , canSprint ? az * 1.3f : az ),
672- new MovementOption (Input .MOVE_BACK , -ax , -az ),
673- new MovementOption (Input .MOVE_LEFT , -az , ax ),
674- new MovementOption (Input .MOVE_RIGHT , az , -ax ),
675- new MovementOption (Input .MOVE_FORWARD , Input .MOVE_LEFT , (canSprint ? ax * 1.3f : ax ) - az , (canSprint ? az * 1.3f : az ) + ax ),
676- new MovementOption (Input .MOVE_FORWARD , Input .MOVE_RIGHT , (canSprint ? ax * 1.3f : ax ) + az , (canSprint ? az * 1.3f : az ) - ax ),
677- new MovementOption (Input .MOVE_BACK , Input .MOVE_LEFT , -ax - az , -az + ax ),
678- new MovementOption (Input .MOVE_BACK , Input .MOVE_RIGHT , -ax + az , -az - ax ),
679- }).min (Comparator .comparing (option -> option .distanceToSq (
680- Mth .sin (blockRotation .getYaw () * DEG_TO_RAD_F ),
681- Mth .cos (blockRotation .getYaw () * DEG_TO_RAD_F )
667+ ctx .playerRotations ()
668+ ).getYaw ();
669+ MovementOption .getOptions (
670+ Mth .sin (ctx .playerRotations ().getYaw () * DEG_TO_RAD_F ),
671+ Mth .cos (ctx .playerRotations ().getYaw () * DEG_TO_RAD_F ),
672+ Baritone .settings ().allowSprint .value
673+ ).min (Comparator .comparing (option -> option .distanceToSq (
674+ Mth .sin (idealYaw * DEG_TO_RAD_F ),
675+ Mth .cos (idealYaw * DEG_TO_RAD_F )
682676 ))).ifPresent (selection -> selection .setInputs (state ));
683677 }
684678
679+ static void roundYaw (IPlayerContext ctx , MovementState state ) {
680+ state .setTarget (new MovementTarget (new Rotation (
681+ Math .round (ctx .playerRotations ().getYaw () / 45f ) * 45f ,
682+ ctx .playerRotations ().getPitch ()
683+ ), true ));
684+ }
685+
685686 /**
686687 * Returns whether or not the specified block is
687688 * water, regardless of whether or not it is flowing.
0 commit comments