Class Entities


  • public class Entities
    extends java.lang.Object
    Utility class for manipulating and retrieving entities.
    • Constructor Summary

      Constructors 
      Constructor Description
      Entities()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.google.common.collect.ImmutableList<Entity> all​(int radius, java.util.function.Predicate<Entity> predicate)
      Returns an immutable list of all entities that satisfy the specified predicate within the specified radius.
      static com.google.common.collect.ImmutableList<Entity> all​(int radius, java.util.function.Predicate<Entity> predicate, EntityType... types)
      Returns an immutable list of all entities of the specified types that satisfy the given predicate within the specified radius.
      static com.google.common.collect.ImmutableList<Entity> all​(java.util.function.Predicate<Entity> predicate)
      Returns an immutable list of all entities that satisfy the specified predicate.
      static com.google.common.collect.ImmutableList<Entity> all​(java.util.function.Predicate<Entity> predicate, EntityType... types)
      Returns an immutable list of all entities of the specified types that satisfy the given predicate.
      static Entity closest​(java.util.function.Predicate<Entity> predicate)
      Returns the closest Entity within the render distance that satisfies the given predicate, or null if no such Entity is found.
      static Entity closest​(java.util.function.Predicate<Entity> predicate, EntityType... types)
      Returns the closest entity within the render distance that satisfies the given predicate and belongs to the specified types.
      static Entity closestAll​(int radius, java.util.function.Predicate<Entity> predicate)
      Returns the closest Entity that satisfies the given predicate within the specified radius, or null if no such Entity is found.
      static Entity closestAll​(int radius, java.util.function.Predicate<Entity> predicate, EntityType... types)
      Returns the closest entity that satisfies the given predicate and belongs to the specified types within the specified radius.
      static Entity closestAll​(java.util.function.Predicate<Entity> predicate)
      Returns the closest Entity that satisfies the given predicate, or null if no such Entity is found.
      static Entity closestAll​(java.util.function.Predicate<Entity> predicate, EntityType... types)
      Returns the closest entity that satisfies the given predicate and belongs to the specified types.
      static java.util.stream.Stream<Entity> stream​(int radius, java.util.function.Predicate<Entity> predicate)
      Returns a stream of all entities that satisfy the specified predicate within the specified radius.
      static java.util.stream.Stream<Entity> stream​(int radius, java.util.function.Predicate<Entity> predicate, EntityType... types)
      Returns a stream of all entities of the specified types that satisfy the given predicate within the specified radius.
      static java.util.stream.Stream<Entity> stream​(java.util.function.Predicate<Entity> predicate)
      Returns a stream of all entities that satisfy the specified predicate.
      static java.util.stream.Stream<Entity> stream​(java.util.function.Predicate<Entity> predicate, EntityType... types)
      Returns a stream of all entities of the specified types that satisfy the given predicate.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Entities

        public Entities()
    • Method Detail

      • all

        public static com.google.common.collect.ImmutableList<Entity> all​(java.util.function.Predicate<Entity> predicate)
        Returns an immutable list of all entities that satisfy the specified predicate.
        Parameters:
        predicate - the condition to filter the entities
        Returns:
        an immutable list of entities that satisfy the predicate
      • all

        public static com.google.common.collect.ImmutableList<Entity> all​(java.util.function.Predicate<Entity> predicate,
                                                                          EntityType... types)
        Returns an immutable list of all entities of the specified types that satisfy the given predicate.
        Parameters:
        predicate - the predicate used to filter the entities
        types - the types of entities to include in the search (NPC, PLAYER, GAME_OBJECT, GROUND_ITEM)
        Returns:
        an immutable list of entities that satisfy the given predicate
      • all

        public static com.google.common.collect.ImmutableList<Entity> all​(int radius,
                                                                          java.util.function.Predicate<Entity> predicate)
        Returns an immutable list of all entities that satisfy the specified predicate within the specified radius.
        Parameters:
        radius - the radius to search for entities
        predicate - the condition to filter the entities
        Returns:
        an immutable list of entities that satisfy the predicate
      • all

        public static com.google.common.collect.ImmutableList<Entity> all​(int radius,
                                                                          java.util.function.Predicate<Entity> predicate,
                                                                          EntityType... types)
        Returns an immutable list of all entities of the specified types that satisfy the given predicate within the specified radius.
        Parameters:
        predicate - the predicate used to filter the entities
        types - the types of entities to include in the search (NPC, PLAYER, GAME_OBJECT, GROUND_ITEM)
        Returns:
        an immutable list of entities that satisfy the given predicate
      • stream

        public static java.util.stream.Stream<Entity> stream​(java.util.function.Predicate<Entity> predicate)
        Returns a stream of all entities that satisfy the specified predicate.
        Parameters:
        predicate - the condition to filter the entities
        Returns:
        a stream of entities that satisfy the predicate
      • stream

        public static java.util.stream.Stream<Entity> stream​(int radius,
                                                             java.util.function.Predicate<Entity> predicate)
        Returns a stream of all entities that satisfy the specified predicate within the specified radius.
        Parameters:
        radius - the radius to search for entities
        predicate - the condition to filter the entities
        Returns:
        a stream of entities that satisfy the predicate
      • stream

        public static java.util.stream.Stream<Entity> stream​(java.util.function.Predicate<Entity> predicate,
                                                             EntityType... types)
        Returns a stream of all entities of the specified types that satisfy the given predicate.
        Parameters:
        predicate - the predicate used to filter the entities
        types - the types of entities to include in the search (NPC, PLAYER, GAME_OBJECT, GROUND_ITEM)
        Returns:
        a stream of entities that satisfy the given predicate
      • stream

        public static java.util.stream.Stream<Entity> stream​(int radius,
                                                             java.util.function.Predicate<Entity> predicate,
                                                             EntityType... types)
        Returns a stream of all entities of the specified types that satisfy the given predicate within the specified radius.
        Parameters:
        radius - the radius to search for entities
        predicate - the predicate used to filter the entities
        types - the types of entities to include in the search (NPC, PLAYER, GAME_OBJECT, GROUND_ITEM)
        Returns:
        a stream of entities that satisfy the given predicate
      • closestAll

        public static Entity closestAll​(java.util.function.Predicate<Entity> predicate)
        Returns the closest Entity that satisfies the given predicate, or null if no such Entity is found.
        Parameters:
        predicate - the predicate used to filter the Entities
        Returns:
        the closest Entity that satisfies the predicate, or null if no such Entity is found
      • closestAll

        public static Entity closestAll​(int radius,
                                        java.util.function.Predicate<Entity> predicate)
        Returns the closest Entity that satisfies the given predicate within the specified radius, or null if no such Entity is found.
        Parameters:
        radius - the radius to search for entities
        predicate - the predicate used to filter the Entities
        Returns:
        the closest Entity that satisfies the predicate, or null if no such Entity is found
      • closestAll

        public static Entity closestAll​(java.util.function.Predicate<Entity> predicate,
                                        EntityType... types)
        Returns the closest entity that satisfies the given predicate and belongs to the specified types.
        Parameters:
        predicate - the condition to be fulfilled by the entity
        types - the types of entities to consider
        Returns:
        the closest entity or null if no entity satisfies the condition
      • closestAll

        public static Entity closestAll​(int radius,
                                        java.util.function.Predicate<Entity> predicate,
                                        EntityType... types)
        Returns the closest entity that satisfies the given predicate and belongs to the specified types within the specified radius.
        Parameters:
        radius - the radius to search for entities
        predicate - the condition to be fulfilled by the entity
        types - the types of entities to consider
        Returns:
        the closest entity or null if no entity satisfies the condition
      • closest

        public static Entity closest​(java.util.function.Predicate<Entity> predicate)
        Returns the closest Entity within the render distance that satisfies the given predicate, or null if no such Entity is found.
        Parameters:
        predicate - the predicate used to filter the Entities
        Returns:
        the closest Entity that satisfies the predicate, or null if no such Entity is found
      • closest

        public static Entity closest​(java.util.function.Predicate<Entity> predicate,
                                     EntityType... types)
        Returns the closest entity within the render distance that satisfies the given predicate and belongs to the specified types.
        Parameters:
        predicate - the condition to be fulfilled by the entity
        types - the types of entities to consider
        Returns:
        the closest entity or null if no entity satisfies the condition