Fix getForwards/SidewaysMovement for players (#12140)

This commit is contained in:
Warrior
2025-02-18 01:03:48 +01:00
committed by GitHub
parent f070081825
commit 09f1f88f58
2 changed files with 35 additions and 11 deletions

View File

@@ -3583,4 +3583,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
handle.containerMenu.broadcastChanges();
return new PaperPlayerGiveResult(leftovers.build(), drops.build());
}
@Override
public float getSidewaysMovement() {
final boolean leftMovement = this.getHandle().getLastClientInput().left();
final boolean rightMovement = this.getHandle().getLastClientInput().right();
return leftMovement == rightMovement ? 0 : leftMovement ? 1 : -1;
}
@Override
public float getForwardsMovement() {
final boolean forwardMovement = this.getHandle().getLastClientInput().forward();
final boolean backwardMovement = this.getHandle().getLastClientInput().backward();
return forwardMovement == backwardMovement ? 0 : forwardMovement ? 1 : -1;
}
}