From 38fedad1c79057e229fc9b598c53c46dff1cd1ec Mon Sep 17 00:00:00 2001 From: tr7zw Date: Sat, 14 Jan 2023 02:02:23 +0100 Subject: [PATCH] Fix sneaking --- Shared/src/main/java/dev/tr7zw/waveycapes/CapeHolder.java | 5 +++-- .../main/java/dev/tr7zw/waveycapes/sim/StickSimulation.java | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Shared/src/main/java/dev/tr7zw/waveycapes/CapeHolder.java b/Shared/src/main/java/dev/tr7zw/waveycapes/CapeHolder.java index 1f0bde1..ed8a4e4 100644 --- a/Shared/src/main/java/dev/tr7zw/waveycapes/CapeHolder.java +++ b/Shared/src/main/java/dev/tr7zw/waveycapes/CapeHolder.java @@ -57,8 +57,9 @@ public default void simulate(AbstractClientPlayer abstractClientPlayer) { simulation.gravityDirection.x = 0; simulation.gravityDirection.y = -1; - double changeX = (d * o + m * p) + fallHack; - double changeY = ((abstractClientPlayer.getY() - abstractClientPlayer.yo)*heightMul + (abstractClientPlayer.isCrouching() ? -4 : 0)); + double changeX = (d * o + m * p) + fallHack + (abstractClientPlayer.isCrouching() && !simulation.sneaking ? 3 : 0); + double changeY = ((abstractClientPlayer.getY() - abstractClientPlayer.yo)*heightMul) + (abstractClientPlayer.isCrouching() && !simulation.sneaking ? 1 : 0); + simulation.sneaking = abstractClientPlayer.isCrouching(); Vector2 change = new Vector2((float)changeX, (float)changeY); if(abstractClientPlayer.isVisuallySwimming()) { float rotation = abstractClientPlayer.getXRot(); // -90 = swimming up, 0 = straight, 90 = down diff --git a/Shared/src/main/java/dev/tr7zw/waveycapes/sim/StickSimulation.java b/Shared/src/main/java/dev/tr7zw/waveycapes/sim/StickSimulation.java index 62e11b5..c8fa339 100644 --- a/Shared/src/main/java/dev/tr7zw/waveycapes/sim/StickSimulation.java +++ b/Shared/src/main/java/dev/tr7zw/waveycapes/sim/StickSimulation.java @@ -20,6 +20,7 @@ public class StickSimulation { public float gravity = WaveyCapesBase.config.gravity; public int numIterations = 30; private float maxBend = 5; + public boolean sneaking = false; public void simulate() { //maxBend = WaveyCapesBase.config.maxBend;