More minor formatting changes.
This commit is contained in:
@@ -49,7 +49,6 @@ import net.minecraft.world.level.material.WaterFluid;
|
||||
import net.minecraft.world.level.pathfinder.PathComputationType;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec2;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.util.Mth;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public record MovementOption(Input input1, Input input2, float motionX, float motionZ) {
|
||||
private static final float SPRINT_MULTIPLIER = 1.3f;
|
||||
|
||||
public MovementOption(Input input1, float motionX, float motionZ) {
|
||||
this(input1, null, motionX, motionZ);
|
||||
@@ -43,12 +44,12 @@ public record MovementOption(Input input1, Input input2, float motionX, float mo
|
||||
|
||||
public static Stream<MovementOption> getOptions(float motionX, float motionZ, boolean canSprint) {
|
||||
return Stream.of(
|
||||
new MovementOption(Input.MOVE_FORWARD, canSprint ? motionX * 1.3f : motionX, canSprint ? motionZ * 1.3f : motionZ),
|
||||
new MovementOption(Input.MOVE_FORWARD, canSprint ? motionX * SPRINT_MULTIPLIER : motionX, canSprint ? motionZ * SPRINT_MULTIPLIER : motionZ),
|
||||
new MovementOption(Input.MOVE_BACK, -motionX, -motionZ),
|
||||
new MovementOption(Input.MOVE_LEFT, -motionZ, motionX),
|
||||
new MovementOption(Input.MOVE_RIGHT, motionZ, -motionX),
|
||||
new MovementOption(Input.MOVE_FORWARD, Input.MOVE_LEFT, (canSprint ? motionX * 1.3f : motionX) - motionZ, (canSprint ? motionZ * 1.3f : motionZ) + motionX),
|
||||
new MovementOption(Input.MOVE_FORWARD, Input.MOVE_RIGHT, (canSprint ? motionX * 1.3f : motionX) + motionZ, (canSprint ? motionZ * 1.3f : motionZ) - motionX),
|
||||
new MovementOption(Input.MOVE_FORWARD, Input.MOVE_LEFT, (canSprint ? motionX * SPRINT_MULTIPLIER : motionX) - motionZ, (canSprint ? motionZ * SPRINT_MULTIPLIER : motionZ) + motionX),
|
||||
new MovementOption(Input.MOVE_FORWARD, Input.MOVE_RIGHT, (canSprint ? motionX * SPRINT_MULTIPLIER : motionX) + motionZ, (canSprint ? motionZ * SPRINT_MULTIPLIER : motionZ) - motionX),
|
||||
new MovementOption(Input.MOVE_BACK, Input.MOVE_LEFT, -motionX - motionZ, -motionZ + motionX),
|
||||
new MovementOption(Input.MOVE_BACK, Input.MOVE_RIGHT, -motionX + motionZ, -motionZ - motionX)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user