mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-02 13:57:49 +01:00
Passable: Allow moving in a block, if head is free (no block
transitions).
This commit is contained in:
parent
85848c6f72
commit
298336bf6b
@ -26,7 +26,14 @@ public class Passable extends Check {
|
|||||||
// Allow moving into the same block.
|
// Allow moving into the same block.
|
||||||
if (from.isSameBlock(to)){
|
if (from.isSameBlock(to)){
|
||||||
if (!from.isPassable()){
|
if (!from.isPassable()){
|
||||||
|
final double eyeY = to.getY() + player.getEyeHeight();
|
||||||
|
final int eyeBlockY = Location.locToBlock(eyeY);
|
||||||
|
if (eyeBlockY != to.getBlockY()){
|
||||||
|
if (BlockProperties.isPassable(to.getBlockAccess(), to.getX(), eyeY, to.getZ(), to.getTypeId(to.getBlockX(), eyeBlockY, to.getBlockZ()))){
|
||||||
|
// Allow moving inside the same block if head is free.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Only allow moving further out of the block (still allows going round in circles :p)
|
// Only allow moving further out of the block (still allows going round in circles :p)
|
||||||
// TODO: account for actual bounding box.
|
// TODO: account for actual bounding box.
|
||||||
final Vector blockMiddle = new Vector(0.5 + from.getBlockX(), 0.5 + from.getBlockY(), 0.5 + from.getBlockZ());
|
final Vector blockMiddle = new Vector(0.5 + from.getBlockX(), 0.5 + from.getBlockY(), 0.5 + from.getBlockZ());
|
||||||
|
Loading…
Reference in New Issue
Block a user