Fixed wings not responding to your velocity when jumping (whithout flying)

This commit is contained in:
Sollace 2021-08-25 14:01:49 +02:00
parent c3e854fdd1
commit dda6576731

View file

@ -61,6 +61,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
private int wallHitCooldown;
private Vec3d lastPos = Vec3d.ZERO;
private Vec3d lastVel = Vec3d.ZERO;
private final PlayerDimensions dimensions;
@ -108,7 +109,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
}
}
} else {
spreadAmount += MathHelper.clamp(-getVerticalMotion(), 0, 2);
spreadAmount += MathHelper.clamp(-lastVel.y, -0.3F, 2);
spreadAmount += Math.sin(entity.age / 9F) / 9F;
if (entity.isSneaking()) {
@ -147,11 +148,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
}
private double getHorizontalMotion() {
return entity.getPos().subtract(lastPos).horizontalLengthSquared();
}
private double getVerticalMotion() {
return entity.getPos().y - lastPos.y;
return lastVel.horizontalLengthSquared();
}
@Override
@ -165,6 +162,9 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
ticksToGlide--;
}
lastVel = entity.getPos().subtract(lastPos);
lastPos = entity.getPos();
final MutableVector velocity = new MutableVector(entity.getVelocity());
if (isGravityNegative() && !entity.isSneaking() && entity.isInSneakingPose()) {
@ -273,8 +273,6 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
soundPlaying = false;
}
lastPos = entity.getPos();
if (!entity.isOnGround()) {
float heavyness = 1 - EnchantmentHelper.getEquipmentLevel(UEnchantments.HEAVY, entity) * 0.015F;
velocity.x *= heavyness;