Skip to content

Commit

Permalink
fix(Movement): water super jump bug (#5252)
Browse files Browse the repository at this point in the history
Changed KinematicCharacterMover so that water super jump bug is stopped.
Closes #5198
  • Loading branch information
engiValk committed Jun 15, 2024
1 parent 9b498fa commit 05373e9
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,13 @@ private void checkMode(final CharacterMovementComponent movementComp, final Char
Vector3f top = new Vector3f(worldPos);
Vector3f bottom = new Vector3f(worldPos);
top.y += 0.5f * movementComp.height;
bottom.y -= 0.5f * movementComp.height;
bottom.y -= 0.25f * movementComp.height;

final boolean topUnderwater = worldProvider.getBlock(top).isLiquid();
final boolean bottomUnderwater = worldProvider.getBlock(bottom).isLiquid();

final boolean newSwimming = !topUnderwater && bottomUnderwater;
//We check if either a single point is in water (SWIMMING) or if both points are in water (DIVING).
final boolean newSwimming = !topUnderwater && bottomUnderwater || topUnderwater && !bottomUnderwater;
final boolean newDiving = topUnderwater && bottomUnderwater;
boolean newClimbing = false;

Expand Down Expand Up @@ -650,7 +651,7 @@ private void walk(final CharacterMovementComponent movementComp, final Character
endVelocity.y = 0;

// Jumping is only possible, if the entity is standing on ground
if (input.isJumping()) {
if (input.isJumping() && state.isGrounded()) {

state.setGrounded(false);

Expand Down

0 comments on commit 05373e9

Please sign in to comment.