mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Use local velocity on the client (since other players don't send their velocity)
This commit is contained in:
parent
50f3df37a2
commit
49e74f4c54
3 changed files with 12 additions and 3 deletions
|
@ -44,7 +44,7 @@ public class Main extends MineLPDelegate implements ClientModInitializer {
|
|||
if (pony.getMotion().isFlying()) {
|
||||
model.getAttributes().wingAngle = MathHelper.clamp(pony.getMotion().getWingAngle() / 3F - (float)Math.PI * 0.4F, -2, 0);
|
||||
|
||||
Vec3d motion = entity.getVelocity();
|
||||
Vec3d motion = pony.getMotion().getClientVelocity();
|
||||
double zMotion = Math.sqrt(motion.x * motion.x + motion.z * motion.z);
|
||||
model.getAttributes().isGoingFast |= zMotion > 0.4F;
|
||||
model.getAttributes().isGoingFast |= pony.getMotion().isDiving();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.minelittlepony.unicopia.entity.player;
|
||||
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
/**
|
||||
* Interface for controlling flight.
|
||||
*/
|
||||
|
@ -18,4 +20,6 @@ public interface Motion {
|
|||
float getWingAngle();
|
||||
|
||||
PlayerDimensions getDimensions();
|
||||
|
||||
Vec3d getClientVelocity();
|
||||
}
|
||||
|
|
|
@ -94,6 +94,11 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
return dimensions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getClientVelocity() {
|
||||
return lastVel;
|
||||
}
|
||||
|
||||
public final float getPersistantGravityModifier() {
|
||||
return super.getGravityModifier();
|
||||
}
|
||||
|
@ -133,7 +138,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
|
||||
@Override
|
||||
public boolean isRainbooming() {
|
||||
return pony.getSpellSlot().get(SpellType.RAINBOOM, true).isPresent();
|
||||
return SpellType.RAINBOOM.isOn(pony);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -208,7 +213,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
}
|
||||
|
||||
public double getHorizontalMotion() {
|
||||
return lastVel.horizontalLengthSquared();
|
||||
return getClientVelocity().horizontalLengthSquared();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue