1
0
mirror of https://github.com/chylex/Better-Controls.git synced 2025-05-05 01:34:06 +02:00

Fix tapping sneak to stop flying on ground not working when flight inertia is disabled

This commit is contained in:
chylex 2020-12-10 05:50:18 +01:00
parent 9d67cf5505
commit d59ac15b52
2 changed files with 13 additions and 11 deletions
src/main/java/chylex/bettercontrols

View File

@ -5,6 +5,6 @@ import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(PlayerEntity.class)
public interface AccessPlayerFields{
@Accessor("abilityResyncCountdown")
@Accessor("flyToggleTimer")
void setTicksLeftToDoubleTapFlight(int value);
}

View File

@ -180,16 +180,6 @@ public final class PlayerTicker{
player.setMotion(player.getMotion().add(0D, flightSpeed * verticalVelocity * direction, 0D));
}
}
if (cfg().disableFlightInertia){
if (input.moveForward == 0F && input.moveStrafe == 0F){
player.setMotion(player.getMotion().mul(0.0, 1.0, 0.0));
}
if (!input.jump && !input.sneaking){
player.setMotion(player.getMotion().mul(1.0, 0.0, 1.0));
}
}
}
if (cfg().resumeSprintingAfterHittingObstacle){
@ -255,6 +245,18 @@ public final class PlayerTicker{
holdingSneakWhileTouchingGround = false;
}
if (FlightHelper.isFlyingCreativeOrSpectator(player) && cfg().disableFlightInertia){
final MovementInput input = player.movementInput;
if (input.moveForward == 0F && input.moveStrafe == 0F){
player.setMotion(player.getMotion().mul(0.0, 1.0, 0.0));
}
if (!input.jump && !input.sneaking){
player.setMotion(player.getMotion().mul(1.0, 0.0, 1.0));
}
}
if (player.isCreative()){
if (Key.wasPressed(cfg().keyToggleFlight)){
final boolean isFlying = !player.abilities.isFlying;