mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-20 06:21:23 +01:00
Fix detection of water (and jumping out of water)
This commit is contained in:
parent
e03c577717
commit
026d6ef00e
@ -222,45 +222,46 @@ public class CheckUtil {
|
||||
final int base = types[world.getBlockTypeIdAt(x, y, z)];
|
||||
final int below = types[world.getBlockTypeIdAt(x, y - 1, z)];
|
||||
|
||||
int type = 0;
|
||||
// Special case: Standing on a fence
|
||||
// Behave as if there is a block on top of the fence
|
||||
if((below == FENCE) && base != FENCE && isNonSolid(top)) {
|
||||
return INGROUND;
|
||||
type |= INGROUND;
|
||||
}
|
||||
|
||||
// Special case: Fence
|
||||
// Being a bit above a fence
|
||||
if(below != FENCE && isNonSolid(base) && types[world.getBlockTypeIdAt(x, y - 2, z)] == FENCE) {
|
||||
return ONGROUND;
|
||||
type |= ONGROUND;
|
||||
}
|
||||
|
||||
if(isNonSolid(top)) {
|
||||
// Simplest (and most likely) case:
|
||||
// Below the player is a solid block
|
||||
if(isSolid(below) && isNonSolid(base)) {
|
||||
return ONGROUND;
|
||||
type |= ONGROUND;
|
||||
}
|
||||
|
||||
// Next (likely) case:
|
||||
// There is a ladder
|
||||
if(isLadder(base) || isLadder(top)) {
|
||||
return ONGROUND;
|
||||
type |= ONGROUND;
|
||||
}
|
||||
|
||||
// Next (likely) case:
|
||||
// At least the block the player stands
|
||||
// in is solid
|
||||
if(isSolid(base)) {
|
||||
return INGROUND;
|
||||
type |= INGROUND;
|
||||
}
|
||||
}
|
||||
|
||||
// Last simple case: Player touches liquid
|
||||
if(isLiquid(base) || isLiquid(top)) {
|
||||
return LIQUID | INGROUND;
|
||||
type |= LIQUID | INGROUND;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return type;
|
||||
}
|
||||
|
||||
public static final boolean isSolid(final int value) {
|
||||
|
@ -243,7 +243,6 @@ public class RunningCheck extends MovingCheck {
|
||||
}
|
||||
|
||||
return distanceAboveLimit;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user