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);