Class Entity
- java.lang.Object
-
- org.dreambot.api.wrappers.interactive.interact.Interactable
-
- org.dreambot.api.wrappers.interactive.Entity
-
- All Implemented Interfaces:
Identifiable
,Locatable
,Verified
- Direct Known Subclasses:
Character
,GameObject
,GroundItem
public abstract class Entity extends Interactable implements Verified, Identifiable, Locatable
The wrapper for all interactable game objects. Ex. Players, NPCs, GameObjects.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canReach()
Checks if this location is reachable by the local player without obstaclesdouble
distance()
double
distance(Tile tile)
Distance (as the crow flies) away from the given tile.double
distance(Entity entity)
Distance away from the given entity.boolean
equals(java.lang.Object obj)
boolean
exists()
Determines where or not this object exists in game.abstract java.lang.String[]
getActions()
java.awt.Rectangle
getBoundingBox()
Gets the bounding box for the entity's modeljava.awt.Point
getCenterPoint()
Gets center point of the object, which is used as a base location.java.awt.Point
getClickablePoint()
Gets a clickable point within the object, used for interaction.java.lang.String
getLeftClickAction()
Model
getModel()
Gets the model of the entityabstract java.lang.String
getName()
Gets the name of the entityjava.lang.Object
getReference()
Gets the object used as the reference.abstract int
getRenderableHeight()
Area
getSurroundingArea(int radius)
Tile
getTile()
Gets tile of the object.TileReference
getTileReference()
Gets tile reference of the given object.abstract boolean
hasAction(java.lang.String... actions)
Checks whether given actions are in the list of menu actions for an entityint
hashCode()
boolean
interact()
Interacts with the given object using a default left click.boolean
interact(java.lang.String action)
Interacts with the given object using an action.boolean
interact(java.lang.String action, boolean rightClick, boolean forceRightClick)
boolean
interact(java.lang.String action, boolean rightClick, boolean forceRightClick, Condition interrupt)
boolean
interact(Filter<java.lang.String> filter)
Interacts with the given object using the first matching action.boolean
interactForceLeft(java.lang.String action)
Interacts with current object by forcing a left click.boolean
interactForceRight(java.lang.String action)
Interacts with current object by forcing a right click and interacting with menu (Interact using Menus)boolean
isOnScreen()
Checks whether the entity is visible on the game screendouble
walkingDistance(Tile tile)
Walking distance based on pathfinding to the given tile.-
Methods inherited from class org.dreambot.api.wrappers.interactive.interact.Interactable
hover, rightClick
-
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dreambot.api.wrappers.interactive.Identifiable
getID
-
-
-
-
Method Detail
-
isOnScreen
public boolean isOnScreen()
Checks whether the entity is visible on the game screen- Returns:
- true if the entity is visible
-
getBoundingBox
public java.awt.Rectangle getBoundingBox()
Gets the bounding box for the entity's model- Returns:
- bounding box of model
-
getReference
public java.lang.Object getReference()
Gets the object used as the reference.- Returns:
- The object reference passed from the client.
-
getTileReference
public TileReference getTileReference()
Description copied from interface:Locatable
Gets tile reference of the given object.- Specified by:
getTileReference
in interfaceLocatable
- Returns:
- the object tile reference.
-
getModel
public Model getModel()
Gets the model of the entity- Returns:
- model of entity
-
getRenderableHeight
public abstract int getRenderableHeight()
-
getName
public abstract java.lang.String getName()
Gets the name of the entity- Specified by:
getName
in interfaceIdentifiable
- Returns:
- name of entity
-
hasAction
public abstract boolean hasAction(java.lang.String... actions)
Checks whether given actions are in the list of menu actions for an entity- Parameters:
actions
- actions to check- Returns:
- true if all actions are in the list of menu actions
-
distance
public double distance(Tile tile)
Description copied from interface:Locatable
Distance (as the crow flies) away from the given tile.
-
distance
public double distance()
-
distance
public double distance(Entity entity)
Distance away from the given entity.- Parameters:
entity
- the destination target.- Returns:
- return the distance from the given entities tile as a double.
-
walkingDistance
public double walkingDistance(Tile tile)
Description copied from interface:Locatable
Walking distance based on pathfinding to the given tile.This is a more expensive call than
Locatable.distance(Tile)
, and should be used sparingly.- Specified by:
walkingDistance
in interfaceLocatable
- Parameters:
tile
- the destination tile.- Returns:
- return the path distance movement cost from the given tile as a double. If there isn't a path to the tile, it will return 3 times the as the crow flies distance.
-
getClickablePoint
public java.awt.Point getClickablePoint()
Description copied from class:Interactable
Gets a clickable point within the object, used for interaction.- Specified by:
getClickablePoint
in classInteractable
- Returns:
- a clickable point within the object.
-
getCenterPoint
public java.awt.Point getCenterPoint()
Description copied from class:Interactable
Gets center point of the object, which is used as a base location.- Specified by:
getCenterPoint
in classInteractable
- Returns:
- the center point of the given object.
-
interact
public boolean interact(Filter<java.lang.String> filter)
Description copied from class:Interactable
Interacts with the given object using the first matching action.- Overrides:
interact
in classInteractable
- Parameters:
filter
- the action filter- Returns:
- results of interaction, true if interaction with the object was successful, otherwise false.
-
interact
public boolean interact()
Description copied from class:Interactable
Interacts with the given object using a default left click.- Overrides:
interact
in classInteractable
- Returns:
- results of interaction, true if the object was successfully clicked.
-
getLeftClickAction
public java.lang.String getLeftClickAction()
-
interact
public boolean interact(java.lang.String action)
Description copied from class:Interactable
Interacts with the given object using an action. Will choose best click type using menu index.Example:
NPC man = NPCs.closest("Man"); if (man != null && man.interact("Attack")) { log("We attacked a man successfully!"); }
- Overrides:
interact
in classInteractable
- Parameters:
action
- the action- Returns:
- results of interaction, true if interaction with the object was successful, otherwise false.
-
interactForceRight
public boolean interactForceRight(java.lang.String action)
Description copied from class:Interactable
Interacts with current object by forcing a right click and interacting with menu (Interact using Menus)- Overrides:
interactForceRight
in classInteractable
- Parameters:
action
- the action which to use for interacting.- Returns:
- the result of the interaction, true if successful, otherwise false.
-
interactForceLeft
public boolean interactForceLeft(java.lang.String action)
Description copied from class:Interactable
Interacts with current object by forcing a left click. (Interact without using Menus)- Overrides:
interactForceLeft
in classInteractable
- Parameters:
action
- the action which to check for before clicking.- Returns:
- the result of the interaction, true if successful, otherwise false.
-
interact
public boolean interact(java.lang.String action, boolean rightClick, boolean forceRightClick)
- Overrides:
interact
in classInteractable
-
interact
public boolean interact(java.lang.String action, boolean rightClick, boolean forceRightClick, Condition interrupt)
- Overrides:
interact
in classInteractable
-
exists
public boolean exists()
Description copied from interface:Verified
Determines where or not this object exists in game.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
getSurroundingArea
public Area getSurroundingArea(int radius)
-
canReach
public boolean canReach()
Description copied from interface:Locatable
Checks if this location is reachable by the local player without obstacles
-
getActions
public abstract java.lang.String[] getActions()
-
-