Interface EntityVolume

    • Method Detail

      • players

        java.util.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

        java.util.Optional<Entity> entity​(java.util.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

        java.util.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 java.util.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> java.util.Collection<? extends T> entities​(java.lang.Class<? extends T> entityClass,
                                                                      AABB box,
                                                                      @Nullable java.util.function.Predicate<? super T> predicate)
      • entities

        java.util.Collection<? extends Entity> entities​(AABB box,
                                                        java.util.function.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> java.util.Collection<? extends T> entities​(java.lang.Class<? extends T> entityClass,
                                                                              AABB box)
      • nearestPlayer

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

        default java.util.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