mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-28 10:21:22 +01:00
Change quick-exit check for passable.
* Include the case for manhattan == 1. * Use BlockProperties.isPassable.
This commit is contained in:
parent
7c1b2eaed3
commit
589dc77510
@ -28,13 +28,20 @@ public class Passable extends Check {
|
||||
String tags = "";
|
||||
// Block distances (sum, max) for from-to (not for loc!).
|
||||
final int manhattan = from.manhattan(to);
|
||||
// Skip moves inside of ignored blocks right away.
|
||||
if (manhattan == 0 && (BlockProperties.getBlockFlags(from.getTypeId()) & BlockProperties.F_IGN_PASSABLE) != 0) {
|
||||
return null;
|
||||
}
|
||||
// Skip moves inside of ignored blocks right away [works as long as we only check between foot-locations].
|
||||
if (manhattan <= 1 && BlockProperties.isPassable(from.getTypeId())) {
|
||||
// TODO: Monitor: BlockProperties.isPassable checks slightly different than before.
|
||||
if (manhattan == 0){
|
||||
return null;
|
||||
} else {
|
||||
// manhattan == 1
|
||||
if (BlockProperties.isPassable(to.getTypeId())) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean toPassable = to.isPassable();
|
||||
// General condition check for using ray-tracing.
|
||||
// TODO: Optimize: manhattan <= 1 and all blocks are completely passable.
|
||||
if (toPassable && cc.passableRayTracingCheck && (!cc.passableRayTracingBlockChangeOnly || manhattan > 0)) {
|
||||
rayTracing.set(from, to);
|
||||
rayTracing.loop();
|
||||
|
@ -1379,13 +1379,14 @@ public class BlockProperties {
|
||||
}
|
||||
|
||||
/**
|
||||
* Just check if a position is not inside of a block that has a bounding box.<br>
|
||||
* Just check if a block type is fully passable by default.<br>
|
||||
* This is an inaccurate check, it also returns false for doors etc.
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public static final boolean isPassable(final int id){
|
||||
final long flags = blockFlags[id];
|
||||
// TODO: What with non-solid blocks that are not passable ?
|
||||
if ((flags & (F_LIQUID | F_IGN_PASSABLE)) != 0) return true;
|
||||
else return (flags & F_SOLID) == 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user