Fix detection of water (and jumping out of water)

This commit is contained in:
Evenprime 2012-02-05 18:55:40 +01:00
parent e03c577717
commit 026d6ef00e
2 changed files with 14 additions and 14 deletions

View File

@ -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) {

View File

@ -243,7 +243,6 @@ public class RunningCheck extends MovingCheck {
}
return distanceAboveLimit;
}
@Override