2323import java .util .stream .Stream ;
2424
2525public record MovementOption (Input input1 , Input input2 , float motionX , float motionZ ) {
26+ private static final float SPRINT_MULTIPLIER = 1.3f ;
2627
2728 public MovementOption (Input input1 , float motionX , float motionZ ) {
2829 this (input1 , null , motionX , motionZ );
@@ -43,12 +44,12 @@ public float distanceToSq(float otherX, float otherZ) {
4344
4445 public static Stream <MovementOption > getOptions (float motionX , float motionZ , boolean canSprint ) {
4546 return Stream .of (
46- new MovementOption (Input .MOVE_FORWARD , canSprint ? motionX * 1.3f : motionX , canSprint ? motionZ * 1.3f : motionZ ),
47+ new MovementOption (Input .MOVE_FORWARD , canSprint ? motionX * SPRINT_MULTIPLIER : motionX , canSprint ? motionZ * SPRINT_MULTIPLIER : motionZ ),
4748 new MovementOption (Input .MOVE_BACK , -motionX , -motionZ ),
4849 new MovementOption (Input .MOVE_LEFT , -motionZ , motionX ),
4950 new MovementOption (Input .MOVE_RIGHT , motionZ , -motionX ),
50- new MovementOption (Input .MOVE_FORWARD , Input .MOVE_LEFT , (canSprint ? motionX * 1.3f : motionX ) - motionZ , (canSprint ? motionZ * 1.3f : motionZ ) + motionX ),
51- new MovementOption (Input .MOVE_FORWARD , Input .MOVE_RIGHT , (canSprint ? motionX * 1.3f : motionX ) + motionZ , (canSprint ? motionZ * 1.3f : motionZ ) - motionX ),
51+ new MovementOption (Input .MOVE_FORWARD , Input .MOVE_LEFT , (canSprint ? motionX * SPRINT_MULTIPLIER : motionX ) - motionZ , (canSprint ? motionZ * SPRINT_MULTIPLIER : motionZ ) + motionX ),
52+ new MovementOption (Input .MOVE_FORWARD , Input .MOVE_RIGHT , (canSprint ? motionX * SPRINT_MULTIPLIER : motionX ) + motionZ , (canSprint ? motionZ * SPRINT_MULTIPLIER : motionZ ) - motionX ),
5253 new MovementOption (Input .MOVE_BACK , Input .MOVE_LEFT , -motionX - motionZ , -motionZ + motionX ),
5354 new MovementOption (Input .MOVE_BACK , Input .MOVE_RIGHT , -motionX + motionZ , -motionZ - motionX )
5455 );
0 commit comments