Record Class EntitySearchResult

java.lang.Object
java.lang.Record
io.hymods.lib.data.EntitySearchResult

public record EntitySearchResult(List<EntityInfo> entities, SearchParameters searchParameters) extends Record
Result of an entity search operation
  • Constructor Details

    • EntitySearchResult

      public EntitySearchResult(List<EntityInfo> entities, SearchParameters searchParameters)
      Creates an instance of a EntitySearchResult record class.
      Parameters:
      entities - the value for the entities record component
      searchParameters - the value for the searchParameters record component
  • Method Details

    • getEntities

      public List<EntityInfo> getEntities()
      Get all entities from the search result
      Returns:
      list of entities
    • getClosest

      public EntityInfo getClosest()
      Get the closest entity from the search result
      Returns:
      closest entity or null if no entities found
    • getPlayers

      public List<EntityInfo> getPlayers()
      Get all player entities from the search result
      Returns:
      list of player entities
    • getNPCs

      public List<EntityInfo> getNPCs()
      Get all NPC entities from the search result
      Returns:
      list of NPC entities
    • getWithinDistance

      public List<EntityInfo> getWithinDistance(double maxDistance)
      Get entities within a certain distance
      Parameters:
      maxDistance - maximum distance
      Returns:
      list of entities within the specified distance
    • getCount

      public int getCount()
      Get the total count of entities found
      Returns:
      count of entities
    • isEmpty

      public boolean isEmpty()
      Check if no entities were found
      Returns:
      true if no entities found, false otherwise
    • getSearchParameters

      public SearchParameters getSearchParameters()
      Get the search parameters used for this search
      Returns:
      search parameters
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • entities

      public List<EntityInfo> entities()
      Returns the value of the entities record component.
      Returns:
      the value of the entities record component
    • searchParameters

      public SearchParameters searchParameters()
      Returns the value of the searchParameters record component.
      Returns:
      the value of the searchParameters record component