Fixed random boosts whilst flying

This commit is contained in:
Sollace 2023-05-21 17:38:11 +01:00
parent 4404b4108d
commit 75a0c4d769

View file

@ -537,7 +537,8 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
} }
private void applyThrust(MutableVector velocity) { private void applyThrust(MutableVector velocity) {
if (pony.sneakingChanged() && entity.isSneaking()) { boolean manualFlap = pony.sneakingChanged() && entity.isSneaking();
if (manualFlap) {
flapping = true; flapping = true;
ticksToGlide = MAX_TICKS_TO_GLIDE; ticksToGlide = MAX_TICKS_TO_GLIDE;
} }
@ -552,9 +553,11 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
entity.playSound(getFlightType().getWingFlapSound(), 0.5F, 1); entity.playSound(getFlightType().getWingFlapSound(), 0.5F, 1);
entity.world.emitGameEvent(entity, GameEvent.ELYTRA_GLIDE, entity.getPos()); entity.world.emitGameEvent(entity, GameEvent.ELYTRA_GLIDE, entity.getPos());
} }
if (!hovering) { thrustScale = 1;
thrustScale = 1; if (manualFlap) {
descentRate -= 0.5F; descentRate -= 0.5;
} else {
descentRate = Math.max(0, descentRate / 2);
} }
} }