Squake/java/squeek/quakemovement/QuakeServerPlayer.java
squeek 9c4115ba6c First pass: Port to 1.11.2 and drop PlayerAPI dependency
Still some issues to work out, mainly "Player moved wrongly" when sneaking + jumping while going over a certain speed (surprisingly, this is not related to trimping, still happens if trimping is disabled)
2017-04-03 18:49:15 -07:00

27 lines
752 B
Java

package squeek.quakemovement;
import net.minecraft.entity.player.EntityPlayer;
public class QuakeServerPlayer
{
// we can get away with a single static variable here instead of a <Player, boolean> map
// because we only care about the state before it has any possibility of changing
private static boolean wasVelocityChangedBeforeFall = false;
public static void beforeFall(EntityPlayer player, float fallDistance, float damageMultiplier)
{
if (player.world.isRemote)
return;
wasVelocityChangedBeforeFall = player.velocityChanged;
}
public static void afterFall(EntityPlayer player, float fallDistance, float damageMultiplier)
{
if (player.world.isRemote)
return;
player.velocityChanged = wasVelocityChangedBeforeFall;
}
}