Skip to content

Commit

Permalink
Add null check and refine preconditions for on-ground shortcut.
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed Mar 6, 2013
1 parent f20fc85 commit 0eaf958
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -446,9 +446,11 @@ public boolean isOnGround() {
final long flags = BlockProperties.getBlockFlags(id);
if ((flags & BlockProperties.F_GROUND) != 0 && (flags & BlockProperties.F_VARIABLE) == 0){
final double[] bounds = blockCache.getBounds(blockX, bY, blockZ);
if (BlockProperties.collidesBlock(blockCache, x, minY - yOnGround, z, x, minY, z, blockX, bY, blockZ, id, bounds, flags)){
// Check collision if not inside of the block. [Might be a problem for cauldron or similar + something solid above.]
if (bounds != null && y - bY >= bounds[4] && BlockProperties.collidesBlock(blockCache, x, minY - yOnGround, z, x, minY, z, blockX, bY, blockZ, id, bounds, flags)){
// TODO: passable vs maxY ?
if (!BlockProperties.isPassableWorkaround(blockCache, blockX, bY, blockZ, minX - blockX, minY - yOnGround - bY, minZ - blockZ, id, maxX - minX, yOnGround, maxZ - minZ, 1.0)){
// TODO: Might have to exclude on base of maxY, for case of being inside of blocks doors etc.
onGround = true;
}
}
Expand Down

0 comments on commit 0eaf958

Please sign in to comment.