mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-28 18:31:24 +01:00
[Bleeding] Adjust velocity handling.
Mainly horizontal velocity. Should reduce abuse potential for small amounts of velocity added. Repeated adding of velocity might pose problems, still.
This commit is contained in:
parent
5711a261a0
commit
d897c99a23
@ -524,8 +524,10 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
||||
|
||||
// Just try to estimate velocities over time. Not very precise, but works good enough most of the time. Do
|
||||
// general data modifications one for each event.
|
||||
if (data.horizontalVelocityCounter > 0D)
|
||||
data.horizontalVelocityCounter--;
|
||||
if (data.horizontalVelocityCounter > 0D){
|
||||
data.horizontalVelocityCounter--;
|
||||
data.horizontalFreedom -= 0.09;
|
||||
}
|
||||
else if (data.horizontalFreedom > 0.001D)
|
||||
data.horizontalFreedom *= 0.90D;
|
||||
|
||||
@ -890,7 +892,7 @@ public class MovingListener extends CheckListener implements TickListener, IRemo
|
||||
newVal = Math.sqrt(velocity.getX() * velocity.getX() + velocity.getZ() * velocity.getZ());
|
||||
if (newVal > 0D) {
|
||||
data.horizontalFreedom += newVal;
|
||||
data.horizontalVelocityCounter = 50; // Math.min(100, (int) Math.round(newVal * 10.0)); // 30;
|
||||
data.horizontalVelocityCounter = Math.min(100, (int) Math.round(newVal * 10.0)); // 30;
|
||||
}
|
||||
|
||||
// Set dirty flag here.
|
||||
|
@ -411,7 +411,7 @@ public class SurvivalFly extends Check {
|
||||
data.sfJumpPhase = 0;
|
||||
data.clearAccounting();
|
||||
// TODO: Experimental: reset velocity.
|
||||
if (toOnGround || Math.abs(yDistance) < 0.18){
|
||||
if (toOnGround && yDistance < 0 || Math.abs(yDistance) < 0.09){
|
||||
data.verticalVelocityCounter = 0;
|
||||
data.verticalFreedom = 0;
|
||||
data.verticalVelocity = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user