From 75a0c4d769f851f2f0eeef218c39b1d58cdd6ab0 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 21 May 2023 17:38:11 +0100 Subject: [PATCH] Fixed random boosts whilst flying --- .../unicopia/entity/player/PlayerPhysics.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java index 8790686a..41bbb585 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/PlayerPhysics.java @@ -537,7 +537,8 @@ public class PlayerPhysics extends EntityPhysics implements Tickab } private void applyThrust(MutableVector velocity) { - if (pony.sneakingChanged() && entity.isSneaking()) { + boolean manualFlap = pony.sneakingChanged() && entity.isSneaking(); + if (manualFlap) { flapping = true; ticksToGlide = MAX_TICKS_TO_GLIDE; } @@ -552,9 +553,11 @@ public class PlayerPhysics extends EntityPhysics implements Tickab entity.playSound(getFlightType().getWingFlapSound(), 0.5F, 1); entity.world.emitGameEvent(entity, GameEvent.ELYTRA_GLIDE, entity.getPos()); } - if (!hovering) { - thrustScale = 1; - descentRate -= 0.5F; + thrustScale = 1; + if (manualFlap) { + descentRate -= 0.5; + } else { + descentRate = Math.max(0, descentRate / 2); } }