修复耐力bug

This commit is contained in:
Atsuishio 2025-04-12 01:28:39 +08:00 committed by Light_Quanta
parent d0ad586f71
commit c8a9ce9277
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
2 changed files with 8 additions and 2 deletions

View file

@ -199,6 +199,9 @@ public class ClickHandler {
if (key == Minecraft.getInstance().options.keyJump.getKey().getValue()) { if (key == Minecraft.getInstance().options.keyJump.getKey().getValue()) {
handleDoubleJump(player); handleDoubleJump(player);
if (player.onGround()) {
stamina += 5;
}
} }
if (key == ModKeyMappings.RELOAD.getKey().getValue()) { if (key == ModKeyMappings.RELOAD.getKey().getValue()) {
@ -389,6 +392,7 @@ public class ClickHandler {
ClientEventHandler.zoom = false; ClientEventHandler.zoom = false;
ClientEventHandler.zoomVehicle = false; ClientEventHandler.zoomVehicle = false;
ClientEventHandler.entity = null; ClientEventHandler.entity = null;
breath = false;
} }
private static void editModelShake() { private static void editModelShake() {

View file

@ -295,12 +295,14 @@ public class ClientEventHandler {
//耐力 //耐力
public static void staminaSystem() { public static void staminaSystem() {
if (notInGame()) return;
LocalPlayer player = Minecraft.getInstance().player; LocalPlayer player = Minecraft.getInstance().player;
if (player == null) { if (player == null) {
return; return;
} }
tacticalSprint = !exhaustion && !zoom && isMoving() && player.isSprinting() && player.getVehicle() == null && player.onGround(); tacticalSprint = !exhaustion && !zoom && isMoving() && player.isSprinting() && player.getVehicle() == null && player.onGround() && !player.getAbilities().flying;
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();
@ -331,7 +333,7 @@ public class ClientEventHandler {
exhaustion = false; exhaustion = false;
} }
if ((ModKeyMappings.BREATH.isDown() && zoom) || tacticalSprint) { if ((ModKeyMappings.BREATH.isDown() && zoom) || (tacticalSprint)) {
switchTime = Math.min(switchTime + 0.65, 5); switchTime = Math.min(switchTime + 0.65, 5);
} else if (switchTime > 0 && stamina == 0) { } else if (switchTime > 0 && stamina == 0) {
switchTime = Math.max(switchTime - 0.15, 0); switchTime = Math.max(switchTime - 0.15, 0);