mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-15 03:51:20 +01:00
Add lostground_vcollide.
For efficiency (several?) other cases will be removable, once we model the per-move ground/medium properties more accurately also for the past move(s). At least lostground_pyramid should be removed then.
This commit is contained in:
parent
f0c6ab69b5
commit
222c6bd537
@ -704,7 +704,7 @@ public class SurvivalFly extends Check {
|
|||||||
}
|
}
|
||||||
// Descending.
|
// Descending.
|
||||||
if (yDistance <= 0) {
|
if (yDistance <= 0) {
|
||||||
if (lostGroundDescend(player, from, to, hDistance, yDistance, sprinting, data, cc)) {
|
if (lostGroundDescend(player, from, loc, to, hDistance, yDistance, sprinting, data, cc)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1828,12 +1828,26 @@ public class SurvivalFly extends Check {
|
|||||||
* @param cc
|
* @param cc
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean lostGroundDescend(final Player player, final PlayerLocation from, final PlayerLocation to, final double hDistance, final double yDistance, final boolean sprinting, final MovingData data, final MovingConfig cc) {
|
private boolean lostGroundDescend(final Player player, final PlayerLocation from, final Location loc, final PlayerLocation to, final double hDistance, final double yDistance, final boolean sprinting, final MovingData data, final MovingConfig cc) {
|
||||||
// TODO: re-organize for faster exclusions (hDistance, yDistance).
|
// TODO: re-organize for faster exclusions (hDistance, yDistance).
|
||||||
// TODO: more strict conditions
|
// TODO: more strict conditions
|
||||||
|
|
||||||
final double setBackYDistance = to.getY() - data.getSetBackY();
|
final double setBackYDistance = to.getY() - data.getSetBackY();
|
||||||
|
|
||||||
|
// Collides vertically.
|
||||||
|
// Note: checking loc should make sense, rather if loc is higher than from?
|
||||||
|
if (!to.isOnGround() && from.isOnGround(from.getY() - to.getY() + 0.001)) {
|
||||||
|
// Test for passability of the entire box, roughly from feet downwards.
|
||||||
|
// TODO: Efficiency with Location instances.
|
||||||
|
// TODO: Full bounds check (!).
|
||||||
|
final Location ref = from.getLocation();
|
||||||
|
ref.setY(to.getY());
|
||||||
|
if (BlockProperties.isPassable(from.getLocation(), ref)) {
|
||||||
|
// TODO: Needs new model (store detailed on-ground properties).
|
||||||
|
return applyLostGround(player, from, false, data, "vcollide");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data.sfJumpPhase <= 7) {
|
if (data.sfJumpPhase <= 7) {
|
||||||
// Check for sprinting down blocks etc.
|
// Check for sprinting down blocks etc.
|
||||||
if (data.lastYDist <= yDistance && setBackYDistance < 0 && !to.isOnGround()) {
|
if (data.lastYDist <= yDistance && setBackYDistance < 0 && !to.isOnGround()) {
|
||||||
@ -1844,6 +1858,7 @@ public class SurvivalFly extends Check {
|
|||||||
if (from.isOnGround(0.6, 0.4, 0.0, 0L) ) {
|
if (from.isOnGround(0.6, 0.4, 0.0, 0L) ) {
|
||||||
// TODO: further narrow down bounds ?
|
// TODO: further narrow down bounds ?
|
||||||
// Temporary "fix".
|
// Temporary "fix".
|
||||||
|
// TODO: Seems to virtually always be preceded by a "vcollide" move.
|
||||||
return applyLostGround(player, from, true, data, "pyramid");
|
return applyLostGround(player, from, true, data, "pyramid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user