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:
parent
9d67cf5505
commit
d59ac15b52
src/main/java/chylex/bettercontrols
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user