Confine the bunnyhop envelopy by y-Distance further.

* Below 1.7 allow ground-to-ground hop with moderate speed. Might be
there is more speed possible, shortly tested on 1.6.4.
* From 1.7.10 on, hitting the jump envelope or having the head
obstructed is demanded.
This commit is contained in:
asofold 2015-11-29 13:04:22 +01:00
parent 567647fd12
commit 2e11cdac0b
3 changed files with 23 additions and 9 deletions

View File

@ -82,7 +82,7 @@ public class MovingConfig extends ACheckConfig {
public static final double Y_ON_GROUND_MAX = 0.0626;
// TODO: Model workarounds as lost ground, use Y_ON_GROUND_MIN?
public static final double Y_ON_GROUND_DEFAULT = 0.016; // Jump upwards, while placing blocks.
// public static final double Y_ON_GROUND_DEFAULT = 0.029; // Bounce off slime blocks.
// public static final double Y_ON_GROUND_DEFAULT = 0.029; // Bounce off slime blocks.
public final boolean ignoreCreative;
@ -137,6 +137,11 @@ public class MovingConfig extends ACheckConfig {
public final int survivalFlySwimmingSpeed;
public final int survivalFlyWalkingSpeed;
public final boolean survivalFlyCobwebHack;
/**
* If true, will allow moderate bunny hop without lift off. Applies for
* normal speed on 1.6.4 and probably below.
*/
public final boolean sfGroundHop;
public final boolean survivalFlyAccountingH;
public final boolean survivalFlyAccountingV;
public final boolean sfSetBackPolicyVoid;
@ -177,7 +182,6 @@ public class MovingConfig extends ACheckConfig {
public final int traceSize;
public final double traceMergeDist;
/**
* Instantiates a new moving configuration.
*
@ -236,6 +240,7 @@ public class MovingConfig extends ACheckConfig {
survivalFlySwimmingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_SWIMMINGSPEED, 100);
survivalFlyWalkingSpeed = config.getInt(ConfPaths.MOVING_SURVIVALFLY_WALKINGSPEED, 100);
survivalFlyCobwebHack = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_COBWEBHACK, true);
sfGroundHop = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_GROUNDHOP, ServerVersion.compareMinecraftVersion("1.7") == -1);
survivalFlyAccountingH = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_EXTENDED_HACC, false);
survivalFlyAccountingV = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_EXTENDED_VACC);
sfSetBackPolicyFallDamage = config.getBoolean(ConfPaths.MOVING_SURVIVALFLY_SETBACKPOLICY_FALLDAMAGE);
@ -291,7 +296,6 @@ public class MovingConfig extends ACheckConfig {
}
/* (non-Javadoc)
* @see fr.neatmonster.nocheatplus.checks.ICheckConfig#isEnabled(fr.neatmonster.nocheatplus.checks.CheckType)
*/

View File

@ -1406,7 +1406,7 @@ public class SurvivalFly extends Check {
// TODO: Would quick returns make sense for hDistanceAfterFailure == 0.0?
// Test bunny early, because it applies often and destroys as little as possible.
hDistanceAboveLimit = bunnyHop(from, to, hDistance, hAllowedDistance, hDistanceAboveLimit, yDistance, sprinting, data);
hDistanceAboveLimit = bunnyHop(from, to, hDistance, hAllowedDistance, hDistanceAboveLimit, yDistance, sprinting, data, cc);
// After failure permission checks ( + speed modifier + sneaking + blocking + speeding) and velocity (!).
if (hDistanceAboveLimit > 0.0 && !skipPermChecks) {
@ -1434,7 +1434,7 @@ public class SurvivalFly extends Check {
// After failure bunny (2nd).
if (hDistanceAboveLimit > 0) {
// (Could distinguish tags from above call).
hDistanceAboveLimit = bunnyHop(from, to, hDistance, hAllowedDistance, hDistanceAboveLimit, yDistance, sprinting, data);
hDistanceAboveLimit = bunnyHop(from, to, hDistance, hAllowedDistance, hDistanceAboveLimit, yDistance, sprinting, data, cc);
}
// Horizontal buffer.
@ -1468,7 +1468,7 @@ public class SurvivalFly extends Check {
* @param data
* @return hDistanceAboveLimit
*/
private double bunnyHop(final PlayerLocation from, final PlayerLocation to, final double hDistance, final double hAllowedDistance, double hDistanceAboveLimit, final double yDistance, final boolean sprinting, final MovingData data) {
private double bunnyHop(final PlayerLocation from, final PlayerLocation to, final double hDistance, final double hAllowedDistance, double hDistanceAboveLimit, final double yDistance, final boolean sprinting, final MovingData data, final MovingConfig cc) {
// Check "bunny fly" here, to not fall over sprint resetting on the way.
boolean allowHop = true;
boolean double_bunny = false;
@ -1549,10 +1549,19 @@ public class SurvivalFly extends Check {
// TODO: Test bunny spike over all sorts of speeds + attributes.
// TODO: Allow slightly higher speed on lost ground?
// TODO: LiftOffEnvelope.allowBunny ?
if (data.liftOffEnvelope == LiftOffEnvelope.NORMAL // && yDistance >= 0.4
if (data.liftOffEnvelope == LiftOffEnvelope.NORMAL
&& !data.sfLowJump || data.sfNoLowJump
&& (data.sfJumpPhase == 0 && from.isOnGround() || data.sfJumpPhase <= 1 && data.noFallAssumeGround || double_bunny)
&& !from.isResetCond() && !to.isResetCond() // TODO: !to.isResetCond() should be reviewed.
// Y-distance envelope.
&& (
yDistance > 0.0
&& yDistance > data.liftOffEnvelope.getMaxJumpGain(data.jumpAmplifier) - GRAVITY_SPAN
|| yDistance > 0.0 && from.isHeadObstructed()
|| cc.sfGroundHop && yDistance >= 0
&& hAllowedDistance > 0.0 && hDistance / hAllowedDistance < 1.35
)
// Bad auto indent.
&& (data.sfJumpPhase == 0 && from.isOnGround() || data.sfJumpPhase <= 1 && data.noFallAssumeGround || double_bunny)
&& !from.isResetCond() && !to.isResetCond() // TODO: !to.isResetCond() should be reviewed.
) {
// TODO: Jump effect might allow more strictness.
// TODO: Expected minimum gain depends on last speed (!).

View File

@ -562,6 +562,7 @@ public abstract class ConfPaths {
public static final String MOVING_SURVIVALFLY_SWIMMINGSPEED = MOVING_SURVIVALFLY + "swimmingspeed";
public static final String MOVING_SURVIVALFLY_WALKINGSPEED = MOVING_SURVIVALFLY + "walkingspeed";
public static final String MOVING_SURVIVALFLY_COBWEBHACK = MOVING_SURVIVALFLY + "cobwebhack";
public static final String MOVING_SURVIVALFLY_GROUNDHOP = MOVING_SURVIVALFLY + "groundhop";
private static final String MOVING_SURVIVALFLY_EXTENDED = MOVING_SURVIVALFLY + "extended.";
public static final String MOVING_SURVIVALFLY_EXTENDED_HACC = MOVING_SURVIVALFLY_EXTENDED + "horizontal-accounting";
public static final String MOVING_SURVIVALFLY_EXTENDED_VACC = MOVING_SURVIVALFLY_EXTENDED + "vertical-accounting";