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 Summary
ConstructorsConstructorDescriptionEntitySearchResult(List<EntityInfo> entities, SearchParameters searchParameters) Creates an instance of aEntitySearchResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionentities()Returns the value of theentitiesrecord component.final booleanIndicates whether some other object is "equal to" this one.Get the closest entity from the search resultintgetCount()Get the total count of entities foundGet all entities from the search resultgetNPCs()Get all NPC entities from the search resultGet all player entities from the search resultGet the search parameters used for this searchgetWithinDistance(double maxDistance) Get entities within a certain distancefinal inthashCode()Returns a hash code value for this object.booleanisEmpty()Check if no entities were foundReturns the value of thesearchParametersrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
EntitySearchResult
Creates an instance of aEntitySearchResultrecord class.- Parameters:
entities- the value for theentitiesrecord componentsearchParameters- the value for thesearchParametersrecord component
-
-
Method Details
-
getEntities
Get all entities from the search result- Returns:
- list of entities
-
getClosest
Get the closest entity from the search result- Returns:
- closest entity or null if no entities found
-
getPlayers
Get all player entities from the search result- Returns:
- list of player entities
-
getNPCs
Get all NPC entities from the search result- Returns:
- list of NPC entities
-
getWithinDistance
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
Get the search parameters used for this search- Returns:
- search parameters
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object). -
entities
Returns the value of theentitiesrecord component.- Returns:
- the value of the
entitiesrecord component
-
searchParameters
Returns the value of thesearchParametersrecord component.- Returns:
- the value of the
searchParametersrecord component
-