Skip to content

Commit

Permalink
Tweak lost-ground workarounds.
Browse files Browse the repository at this point in the history
Allow a little more on ascending, early abort on descending too fast.
  • Loading branch information
asofold committed Mar 2, 2013
1 parent ff409fd commit f28235c
Showing 1 changed file with 8 additions and 4 deletions.
Expand Up @@ -505,19 +505,23 @@ private boolean lostGround(final Player player, final PlayerLocation from, final
return applyWorkaround(player, from, true, data);
}


if (yDistance > 0.5 + 0.2 * data.jumpAmplifier){
if (yDistance > 0.52 + 0.2 * data.jumpAmplifier){
// TODO: 0.52 instead of 0.5 - not sure if this helps with sprinting.
// All following checks are ruled out by this.
// (This should rarely ever happen, except for velocity and pistons.)
return false;
}
else if (yDistance < -0.5){
// Too fast falling.
return false;
}

final double setBackYDistance = to.getY() - data.getSetBackY();

if (yDistance <= 0){
if (data.sfJumpPhase <= 7){
// Check for sprinting down blocks etc.
if (yDistance >= -0.5 && data.sfLastYDist <= yDistance && setBackYDistance < 0 && !to.isOnGround()){
if (data.sfLastYDist <= yDistance && setBackYDistance < 0 && !to.isOnGround()){
// TODO: setbackydist: <= - 1.0 or similar
// TODO: <= 7 might work with speed II, not sure with above.
// TODO: account for speed/sprint
Expand All @@ -539,7 +543,7 @@ private boolean lostGround(final Player player, final PlayerLocation from, final
}
}
// Lost ground while falling onto/over edges of blocks.
if (yDistance < 0 && yDistance >= -0.5 && hDistance <= 0.5 && data.sfLastYDist < 0 && yDistance > data.sfLastYDist && !to.isOnGround()){
if (yDistance < 0 && hDistance <= 0.5 && data.sfLastYDist < 0 && yDistance > data.sfLastYDist && !to.isOnGround()){
// TODO: Should this be an extra lost-ground(to) check, setting toOnGround [for no-fall no difference]?
// TODO: yDistance <= 0 might be better.
// Also clear accounting data.
Expand Down

0 comments on commit f28235c

Please sign in to comment.