From 99df1f65dacc46c407511ff8bd8336ec84cf1be4 Mon Sep 17 00:00:00 2001 From: asofold Date: Thu, 23 Jun 2016 20:23:18 +0200 Subject: [PATCH] Let's have different climb speed thresholds for ascend and descend. Configurability ... later. --- .../neatmonster/nocheatplus/checks/moving/magic/Magic.java | 4 +++- .../nocheatplus/checks/moving/player/SurvivalFly.java | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/magic/Magic.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/magic/Magic.java index a32cc6f5..26ec5359 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/magic/Magic.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/magic/Magic.java @@ -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. diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/player/SurvivalFly.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/player/SurvivalFly.java index 0d1bafc6..54b77afa 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/player/SurvivalFly.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/player/SurvivalFly.java @@ -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) {