mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-06 18:50:54 +01:00
[BLEEDING] Refine passable-ray-tracing (block-edge treatment).
Previously the max. bounds hitting the block edge would not be considered as colliding, this can now be controlled with a flag. If the flag is set, you will collide at offsets of 1.0 for either coordinate (not if the offset is < 1.0).
This commit is contained in:
parent
4c7f88ec5c
commit
d0aea7feaa
@ -350,6 +350,9 @@ public class BlockProperties {
|
|||||||
/** THIN FENCE (glass panes, iron fence) */
|
/** THIN FENCE (glass panes, iron fence) */
|
||||||
public static final long F_THIN_FENCE = 0x80000;
|
public static final long F_THIN_FENCE = 0x80000;
|
||||||
|
|
||||||
|
/** Meta-flag to indicate that the (max.-) edges should mean a collision, can be passed to collidesBlock. */
|
||||||
|
public static final long F_COLLIDE_EDGES = 0x100000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map flag to names.
|
* Map flag to names.
|
||||||
*/
|
*/
|
||||||
@ -2096,10 +2099,21 @@ public class BlockProperties {
|
|||||||
bmaxY = bounds[4]; // maxY
|
bmaxY = bounds[4]; // maxY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (minX >= bmaxX + x || maxX < bminX + x) return false;
|
// Clearly outside of bounds.
|
||||||
else if (minY >= bmaxY + y || maxY < bminY + y) return false;
|
if (minX > bmaxX + x || maxX < bminX + x
|
||||||
else if (minZ >= bmaxZ + z || maxZ < bminZ + z) return false;
|
|| minY > bmaxY + y || maxY < bminY + y
|
||||||
else return true;
|
|| minZ > bmaxZ + z || maxZ < bminZ + z) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Hitting the max-edges (if allowed).
|
||||||
|
final boolean allowEdge = (flags & F_COLLIDE_EDGES) == 0;
|
||||||
|
if (minX == bmaxX + x && (bmaxX < 1.0 || allowEdge)
|
||||||
|
|| minY == bmaxY + y && (bmaxY < 1.0 || allowEdge)
|
||||||
|
|| minZ == bmaxZ + z && (bmaxZ < 1.0 || allowEdge)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Collision.
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2536,7 +2550,7 @@ public class BlockProperties {
|
|||||||
maxZ = dZ * dT + oZ + blockZ;
|
maxZ = dZ * dT + oZ + blockZ;
|
||||||
minZ = oZ + blockZ;
|
minZ = oZ + blockZ;
|
||||||
}
|
}
|
||||||
if (!collidesBlock(access, minX, minY, minZ, maxX, maxY, maxZ, blockX, blockY, blockZ, id, bounds, blockFlags[id])){
|
if (!collidesBlock(access, minX, minY, minZ, maxX, maxY, maxZ, blockX, blockY, blockZ, id, bounds, blockFlags[id] | F_COLLIDE_EDGES)){
|
||||||
// TODO: Might check for fence too, here.
|
// TODO: Might check for fence too, here.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user