Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Movement): water super jump bug #5252

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(Movement): water super jump bug
Changed KinematicCharacterMover so that water super jump bug is stopped.
Closes #5198
  • Loading branch information
engiValk committed Jun 13, 2024
commit 6e5d2989e5c55db1cda61c8b82939a377e5ecefa
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
Loading