mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-03 19:00:30 +02:00
Change resetting of yOnGround for NoFall.
Use CheckConfig to determine if it is necessary. Move resetting to a method. Collect block flags again.
This commit is contained in:
parent
8bed6fb2de
commit
7adef83687
|
@ -96,6 +96,11 @@ public class NoFall extends Check {
|
||||||
|
|
||||||
final double oldNFDist = data.noFallFallDistance;
|
final double oldNFDist = data.noFallFallDistance;
|
||||||
|
|
||||||
|
// Reset-cond is not touched by yOnGround.
|
||||||
|
// TODO: Distinguish water depth vs. fall distance ?
|
||||||
|
final boolean fromReset = from.isResetCond();
|
||||||
|
final boolean toReset = to.isResetCond();
|
||||||
|
|
||||||
// Adapt yOnGround if necessary (sf uses another setting).
|
// Adapt yOnGround if necessary (sf uses another setting).
|
||||||
if (yDiff < 0 && cc.yOnGround < cc.noFallyOnGround) {
|
if (yDiff < 0 && cc.yOnGround < cc.noFallyOnGround) {
|
||||||
// In fact this is somewhat heuristic, but it seems to work well.
|
// In fact this is somewhat heuristic, but it seems to work well.
|
||||||
|
@ -104,12 +109,9 @@ public class NoFall extends Check {
|
||||||
adjustYonGround(from, to , cc.noFallyOnGround);
|
adjustYonGround(from, to , cc.noFallyOnGround);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Distinguish water depth vs. fall distance!
|
|
||||||
|
|
||||||
final boolean fromOnGround = from.isOnGround();
|
final boolean fromOnGround = from.isOnGround();
|
||||||
final boolean fromReset = from.isResetCond();
|
|
||||||
final boolean toOnGround = to.isOnGround();
|
final boolean toOnGround = to.isOnGround();
|
||||||
final boolean toReset = to.isResetCond();
|
|
||||||
|
|
||||||
// TODO: early returns (...)
|
// TODO: early returns (...)
|
||||||
|
|
||||||
|
@ -182,13 +184,11 @@ public class NoFall extends Check {
|
||||||
* @param cc
|
* @param cc
|
||||||
*/
|
*/
|
||||||
private void adjustYonGround(final PlayerLocation from, final PlayerLocation to, final double yOnGround) {
|
private void adjustYonGround(final PlayerLocation from, final PlayerLocation to, final double yOnGround) {
|
||||||
if (!from.isResetCond() && !from.isOnGround()){
|
if (!from.isOnGround()){
|
||||||
from.setyOnGround(yOnGround);
|
from.setyOnGround(yOnGround);
|
||||||
from.collectBlockFlags(yOnGround);
|
|
||||||
}
|
}
|
||||||
if (!to.isResetCond() && !to.isOnGround()){
|
if (!to.isOnGround()){
|
||||||
to.setyOnGround(yOnGround);
|
to.setyOnGround(yOnGround);
|
||||||
to.collectBlockFlags(yOnGround);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user