To retrieve a list of nearby entities of an entity, one can use
List<Entity> nearby = entity.getNearbyEntities(double x, double y, double z);
Bukkit will then calculate a bounding box centered around entity, having as parameters:
The list may be empty, meaning that there are no nearby entities with the parameters.
This approach can be used to detect entities near custom projectiles, for example launching an Itemstack and detecting when it collides with a player