Skip to content

Commit 0eb0e67

Browse files
committed
Condense more.
1 parent 9714fa4 commit 0eb0e67

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/main/java/baritone/pathing/movement/MovementHelper.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -666,16 +666,8 @@ static void moveTowardsWithoutRotation(IPlayerContext ctx, MovementState state,
666666
Rotation blockRotation = RotationUtils.calcRotationFromVec3d(ctx.playerHead(),
667667
VecUtils.getBlockPosCenter(dest),
668668
ctx.playerRotations());
669-
Arrays.stream(getOptions(ax, az)).min(Comparator.comparing(option -> option.distanceToSq(
670-
Mth.sin(blockRotation.getYaw() * DEG_TO_RAD_F),
671-
Mth.cos(blockRotation.getYaw() * DEG_TO_RAD_F)
672-
))).ifPresent(selection -> selection.setInputs(state));
673-
}
674-
675-
private static MovementOption[] getOptions(float ax, float az) {
676669
boolean canSprint = Baritone.settings().allowSprint.value;
677-
678-
return new MovementOption[]{
670+
Arrays.stream(new MovementOption[]{
679671
new MovementOption(Input.MOVE_FORWARD, canSprint ? ax * 1.3f : ax, canSprint ? az * 1.3f : az),
680672
new MovementOption(Input.MOVE_BACK, -ax, -az),
681673
new MovementOption(Input.MOVE_LEFT, -az, ax),
@@ -684,7 +676,10 @@ private static MovementOption[] getOptions(float ax, float az) {
684676
new MovementOption(Input.MOVE_FORWARD, Input.MOVE_RIGHT, (canSprint ? ax * 1.3f : ax) + az, (canSprint ? az * 1.3f : az) - ax),
685677
new MovementOption(Input.MOVE_BACK, Input.MOVE_LEFT, -ax - az, -az + ax),
686678
new MovementOption(Input.MOVE_BACK, Input.MOVE_RIGHT, -ax + az, -az - ax),
687-
};
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)
682+
))).ifPresent(selection -> selection.setInputs(state));
688683
}
689684

690685
/**

0 commit comments

Comments
 (0)