mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Rewrote flying to be easier to control
This commit is contained in:
parent
09d167765d
commit
bb0718bbd3
1 changed files with 17 additions and 5 deletions
|
@ -134,11 +134,7 @@ class PlayerGravityDelegate implements IUpdatable, IGravity, InbtSerialisable, I
|
|||
entity.playSound(SoundEvents.ENTITY_GUARDIAN_FLOP, 1, 1);
|
||||
}
|
||||
|
||||
float forward = 0.00015F * flightExperience;
|
||||
|
||||
entity.motionX += - forward * MathHelper.sin(entity.rotationYaw * 0.017453292F);
|
||||
entity.motionY -= 0.05F - getHorizontalMotion(entity) / 100;
|
||||
entity.motionZ += forward * MathHelper.cos(entity.rotationYaw * 0.017453292F);
|
||||
moveFlying(entity);
|
||||
|
||||
if (ticksInAir > 0 && ticksInAir % 12 == 0) {
|
||||
entity.playSound(USounds.WING_FLAP, 0.5F, 1);
|
||||
|
@ -154,6 +150,22 @@ class PlayerGravityDelegate implements IUpdatable, IGravity, InbtSerialisable, I
|
|||
}
|
||||
}
|
||||
|
||||
protected void moveFlying(EntityPlayer player) {
|
||||
|
||||
float forward = 0.00015F * flightExperience * player.moveForward;
|
||||
|
||||
// vertical drop due to gravity
|
||||
if (!player.isSneaking()) {
|
||||
player.motionY -= 0.05F - getHorizontalMotion(player) / 100;
|
||||
} else {
|
||||
forward += 0.005F;
|
||||
player.motionY -= 0.0005F;
|
||||
}
|
||||
|
||||
player.motionX += - forward * MathHelper.sin(player.rotationYaw * 0.017453292F);
|
||||
player.motionZ += forward * MathHelper.cos(player.rotationYaw * 0.017453292F);
|
||||
}
|
||||
|
||||
public void landHard(EntityPlayer player, float distance, float damageMultiplier) {
|
||||
if (distance <= 0) {
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue