code: private Double getCollisionX(CollisionRange range, CollisionFunction function, double x, double y, int offsetX)
      {
          final double yOnTile = getInputValue(Axis.Y, x, y);
          if (UtilMath.isBetween(yOnTile, range.getMinY(), range.getMaxY()))
          {
              final double xOnTile = getInputValue(Axis.X, x, y);
              final double result = Math.floor(function.compute(yOnTile));
  
              if (UtilMath.isBetween(xOnTile, result + range.getMinX() - 1, result + range.getMaxX()))
              {
                  final double coll = Math.floor(tile.getX() + result - offsetX);
                  return Double.valueOf(coll);
              }
          }
          return null;
      }
docs: Get the horizontal collision location between the tile and the current location.
  
  @param range The collision range.
  @param function The collision function.
  @param x The current horizontal location.
  @param y The current vertical location.
  @param offsetX The horizontal offset.
  @return The horizontal collision (<code>null</code> if none).