Interface EntityVolume

All Superinterfaces:
Volume
All Known Subinterfaces:
ClientWorld, EntityVolume.Immutable, EntityVolume.Modifiable<M>, EntityVolume.Mutable, EntityVolume.Streamable<E>, EntityVolume.Unmodifiable<U>, GenerationRegion, ServerWorld, World<W,L>, WorldChunk, WorldLike<P>

public interface EntityVolume extends Volume
  • Method Details

    • players

      Collection<? extends Player> players()
      Gets a List of available players within this volume. The provided list may be a copy or an unmodifiable collection.
      Returns:
      An unmodifiable or copied collection of available players
    • entity

      Optional<Entity> entity(UUID uuid)
      Gets the entity whose UUID matches the provided id, possibly returning no entity if the entity is not loaded or non-existent.

      For world implementations, only some parts of the world is usually loaded, so this method may return no entity if the entity is not loaded.

      Parameters:
      uuid - The unique id
      Returns:
      An entity, if available
    • entities

      Collection<? extends Entity> entities()
      Gets all the loaded entities in this entity volume, in no particular order.

      This collection is unmodifiable.

      Returns:
      All entities in this volume.
    • entities

      default Collection<? extends Entity> entities(AABB box)
      Gets all the entities that intersect the bounding box, in no particular order.
      Parameters:
      box - The intersection box
      Returns:
      All the intersecting entities
    • entities

      <T extends Entity> Collection<? extends T> entities(Class<? extends T> entityClass, AABB box, @Nullable Predicate<? super T> predicate)
    • entities

      Collection<? extends Entity> entities(AABB box, Predicate<? super Entity> filter)
      Gets all the entities that intersect the bounding box, in no particular order, as long as the pass the given filter test.
      Parameters:
      box - The intersection box
      filter - The filter test
      Returns:
      All the intersecting entities that pass the filter test
    • entities

      default <T extends Entity> Collection<? extends T> entities(Class<? extends T> entityClass, AABB box)
    • nearestPlayer

      default Optional<? extends Player> nearestPlayer(double x, double y, double z, double distance, @Nullable Predicate<? super Entity> predicate)
    • nearbyEntities

      default Collection<? extends Entity> nearbyEntities(Vector3d location, double distance)
      Return a collection of entities contained within distance blocks of the specified location. This uses a sphere to test distances.

      For world implementations, only some parts of the world is usually loaded, so this method will only return entities within those loaded parts.

      Parameters:
      location - The location at the center of the search radius
      distance - The search radius
      Returns:
      A collection of nearby entities