فهرست منبع

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

chylex 4 سال پیش
والد
کامیت
f60b23ecdc
1فایلهای تغییر یافته به همراه12 افزوده شده و 10 حذف شده
  1. 12 10
      src/main/java/chylex/bettercontrols/player/PlayerTicker.java

+ 12 - 10
src/main/java/chylex/bettercontrols/player/PlayerTicker.java

@@ -181,16 +181,6 @@ public final class PlayerTicker{
 					player.setVelocity(player.getVelocity().add(0D, flightSpeed * verticalVelocity * direction, 0D));
 				}
 			}
-			
-			if (cfg().disableFlightInertia){
-				if (input.movementForward == 0F && input.movementSideways == 0F){
-					player.setVelocity(player.getVelocity().multiply(0.0, 1.0, 0.0));
-				}
-				
-				if (!input.jumping && !input.sneaking){
-					player.setVelocity(player.getVelocity().multiply(1.0, 0.0, 1.0));
-				}
-			}
 		}
 		
 		if (cfg().resumeSprintingAfterHittingObstacle){
@@ -256,6 +246,18 @@ public final class PlayerTicker{
 			holdingSneakWhileTouchingGround = false;
 		}
 		
+		if (FlightHelper.isFlyingCreativeOrSpectator(player) && cfg().disableFlightInertia){
+			final Input input = player.input;
+			
+			if (input.movementForward == 0F && input.movementSideways == 0F){
+				player.setVelocity(player.getVelocity().multiply(0.0, 1.0, 0.0));
+			}
+			
+			if (!input.jumping && !input.sneaking){
+				player.setVelocity(player.getVelocity().multiply(1.0, 0.0, 1.0));
+			}
+		}
+		
 		if (player.isCreative()){
 			if (Key.wasPressed(cfg().keyToggleFlight)){
 				final boolean isFlying = !player.abilities.flying;