mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Fixed wings not responding to your velocity when jumping (whithout flying)
This commit is contained in:
parent
c3e854fdd1
commit
dda6576731
1 changed files with 6 additions and 8 deletions
|
@ -61,6 +61,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
private int wallHitCooldown;
|
private int wallHitCooldown;
|
||||||
|
|
||||||
private Vec3d lastPos = Vec3d.ZERO;
|
private Vec3d lastPos = Vec3d.ZERO;
|
||||||
|
private Vec3d lastVel = Vec3d.ZERO;
|
||||||
|
|
||||||
private final PlayerDimensions dimensions;
|
private final PlayerDimensions dimensions;
|
||||||
|
|
||||||
|
@ -108,7 +109,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
spreadAmount += MathHelper.clamp(-getVerticalMotion(), 0, 2);
|
spreadAmount += MathHelper.clamp(-lastVel.y, -0.3F, 2);
|
||||||
spreadAmount += Math.sin(entity.age / 9F) / 9F;
|
spreadAmount += Math.sin(entity.age / 9F) / 9F;
|
||||||
|
|
||||||
if (entity.isSneaking()) {
|
if (entity.isSneaking()) {
|
||||||
|
@ -147,11 +148,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getHorizontalMotion() {
|
private double getHorizontalMotion() {
|
||||||
return entity.getPos().subtract(lastPos).horizontalLengthSquared();
|
return lastVel.horizontalLengthSquared();
|
||||||
}
|
|
||||||
|
|
||||||
private double getVerticalMotion() {
|
|
||||||
return entity.getPos().y - lastPos.y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -165,6 +162,9 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
ticksToGlide--;
|
ticksToGlide--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastVel = entity.getPos().subtract(lastPos);
|
||||||
|
lastPos = entity.getPos();
|
||||||
|
|
||||||
final MutableVector velocity = new MutableVector(entity.getVelocity());
|
final MutableVector velocity = new MutableVector(entity.getVelocity());
|
||||||
|
|
||||||
if (isGravityNegative() && !entity.isSneaking() && entity.isInSneakingPose()) {
|
if (isGravityNegative() && !entity.isSneaking() && entity.isInSneakingPose()) {
|
||||||
|
@ -273,8 +273,6 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
soundPlaying = false;
|
soundPlaying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastPos = entity.getPos();
|
|
||||||
|
|
||||||
if (!entity.isOnGround()) {
|
if (!entity.isOnGround()) {
|
||||||
float heavyness = 1 - EnchantmentHelper.getEquipmentLevel(UEnchantments.HEAVY, entity) * 0.015F;
|
float heavyness = 1 - EnchantmentHelper.getEquipmentLevel(UEnchantments.HEAVY, entity) * 0.015F;
|
||||||
velocity.x *= heavyness;
|
velocity.x *= heavyness;
|
||||||
|
|
Loading…
Reference in a new issue