Fix "onground" detection

This commit is contained in:
Evenprime 2012-02-09 18:01:52 +01:00
parent fbb7da1af2
commit df8cd92a8c

View File

@ -247,37 +247,37 @@ public class CheckUtil {
// Special case: Standing on a fence // Special case: Standing on a fence
// Behave as if there is a block on top of the fence // Behave as if there is a block on top of the fence
if((below == FENCE) && base != FENCE && isNonSolid(top)) { if((below == FENCE) && base != FENCE && isNonSolid(top)) {
type |= INGROUND; type = INGROUND;
} }
// Special case: Fence // Special case: Fence
// Being a bit above a fence // Being a bit above a fence
if(below != FENCE && isNonSolid(base) && types[world.getBlockTypeIdAt(x, y - 2, z)] == FENCE) { else if(below != FENCE && isNonSolid(base) && types[world.getBlockTypeIdAt(x, y - 2, z)] == FENCE) {
type |= ONGROUND; type = ONGROUND;
} }
if(isNonSolid(top)) { else if(isNonSolid(top)) {
// Simplest (and most likely) case: // Simplest (and most likely) case:
// Below the player is a solid block // Below the player is a solid block
if(isSolid(below) && isNonSolid(base)) { if(isSolid(below) && isNonSolid(base)) {
type |= ONGROUND; type = ONGROUND;
} }
// Next (likely) case: // Next (likely) case:
// There is a ladder // There is a ladder
if(isLadder(base) || isLadder(top)) { else if(isLadder(base) || isLadder(top)) {
type |= ONGROUND; type = ONGROUND;
} }
// Next (likely) case: // Next (likely) case:
// At least the block the player stands // At least the block the player stands
// in is solid // in is solid
if(isSolid(base)) { else if(isSolid(base)) {
type |= INGROUND; type = INGROUND;
} }
} }
// Last simple case: Player touches liquid // (In every case, check for water)
if(isLiquid(base) || isLiquid(top)) { if(isLiquid(base) || isLiquid(top)) {
type |= LIQUID | INGROUND; type |= LIQUID | INGROUND;
} }