mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-29 23:17:41 +02:00
Passable split move: Always test vertical-first, never horizontal-first.
Vertical part first was ineffective due to yDiff never being > 0.0 and <= 0.0 at the same time, beside vertical-first is what the client is doing. Might want to check the full bounding box with the simplified y-first model, also checking x and z parts in the right order, from there on.
This commit is contained in:
parent
bbe20a4d84
commit
2d24049db9
@ -189,13 +189,8 @@ public class Passable extends Check {
|
||||
* @param manhattan
|
||||
* @return
|
||||
*/
|
||||
private boolean allowsSplitMove(final PlayerLocation from, final PlayerLocation to, int manhattan) {
|
||||
final double yDiff = to.getY() - from.getY() ;
|
||||
if (manhattan <= 3 && yDiff > 0.0 && Math.abs(yDiff) < 1.0) {
|
||||
// Workaround for client-side calculations not being possible (y vs. horizontal move).
|
||||
// TODO: Alternative: Test if "real" ray-tracing would fix it (might not!).
|
||||
if (yDiff > 0.0) {
|
||||
// y first.
|
||||
private boolean allowsSplitMove(final PlayerLocation from, final PlayerLocation to, final int manhattan) {
|
||||
// Always check y first.
|
||||
rayTracing.set(from.getX(), from.getY(), from.getZ(), from.getX(), to.getY(), from.getZ());
|
||||
rayTracing.loop();
|
||||
if (!rayTracing.collides()) {
|
||||
@ -206,20 +201,25 @@ public class Passable extends Check {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// horizontal first.
|
||||
rayTracing.set(from.getX(), from.getY(), from.getZ(), to.getX(), from.getY(), to.getZ());
|
||||
rayTracing.loop();
|
||||
if (!rayTracing.collides()) {
|
||||
// y second.
|
||||
rayTracing.set(to.getX(), from.getY(), to.getZ(), to.getX(), to.getY(), to.getZ());
|
||||
rayTracing.loop();
|
||||
if (!rayTracing.collides()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Horizontal first may be obsolete, due to splitting moves anyway and due to not having been called ever (!).
|
||||
// final double yDiff = to.getY() - from.getY() ;
|
||||
// if (manhattan <= 3 && Math.abs(yDiff) < 1.0 && yDiff < 0.0) {
|
||||
// // Workaround for client-side calculations not being possible (y vs. horizontal move). Typically stairs.
|
||||
// // horizontal first.
|
||||
// if (data.debug) {
|
||||
// DebugUtil.debug(from.getPlayer().getName() + " passable - Test horizontal move first.");
|
||||
// }
|
||||
// rayTracing.set(from.getX(), from.getY(), from.getZ(), to.getX(), from.getY(), to.getZ());
|
||||
// rayTracing.loop();
|
||||
// if (!rayTracing.collides()) {
|
||||
// // y second.
|
||||
// rayTracing.set(to.getX(), from.getY(), to.getZ(), to.getX(), to.getY(), to.getZ());
|
||||
// rayTracing.loop();
|
||||
// if (!rayTracing.collides()) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user