aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-01-29 06:04:38 +0000
committermat <git@matdoes.dev>2025-01-29 06:04:38 +0000
commit5bdb07b31431da872065f02d9a1b1802325e0719 (patch)
tree3e99a1b0e78e93750ba15d0d8ebe60d03157ad48
parent6c681adc4dcf70caa25340838c4f2fef67b657d4 (diff)
downloadazalea-drasl-5bdb07b31431da872065f02d9a1b1802325e0719.tar.xz
fix PlayerInput to handle diagonal inputs
-rw-r--r--azalea-client/src/movement.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/azalea-client/src/movement.rs b/azalea-client/src/movement.rs
index dfb35532..63b77bbb 100644
--- a/azalea-client/src/movement.rs
+++ b/azalea-client/src/movement.rs
@@ -261,11 +261,13 @@ pub fn send_player_input_packet(
mut commands: Commands,
) {
for (entity, physics_state, jumping, last_sent_input) in query.iter_mut() {
+ let dir = physics_state.move_direction;
+ type D = WalkDirection;
let input = ServerboundPlayerInput {
- forward: physics_state.move_direction == WalkDirection::Forward,
- backward: physics_state.move_direction == WalkDirection::Backward,
- left: physics_state.move_direction == WalkDirection::Left,
- right: physics_state.move_direction == WalkDirection::Right,
+ forward: matches!(dir, D::Forward | D::ForwardLeft | D::ForwardRight),
+ backward: matches!(dir, D::Backward | D::BackwardLeft | D::BackwardRight),
+ left: matches!(dir, D::Left | D::ForwardLeft | D::BackwardLeft),
+ right: matches!(dir, D::Right | D::ForwardRight | D::BackwardRight),
jump: **jumping,
// TODO: implement sneaking
shift: false,