code: private static Tile searchForTile(MapTile map, ImageBuffer tileSprite, int x, int y)
      {
          // Check each tile on each sheet
          for (final Integer sheet : map.getSheets())
          {
              final Tile tile = checkTile(map, tileSprite, sheet, x, y);
              if (tile != null)
              {
                  return tile;
              }
          }
  
          // No tile found
          return null;
      }
docs: Search current tile of image map by checking all surfaces.
  
  @param map The destination map reference.
  @param tileSprite The tiled sprite
  @param x The location x.
  @param y The location y.
  @return The tile found.