mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +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);
|
entity.playSound(SoundEvents.ENTITY_GUARDIAN_FLOP, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
float forward = 0.00015F * flightExperience;
|
moveFlying(entity);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (ticksInAir > 0 && ticksInAir % 12 == 0) {
|
if (ticksInAir > 0 && ticksInAir % 12 == 0) {
|
||||||
entity.playSound(USounds.WING_FLAP, 0.5F, 1);
|
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) {
|
public void landHard(EntityPlayer player, float distance, float damageMultiplier) {
|
||||||
if (distance <= 0) {
|
if (distance <= 0) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue