Let's have different climb speed thresholds for ascend and descend.

Configurability ... later.
This commit is contained in:
asofold 2016-06-23 20:23:18 +02:00
parent c9efd7b76c
commit 99df1f65da
2 changed files with 7 additions and 4 deletions

View File

@ -63,7 +63,9 @@ public class Magic {
public static final double GLIDE_HORIZONTAL_GAIN_MAX = GRAVITY_MAX / 2.0;
// Vertical speeds/modifiers.
public static final double climbSpeed = WALK_SPEED * 1.3; // TODO: Check if the factor is needed!
public static final double climbSpeedAscend = 0.119;
public static final double climbSpeedDescend = 0.151;
/**
* Some kind of minimum y descend speed (note the negative sign), for an
* already advanced gliding/falling phase with elytra.

View File

@ -1677,15 +1677,16 @@ public class SurvivalFly extends Check {
final double jumpHeight = 1.35 + (data.jumpAmplifier > 0 ? (0.6 + data.jumpAmplifier - 1.0) : 0.0);
// TODO: ladders are ground !
// TODO: yDistance < 0.0 ?
if (Math.abs(yDistance) > Magic.climbSpeed) {
final double maxSpeed = yDistance < 0.0 ? Magic.climbSpeedDescend : Magic.climbSpeedAscend;
if (Math.abs(yDistance) > maxSpeed) {
if (from.isOnGround(jumpHeight, 0D, 0D, BlockProperties.F_CLIMBABLE)) {
if (yDistance > data.liftOffEnvelope.getMaxJumpGain(data.jumpAmplifier)+ 0.1) {
tags.add("climbstep");
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance) - Magic.climbSpeed);
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance) - maxSpeed);
}
} else {
tags.add("climbspeed");
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance) - Magic.climbSpeed);
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance) - maxSpeed);
}
}
if (yDistance > 0) {