Skip to content

Commit

Permalink
Another edge case of lost-ground (ascending + step-up when sprinting).
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed Mar 6, 2015
1 parent 48b7bca commit 0932edd
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -644,11 +644,11 @@ public boolean isReallySneaking(final Player player) {
*/
private boolean lostGround(final Player player, final PlayerLocation from, final PlayerLocation to, final double hDistance, final double yDistance, final boolean sprinting, final MovingData data, final MovingConfig cc) {
// TODO: Confine by max y distance and max/min xz-distance?
if (yDistance >= -0.5 && yDistance <= 0.52 + data.jumpAmplifier * 0.2) {
if (yDistance >= -0.5 && yDistance <= 0.594 + data.jumpAmplifier * 0.2) {
// "Mild" Ascending / descending.
// Stairs.
// TODO: More safety guards.
if (from.isAboveStairs()) {
if (yDistance <= 0.52 + data.jumpAmplifier * 0.2 && from.isAboveStairs()) {
applyLostGround(player, from, true, data, "stairs");
return true;
}
Expand Down Expand Up @@ -1151,8 +1151,8 @@ private boolean lostGroundAscend(final Player player, final PlayerLocation from,
final double setBackYDistance = to.getY() - data.getSetBackY();

// Half block step up.
if (yDistance <= 0.5 && hDistance < 0.5 && setBackYDistance <= 1.3 + 0.2 * data.jumpAmplifier && to.isOnGround()) {
if (data.sfLastYDist < 0.0 || from.isOnGround(0.5 - Math.abs(yDistance))) {
if (yDistance <= (sprinting ? 0.594 : 0.5) && hDistance < 0.5 && setBackYDistance <= 1.3 + 0.2 * data.jumpAmplifier && to.isOnGround()) {
if (data.sfLastYDist < 0.0 || yDistance <= 0.5 && from.isOnGround(0.5 - Math.abs(yDistance))) {
return applyLostGround(player, from, true, data, "step");
}
}
Expand Down

0 comments on commit 0932edd

Please sign in to comment.