mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Fixed transitions playing when first joining the world, fixed pegasus flight under inverted gravity
This commit is contained in:
parent
10545adb66
commit
0800865661
3 changed files with 26 additions and 11 deletions
|
@ -52,7 +52,7 @@ public class MovementControl extends MovementInputFromOptions {
|
||||||
|
|
||||||
moveStrafe = -moveStrafe;
|
moveStrafe = -moveStrafe;
|
||||||
|
|
||||||
if (player.getOwner().capabilities.isCreativeMode && player.getOwner().capabilities.isFlying) {
|
if (player.getOwner().capabilities.isFlying) {
|
||||||
tmp = jump;
|
tmp = jump;
|
||||||
jump = sneak;
|
jump = sneak;
|
||||||
sneak = tmp;
|
sneak = tmp;
|
||||||
|
|
|
@ -121,25 +121,33 @@ class PlayerGravityDelegate implements IUpdatable, IGravity, InbtSerialisable, I
|
||||||
|
|
||||||
isFlying = entity.capabilities.isFlying && !entity.capabilities.isCreativeMode;
|
isFlying = entity.capabilities.isFlying && !entity.capabilities.isCreativeMode;
|
||||||
|
|
||||||
if (!entity.capabilities.isFlying || !entity.capabilities.isCreativeMode) {
|
|
||||||
if (gravity != 0) {
|
if (gravity != 0) {
|
||||||
|
if (!entity.capabilities.isFlying) {
|
||||||
entity.motionY += 0.08;
|
entity.motionY += 0.08;
|
||||||
entity.motionY -= gravity;
|
entity.motionY -= gravity;
|
||||||
|
}
|
||||||
|
|
||||||
entity.onGround = !entity.world.isAirBlock(new BlockPos(entity.posX, entity.posY + entity.height + 0.5F, entity.posZ));
|
entity.onGround = !entity.world.isAirBlock(new BlockPos(entity.posX, entity.posY + entity.height + 0.5F, entity.posZ));
|
||||||
|
|
||||||
|
if (entity.onGround) {
|
||||||
|
entity.capabilities.isFlying = isFlying = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float bodyHeight = getTargetBodyHeight(player);
|
float bodyHeight = getTargetBodyHeight(player);
|
||||||
|
|
||||||
MixinEntity.setSize(entity, entity.width, player.getInterpolator().interpolate("standingHeight", bodyHeight, 10));
|
|
||||||
float eyeHeight = getTargetEyeHeight(player);
|
float eyeHeight = getTargetEyeHeight(player);
|
||||||
|
|
||||||
if (gravity < 0) {
|
if (gravity < 0) {
|
||||||
eyeHeight = bodyHeight - eyeHeight;
|
eyeHeight = bodyHeight - eyeHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.eyeHeight = player.getInterpolator().interpolate("eyeHeight", eyeHeight, 10);
|
if (entity.ticksExisted > 10) {
|
||||||
|
bodyHeight = player.getInterpolator().interpolate("standingHeight", bodyHeight, 10);
|
||||||
|
eyeHeight = player.getInterpolator().interpolate("eyeHeight", eyeHeight, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
MixinEntity.setSize(entity, entity.width, bodyHeight);
|
||||||
|
entity.eyeHeight = eyeHeight;
|
||||||
|
|
||||||
if (gravity < 0) {
|
if (gravity < 0) {
|
||||||
if (entity.isSneaking()) {
|
if (entity.isSneaking()) {
|
||||||
|
@ -192,13 +200,15 @@ class PlayerGravityDelegate implements IUpdatable, IGravity, InbtSerialisable, I
|
||||||
protected void moveFlying(EntityPlayer player) {
|
protected void moveFlying(EntityPlayer player) {
|
||||||
|
|
||||||
float forward = 0.00015F * flightExperience * player.moveForward;
|
float forward = 0.00015F * flightExperience * player.moveForward;
|
||||||
|
int factor = gravity < 0 ? -1 : 1;
|
||||||
|
boolean sneak = !player.isSneaking();
|
||||||
|
|
||||||
// vertical drop due to gravity
|
// vertical drop due to gravity
|
||||||
if (!player.isSneaking()) {
|
if (sneak) {
|
||||||
player.motionY -= 0.05F - getHorizontalMotion(player) / 100;
|
player.motionY -= (0.05F - getHorizontalMotion(player) / 100) * factor;
|
||||||
} else {
|
} else {
|
||||||
forward += 0.005F;
|
forward += 0.005F;
|
||||||
player.motionY -= 0.0005F;
|
player.motionY -= 0.0005F * factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
player.motionX += - forward * MathHelper.sin(player.rotationYaw * 0.017453292F);
|
player.motionX += - forward * MathHelper.sin(player.rotationYaw * 0.017453292F);
|
||||||
|
|
|
@ -22,10 +22,15 @@ class PlayerView extends MotionCompositor implements IView {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getGravity().getGravitationConstant() < 0) {
|
if (player.getGravity().getGravitationConstant() < 0) {
|
||||||
|
roll = -roll;
|
||||||
roll += 180;
|
roll += 180;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (float)player.getInterpolator().interpolate("roll", (float)roll, 100);
|
if (player.getEntity().ticksExisted > 10) {
|
||||||
|
roll = player.getInterpolator().interpolate("roll", (float)roll, 250);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (float)roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue