Skip to content

Commit 8ae52fa

Browse files
committed
Add pitch up velocity
1 parent 552cfc4 commit 8ae52fa

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/java/meanwhile131/elytrainfinite/ElytraInfinite.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public class ElytraInfinite implements ClientModInitializer {
3333
static final float pitchDown = 34f;
3434
static final float pitchUp = -47f;
3535
static final float pitchDownSpeed = 0.5f;
36+
static final int pitchUpHeight = 5;
37+
static final double pitchUpVelocity = 5f;
3638
private FlyState state = FlyState.NOT_FLYING;
3739
private static KeyBinding toggleKeybind;
3840
private float pitch;
@@ -63,7 +65,7 @@ public void onInitializeClient() {
6365
if (state == FlyState.GLIDING_DOWN) {
6466
BlockPos pos = player.getBlockPos();
6567
int height = world.getChunk(pos).sampleHeightmap(Heightmap.Type.WORLD_SURFACE, pos.getX(), pos.getZ());
66-
if (pos.getY() - height < 5) {
68+
if (pos.getY() - height < pitchUp || player.getVelocity().lengthSquared() > pitchUpVelocity) {
6769
pitch = pitchUp;
6870
state = FlyState.PITCHING_DOWN;
6971
}

0 commit comments

Comments
 (0)