Skip to content

Commit

Permalink
Skip rest of movement attempt when motion already cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
2No2Name committed Jun 8, 2024
1 parent 5e4fa7a commit 3e0e24c
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public static Vec3d adjustMovementForCollisions(@Nullable Entity entity, Vec3d m
if (voxelShape != null) {
double v = voxelShape.calculateMaxDistance(Direction.Axis.Y, entityBoundingBox, movementY);
if (v == 0) {
if (isSingleAxisMovement) {
//Y was the only movement axis, movement completely cancelled<
return Vec3d.ZERO;
}
movementY = 0D;
isSingleAxisMovement = (movementX == 0D ? 0 : 1) + (movementZ == 0D ? 0 : 1) == 1;
}
Expand Down

0 comments on commit 3e0e24c

Please sign in to comment.