mirror of
https://github.com/squeek502/Squake.git
synced 2025-08-05 10:47:20 -04:00

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)
27 lines
752 B
Java
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;
|
|
}
|
|
}
|