From 9540027c197d3659db9b0a9badea6e9518cab3b7 Mon Sep 17 00:00:00 2001 From: Atsuishio <842960157@qq.com> Date: Fri, 11 Apr 2025 01:33:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8D=E8=83=BD=E8=B7=91?= =?UTF-8?q?=E5=B0=84=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../atsuishio/superbwarfare/client/ClickHandler.java | 12 +++++++++++- .../superbwarfare/event/ClientEventHandler.java | 10 ++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java b/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java index 9ab0a7583..c31fda031 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java @@ -224,6 +224,10 @@ public class ClickHandler { PacketDistributor.sendToServer(new EditModeMessage(0)); } + if (key == ModKeyMappings.BREATH.getKey().getValue() && !exhaustion && zoom) { + breath = true; + } + if (player.getData(ModAttachments.PLAYER_VARIABLE).edit) { if (!(stack.getItem() instanceof GunItem gunItem)) return; if (ModKeyMappings.EDIT_GRIP.getKeyModifier().isActive(KeyConflictContext.IN_GAME)) { @@ -272,6 +276,12 @@ public class ClickHandler { handleWeaponZoomPress(player, stack); switchZoom = !switchZoom; } + + if (event.getAction() == GLFW.GLFW_RELEASE) { + if (key == ModKeyMappings.BREATH.getKey().getValue()) { + breath = false; + } + } } } else { @@ -317,7 +327,6 @@ public class ClickHandler { if (stack.getItem() instanceof GunItem gunItem && !(player.getVehicle() != null && player.getVehicle() instanceof CannonEntity) && clientTimer.getProgress() == 0 - && cantFireTime == 0 && !notInGame() ) { var data = GunData.from(stack); @@ -341,6 +350,7 @@ public class ClickHandler { } } else { ClientEventHandler.holdFire = true; + player.setSprinting(false); } } } diff --git a/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java index 90fab7eb0..59918425c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java @@ -294,10 +294,6 @@ public class ClientEventHandler { return; } - if (!exhaustion && zoom) { - breath = ModKeyMappings.BREATH.isDown(); - } - tacticalSprint = !exhaustion && !zoom && isMoving() && player.isSprinting() && player.getVehicle() == null && player.onGround(); ItemStack stack = player.getMainHandItem(); @@ -335,9 +331,7 @@ public class ClientEventHandler { switchTime = Math.max(switchTime - 0.15, 0); } - if (!zoom) { - breath = false; - } else { + if (zoom) { tacticalSprint = false; } @@ -526,7 +520,7 @@ public class ClientEventHandler { double weight = data.weight(); double speed = 1 - (0.04 * weight); - if (ClientEventHandler.cantSprint == 0 && player.isSprinting() && !zoom) { + if (ClientEventHandler.cantSprint == 0 && player.isSprinting() && !zoom && !holdFire) { cantFireTime = Mth.clamp(cantFireTime + 3 * times, 0, 24); } else { cantFireTime = Mth.clamp(cantFireTime - 6 * speed * times, 0, 40);