collidesBlock: Assume full block bounds for stairs.

This commit is contained in:
asofold 2012-11-12 11:53:55 +01:00
parent c282b8c648
commit f89cc50a6e

View File

@ -1179,7 +1179,7 @@ public class BlockProperties {
} }
/** /**
* Check if the bounds collide with the block for the given type id. * Check if the bounds collide with the block for the given type id at the given position.
* @param access * @param access
* @param minX * @param minX
* @param minY * @param minY
@ -1193,16 +1193,28 @@ public class BlockProperties {
// TODO: use internal block data unless delegation wanted? // TODO: use internal block data unless delegation wanted?
final Block block = Block.byId[id]; final Block block = Block.byId[id];
block.updateShape(access, x, y, z); block.updateShape(access, x, y, z);
final double bmaxY; final long flags = blockFlags[id];
if ((blockFlags[id] & F_HEIGHT150) != 0) bmaxY = 1.5; final double bminX, bminZ, bminY;
else if ((blockFlags[id] & F_HEIGHT100) != 0) bmaxY = 1.0; final double bmaxX, bmaxY, bmaxZ;
else bmaxY = block.y(); // maxY bmaxX = block.w(); // maxX
// if (minX > block.maxX + x || maxX < block.minX + x) return false; bmaxZ = block.A(); // maxZ
// else if (minY > block.maxY + y || maxY < block.minY + y) return false; if ((flags & F_STAIRS) != 0){
// else if (minZ > block.maxZ + z || maxZ < block.minZ + z) return false; // Mainly for on ground style checks, would not go too well with passable.
if (minX > block.w() + x || maxX < block.v() + x) return false; // TODO: change this to something like F_FULLBOX probably.
else if (minY > bmaxY + y || maxY < block.x() + y) return false; bminX = bminY = bminZ = 0D;
else if (minZ > block.A() + z || maxZ < block.z() + z) return false; bmaxY = 1D;
}
else{
bminX = block.v(); // minX
bminY = block.x(); // minY
bminZ = block.z(); // minZ
if (( flags & F_HEIGHT150) != 0) bmaxY = 1.5;
else if ((flags & F_HEIGHT100) != 0) bmaxY = 1.0;
else bmaxY = block.y(); // maxY
}
if (minX > bmaxX + x || maxX < bminX + x) return false;
else if (minY > bmaxY + y || maxY < bminY + y) return false;
else if (minZ > bmaxZ + z || maxZ < bminZ + z) return false;
else return true; else return true;
} }