From 8353bdbfbe21109ba7956b4b54793447bc1f103a Mon Sep 17 00:00:00 2001 From: asofold Date: Tue, 22 Mar 2016 19:19:56 +0100 Subject: [PATCH] Quick and dirty: noob tower. (Might still need review for exploits.) --- .../checks/moving/magic/LostGround.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/magic/LostGround.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/magic/LostGround.java index 01e60a08..624a3d85 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/magic/LostGround.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/magic/LostGround.java @@ -87,14 +87,25 @@ public class LostGround { // TODO: Combine / refine preconditions for step height related. // TODO: || yDistance <= jump estimate? if (yDistance <= cc.sfStepHeight && hDistance <= 1.5) { // hDistance is arbitrary, just to confine. - // Half block step up (definitive). - // TODO: && hDistance < 0.5 ~ switch to about 2.2 * baseSpeed once available. - if (setBackYDistance <= Math.max(0.0, 1.3 + 0.2 * data.jumpAmplifier) && to.isOnGround()) { - // TODO: hDistance > 0.0 - if (lastMove.yDistance < 0.0 || yDistance <= cc.sfStepHeight && from.isOnGround(cc.sfStepHeight - yDistance)) { - return applyLostGround(player, from, true, data, "step", tags); + if (setBackYDistance <= Math.max(0.0, 1.3 + 0.2 * data.jumpAmplifier)) { + // Half block step up (definitive). + // TODO: && hDistance < 0.5 ~ switch to about 2.2 * baseSpeed once available. + if (to.isOnGround()) { + // TODO: hDistance > 0.0 + if (lastMove.yDistance < 0.0 || yDistance <= cc.sfStepHeight && from.isOnGround(cc.sfStepHeight - yDistance)) { + return applyLostGround(player, from, true, data, "step", tags); + } + } + // Noob tower (moving up placing blocks underneath). Rather since 1.9: player jumps off with 0.4 speed but ground within 0.42. + // TODO: Confine by actually having placed a block nearby, possibly rather low jumpphase (3, 4). + final double maxJumpGain = data.liftOffEnvelope.getMaxJumpGain(data.jumpAmplifier); + if (yDistance > 0.0 && yDistance < maxJumpGain && lastMove.yDistance < 0.0 && maxJumpGain > yDistance + && Math.abs(lastMove.yDistance) + Magic.GRAVITY_MAX > cc.yOnGround + maxJumpGain - yDistance + && from.isOnGround(cc.yOnGround + maxJumpGain - yDistance)) { + return applyLostGround(player, from, true, data, "nbtwr", tags); } } + // Could step up (but might move to another direction, potentially). if (lastMove.yDistance < 0.0) { // TODO: <= ? // Generic could step.