Skip to content

Commit

Permalink
feat: ctrl + jump for look based flight
Browse files Browse the repository at this point in the history
  • Loading branch information
Duzos committed Oct 5, 2024
1 parent 0a0bf38 commit bf93e90
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/mc/duzo/timeless/power/impl/FlightPower.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,17 @@ private Vec3d getVerticalVelocity(ServerPlayerEntity player) {
Vec3d change = new Vec3d(0, 0, 0);

if (ServerKeybind.get(player).isJumping()) {
return change.add(0, (getSuit(player).getVerticalFlightModifier(player.isSprinting()) / 100f), 0).add(0, player.getVelocity().y, 0);
boolean isPressingMovement = ServerKeybind.get(player).isMovingForward() || ServerKeybind.get(player).isMovingBackward() || ServerKeybind.get(player).isMovingRight() || ServerKeybind.get(player).isMovingLeft();
if (!(isPressingMovement) || !(player.isSprinting())) { // just move straight up
return change.add(0, (getSuit(player).getVerticalFlightModifier(player.isSprinting()) / 100f), 0).add(0, player.getVelocity().y, 0);
}

double multiplier = (getSuit(player).getHorizontalFlightModifier(player.isSprinting()) / 10f);

float i = -player.getPitch() / 90;
change = change.add(0, (i * (multiplier * ((i < 0) ? 1 : 1))), 0);

return change;
}

double yVelocity = player.getVelocity().y;
Expand Down

0 comments on commit bf93e90

Please sign in to comment.