Package net.eternalclient.api.accessors
Class GameObjects
- java.lang.Object
-
- net.eternalclient.api.accessors.GameObjects
-
public class GameObjects extends java.lang.Object
Contains methods for retrieving and interacting with game objects.
-
-
Constructor Summary
Constructors Constructor Description GameObjects()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<GameObject>
all()
Returns a list of all GameObjects in the cache belonging to the same plane as the current Map's plane.static java.util.List<GameObject>
all(boolean skipPlaneCheck)
Retrieves a list of all GameObjects.static java.util.List<GameObject>
all(boolean skipPlaneCheck, int radius)
Retrieves a list of GameObjects within a given radius.static java.util.List<GameObject>
all(int radius)
Retrieves a list of all GameObjects within a specified radius.static java.util.List<GameObject>
all(java.util.function.Predicate<GameObject> predicate)
Returns a list of all GameObjects that satisfy the given predicate and are on the same plane as the current Map.static java.util.List<GameObject>
all(java.util.function.Predicate<GameObject> predicate, boolean skipPlaneCheck)
Returns a list of GameObjects that satisfy the given predicate, and optionally skips the plane check.static java.util.List<GameObject>
all(java.util.function.Predicate<GameObject> predicate, boolean skipPlaneCheck, int radius)
Retrieves a list of GameObjects based on the provided predicate, skipPlaneCheck flag, and radius.static java.util.List<GameObject>
all(java.util.function.Predicate<GameObject> predicate, int radius)
Retrieves a list of all game objects within a certain radius that meet the given predicate.static void
clear()
Clears the cache.static GameObject
closest(int id)
Returns the closest GameObject with the specified id.static GameObject
closest(int id, Positionable positionable)
Returns the closest GameObject with the specified ID to the given Positionable.static GameObject
closest(java.lang.String name)
Returns the closest GameObject with the specified name.static GameObject
closest(java.lang.String name, Positionable positionable)
Returns the closest GameObject with the specified name to the given Positionable object.static GameObject
closest(java.util.function.Predicate<GameObject> predicate)
Returns the closest GameObject that satisfies the given predicate within the default distance.static GameObject
closest(java.util.function.Predicate<GameObject> predicate, Positionable positionable)
Returns the closest GameObject that satisfies the given predicate based on the specified Positionable's default distance.static GameObject
closestAll(int id)
Finds the closest GameObject with the specified ID.static GameObject
closestAll(int id, Positionable positionable)
Finds the closest GameObject with the specified id to the given Positionable object.static GameObject
closestAll(int id, Positionable positionable, int radius)
Returns the closest instance of GameObject with the specified id, within the given radius of the specified Positionable object.static GameObject
closestAll(java.lang.String name)
Returns the closest GameObjects with the specified name.static GameObject
closestAll(java.lang.String name, Positionable positionable)
Returns the closest GameObject with the specified name to the given Positionable object.static GameObject
closestAll(java.lang.String name, Positionable positionable, int radius)
Returns the closest GameObject with the specified name within the given radius of the specified Positionable object.static GameObject
closestAll(java.util.function.Predicate<GameObject> predicate)
Returns the closest GameObject that satisfies the given predicate.static GameObject
closestAll(java.util.function.Predicate<GameObject> predicate, int radius)
Returns the closest GameObject that satisfies the given predicate within the specified radius.static GameObject
closestAll(java.util.function.Predicate<GameObject> predicate, Positionable positionable)
Returns the closest GameObject that satisfies the given predicate to the specified Positionable, or null if the Positionable is not in the grid or no GameObjects satisfy the predicate.static GameObject
closestAll(java.util.function.Predicate<GameObject> predicate, Positionable positionable, int radius)
Returns the closest GameObject that satisfies the given predicate within the specified radius of the Positionable.static java.util.List<GameObject>
getObjectsOnTile(Positionable tile)
Retrieves a list of GameObjects on the given Tile.static java.util.List<GameObject>
getObjectsOnTile(Positionable tile, java.util.function.Predicate<GameObject> predicate)
Retrieves a list of game objects on a given tile that meet a specified condition.static GameObject
getTopObjectOnTile(Positionable tile)
Retrieves the topmost GameObject on the specified Tile.static java.util.stream.Stream<GameObject>
stream()
Returns a stream of all GameObjects in the cache.static java.util.stream.Stream<GameObject>
stream(boolean skipPlaneCheck)
Returns a stream of all GameObjects in the cache.static java.util.stream.Stream<GameObject>
stream(boolean skipPlaneCheck, int radius)
Returns a stream of GameObjects within a given radius.static java.util.stream.Stream<GameObject>
stream(int radius)
Returns a stream of all GameObjects within a specified radius.static java.util.stream.Stream<GameObject>
stream(java.util.function.Predicate<GameObject> predicate)
Returns a stream of all GameObjects that satisfy the given predicate.static java.util.stream.Stream<GameObject>
stream(java.util.function.Predicate<GameObject> predicate, boolean skipPlaneCheck)
Returns a stream of GameObjects that satisfy the given predicate, and optionally skips the plane check.static java.util.stream.Stream<GameObject>
stream(java.util.function.Predicate<GameObject> predicate, boolean skipPlaneCheck, int radius)
Returns a stream of GameObjects based on the provided predicate, skipPlaneCheck flag, and radius.static java.util.stream.Stream<GameObject>
stream(java.util.function.Predicate<GameObject> predicate, int radius)
Returns a stream of all game objects within a certain radius that meet the given predicate.
-
-
-
Method Detail
-
clear
public static void clear()
Clears the cache. If in debug mode, logs a message indicating all objects are being cleared.
-
all
public static java.util.List<GameObject> all()
Returns a list of all GameObjects in the cache belonging to the same plane as the current Map's plane.- Returns:
- a list of GameObjects
-
all
public static java.util.List<GameObject> all(boolean skipPlaneCheck)
Retrieves a list of all GameObjects.- Parameters:
skipPlaneCheck
- if true, skips the plane check, otherwise checks if the GameObject's plane is equal to the Map's plane- Returns:
- a list of all GameObjects
-
all
public static java.util.List<GameObject> all(java.util.function.Predicate<GameObject> predicate)
Returns a list of all GameObjects that satisfy the given predicate and are on the same plane as the current Map.- Parameters:
predicate
- the condition to be satisfied by the GameObjects- Returns:
- a list of GameObjects that meet the given conditions
-
all
public static java.util.List<GameObject> all(java.util.function.Predicate<GameObject> predicate, boolean skipPlaneCheck)
Returns a list of GameObjects that satisfy the given predicate, and optionally skips the plane check.- Parameters:
predicate
- the predicate used to filter GameObjectsskipPlaneCheck
- a flag to skip the plane check- Returns:
- a list of GameObjects that satisfy the predicate
-
all
public static java.util.List<GameObject> all(int radius)
Retrieves a list of all GameObjects within a specified radius.- Parameters:
radius
- the radius within which to search for GameObjects- Returns:
- a list of GameObjects found within the given radius
-
all
public static java.util.List<GameObject> all(boolean skipPlaneCheck, int radius)
Retrieves a list of GameObjects within a given radius.- Parameters:
skipPlaneCheck
- a boolean indicating whether to skip the plane checkradius
- the radius within which to search for GameObjects- Returns:
- a list of GameObjects found within the specified radius
-
all
public static java.util.List<GameObject> all(java.util.function.Predicate<GameObject> predicate, int radius)
Retrieves a list of all game objects within a certain radius that meet the given predicate.- Parameters:
predicate
- the predicate to test each game object againstradius
- the radius within which to search for game objects- Returns:
- a list of game objects that meet the given predicate
-
all
public static java.util.List<GameObject> all(java.util.function.Predicate<GameObject> predicate, boolean skipPlaneCheck, int radius)
Retrieves a list of GameObjects based on the provided predicate, skipPlaneCheck flag, and radius.- Parameters:
predicate
- a Predicate function to filter the GameObjectsskipPlaneCheck
- a boolean flag indicating whether to skip checking the object's planeradius
- the radius within which to search for GameObjects- Returns:
- a List of GameObjects that satisfy the given predicate
-
stream
public static java.util.stream.Stream<GameObject> stream()
Returns a stream of all GameObjects in the cache.- Returns:
- a stream of GameObjects, no null values
-
stream
public static java.util.stream.Stream<GameObject> stream(boolean skipPlaneCheck)
Returns a stream of all GameObjects in the cache.- Parameters:
skipPlaneCheck
- if true, skips the plane check, otherwise checks if the GameObject's plane is equal to the Map's plane- Returns:
- a stream of GameObjects, no null values
-
stream
public static java.util.stream.Stream<GameObject> stream(java.util.function.Predicate<GameObject> predicate)
Returns a stream of all GameObjects that satisfy the given predicate.- Parameters:
predicate
- the condition to be satisfied by the GameObjects- Returns:
- a stream of GameObjects that satisfy the predicate, no null values
-
stream
public static java.util.stream.Stream<GameObject> stream(java.util.function.Predicate<GameObject> predicate, boolean skipPlaneCheck)
Returns a stream of GameObjects that satisfy the given predicate, and optionally skips the plane check.- Parameters:
predicate
- the predicate used to filter GameObjectsskipPlaneCheck
- a flag to skip the plane check- Returns:
- a stream of GameObjects that satisfy the predicate, no null values
-
stream
public static java.util.stream.Stream<GameObject> stream(int radius)
Returns a stream of all GameObjects within a specified radius.- Parameters:
radius
- the radius within which to search for GameObjects- Returns:
- a stream of GameObjects found within the given radius, no null values
-
stream
public static java.util.stream.Stream<GameObject> stream(boolean skipPlaneCheck, int radius)
Returns a stream of GameObjects within a given radius.- Parameters:
skipPlaneCheck
- a boolean indicating whether to skip the plane checkradius
- the radius within which to search for GameObjects- Returns:
- a stream of GameObjects found within the specified radius, no null values
-
stream
public static java.util.stream.Stream<GameObject> stream(java.util.function.Predicate<GameObject> predicate, int radius)
Returns a stream of all game objects within a certain radius that meet the given predicate.- Parameters:
predicate
- the predicate to test each game object againstradius
- the radius within which to search for game objects- Returns:
- a stream of game objects that meet the given predicate, no null values
-
stream
public static java.util.stream.Stream<GameObject> stream(java.util.function.Predicate<GameObject> predicate, boolean skipPlaneCheck, int radius)
Returns a stream of GameObjects based on the provided predicate, skipPlaneCheck flag, and radius.- Parameters:
predicate
- a Predicate function to filter the GameObjectsskipPlaneCheck
- a boolean flag indicating whether to skip checking the object's planeradius
- the radius within which to search for GameObjects- Returns:
- a stream of GameObjects that satisfy the given predicate, no null values
-
closestAll
public static GameObject closestAll(java.util.function.Predicate<GameObject> predicate)
Returns the closest GameObject that satisfies the given predicate.- Parameters:
predicate
- the condition to be satisfied by the GameObjects- Returns:
- the closest GameObject that satisfies the predicate, or null if none found
-
closestAll
public static GameObject closestAll(java.util.function.Predicate<GameObject> predicate, Positionable positionable)
Returns the closest GameObject that satisfies the given predicate to the specified Positionable, or null if the Positionable is not in the grid or no GameObjects satisfy the predicate.- Parameters:
predicate
- the predicate used to filter the GameObjectspositionable
- the Positionable used to determine the distance- Returns:
- the closest GameObject satisfying the predicate, or null if none is found
-
closestAll
public static GameObject closestAll(java.util.function.Predicate<GameObject> predicate, int radius)
Returns the closest GameObject that satisfies the given predicate within the specified radius.- Parameters:
predicate
- the predicate used to filter GameObjectsradius
- the radius in which to search for GameObjects- Returns:
- the closest GameObject that satisfies the given predicate, or null if none found
-
closestAll
public static GameObject closestAll(java.util.function.Predicate<GameObject> predicate, Positionable positionable, int radius)
Returns the closest GameObject that satisfies the given predicate within the specified radius of the Positionable.- Parameters:
predicate
- the predicate to test each GameObject againstpositionable
- the Positionable object to search aroundradius
- the radius in which to search for GameObjects- Returns:
- the closest GameObject that satisfies the given predicate, or null if none are found
-
closestAll
public static GameObject closestAll(java.lang.String name)
Returns the closest GameObjects with the specified name.- Parameters:
name
- the name of the GameObjects to find- Returns:
- the closest GameObjects with the specified name
-
closestAll
public static GameObject closestAll(java.lang.String name, Positionable positionable)
Returns the closest GameObject with the specified name to the given Positionable object.- Parameters:
name
- the name of the GameObjectpositionable
- the Positionable object against which the distance is calculated- Returns:
- the closest GameObject with the specified name to the given Positionable object
-
closestAll
public static GameObject closestAll(java.lang.String name, Positionable positionable, int radius)
Returns the closest GameObject with the specified name within the given radius of the specified Positionable object.- Parameters:
name
- the name of the GameObject to search forpositionable
- the Positionable object to search aroundradius
- the search radius- Returns:
- the closest GameObject with the specified name within the given radius
-
closestAll
public static GameObject closestAll(int id)
Finds the closest GameObject with the specified ID.- Parameters:
id
- the ID of the GameObject to search for.- Returns:
- the closest GameObject with the specified ID, or null if none is found.
-
closestAll
public static GameObject closestAll(int id, Positionable positionable)
Finds the closest GameObject with the specified id to the given Positionable object.- Parameters:
id
- the id of the GameObject to findpositionable
- the Positionable object to find closest GameObject from- Returns:
- the closest GameObject with the specified id to the given Positionable object
-
closestAll
public static GameObject closestAll(int id, Positionable positionable, int radius)
Returns the closest instance of GameObject with the specified id, within the given radius of the specified Positionable object.- Parameters:
id
- the id of the GameObject to findpositionable
- the Positionable object to search aroundradius
- the radius to search within- Returns:
- the closest GameObject instance with the specified id, or null if not found
-
closest
public static GameObject closest(java.util.function.Predicate<GameObject> predicate)
Returns the closest GameObject that satisfies the given predicate within the default distance.- Parameters:
predicate
- the predicate to filter the GameObjects- Returns:
- the closest GameObject that satisfies the predicate
-
closest
public static GameObject closest(java.util.function.Predicate<GameObject> predicate, Positionable positionable)
Returns the closest GameObject that satisfies the given predicate based on the specified Positionable's default distance.- Parameters:
predicate
- the condition to be satisfied by the GameObjectpositionable
- the Positionable object to determine the distance from- Returns:
- the closest GameObject that satisfies the predicate
-
closest
public static GameObject closest(java.lang.String name)
Returns the closest GameObject with the specified name.- Parameters:
name
- the name of the GameObject to search for- Returns:
- the closest GameObject with the specified name
-
closest
public static GameObject closest(java.lang.String name, Positionable positionable)
Returns the closest GameObject with the specified name to the given Positionable object.- Parameters:
name
- the name of the GameObject to findpositionable
- the object to find the closest GameObject from- Returns:
- the closest GameObject with the specified name
-
closest
public static GameObject closest(int id)
Returns the closest GameObject with the specified id.- Parameters:
id
- the id of the GameObject to find- Returns:
- the closest GameObject with the specified id
-
closest
public static GameObject closest(int id, Positionable positionable)
Returns the closest GameObject with the specified ID to the given Positionable.- Parameters:
id
- the ID of the GameObject to findpositionable
- the Positionable object to find the closest GameObject to- Returns:
- the closest GameObject with the specified ID to the given Positionable
-
getTopObjectOnTile
public static GameObject getTopObjectOnTile(Positionable tile)
Retrieves the topmost GameObject on the specified Tile.- Parameters:
tile
- the Tile to retrieve the top object from- Returns:
- the top GameObject on the Tile, or null if none found
-
getObjectsOnTile
public static java.util.List<GameObject> getObjectsOnTile(Positionable tile)
Retrieves a list of GameObjects on the given Tile.- Parameters:
tile
- the Tile to get the GameObjects from- Returns:
- a list of GameObjects on the Tile, or an empty list if the Tile is not in the grid or no GameObjects are found
-
getObjectsOnTile
public static java.util.List<GameObject> getObjectsOnTile(Positionable tile, java.util.function.Predicate<GameObject> predicate)
Retrieves a list of game objects on a given tile that meet a specified condition.- Parameters:
tile
- the tile to check for game objectspredicate
- the condition that game objects must meet- Returns:
- a list of game objects on the tile that satisfy the condition
-
-