/** * Checks for blocks below and above the entity. * * @param origin The origin position of the entity * @return True if a vertical collision was detected */ private boolean verticalHitTest(Vector3d origin) { ArrayList<BlockPosition> blockPositions = gatherAdjacentBlockPositions(origin); for (int i = 0; i < blockPositions.size(); i++) { BlockPosition p = blockPositions.get(i); byte blockType1 = _parent.getWorldProvider().getBlockAtPosition(new Vector3d(p.x, p.y, p.z)); AABB entityAABB = getAABB(); if (BlockManager.getInstance().getBlock(blockType1).isPenetrable() || !entityAABB.overlaps(Block.AABBForBlockAt(p.x, p.y, p.z))) continue; double direction = origin.y - getPosition().y; if (direction >= 0) getPosition().y = p.y + 0.50001f + entityAABB.getDimensions().y; else getPosition().y = p.y - 0.50001f - entityAABB.getDimensions().y; return true; } return false; }