fix: use modern KBM handling for input and localplayer

This commit is contained in:
2026-08-26 19:22:44 -05:00
parent 802b0ebfdf
commit 405b054ff5
2 changed files with 17 additions and 15 deletions
+8 -9
View File
@@ -279,15 +279,6 @@ void LocalPlayer::aiStep()
// world with low food, then reload it in creative.
if(abilities.mayfly || isAllowedToFly() ) enoughFoodToSprint = true;
#ifdef _WINDOWS64
// Keyboard sprint: Ctrl held while moving forward
if (GetXboxPad() == 0 && g_KBMInput.IsKeyDown(VK_CONTROL) && input->ya > 0.0f &&
enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && onGround)
{
if (!isSprinting()) setSprinting(true);
}
#endif
// 4J - altered this slightly to make sure that the joypad returns to below returnTreshold in between registering two movements up to runThreshold
if (onGround && !isSprinting() && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness))
{
@@ -314,6 +305,14 @@ void LocalPlayer::aiStep()
}
}
if (isSneaking()) sprintTriggerTime = 0;
#ifdef _WINDOWS64
if (input->sprinting && !isSprinting() && (onGround || isRiding()) && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && !isSneaking())
{
setSprinting(true);
}
#endif
// 4J-PB - try not stopping sprint on collision
//if (isSprinting() && (input->ya < runTreshold || horizontalCollision || !enoughFoodToSprint))
if (isSprinting() && (input->ya < runTreshold || !enoughFoodToSprint))