Class PredefinedEntity
- java.lang.Object
-
- com.runemate.game.api.hybrid.entities.PredefinedEntity
-
- All Implemented Interfaces:
Interactable
,Locatable
,Modeled
,Renderable
,LocatableEntity
,Validatable
public class PredefinedEntity extends java.lang.Object implements LocatableEntity
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PredefinedEntity.Type
-
Constructor Summary
Constructors Constructor Description PredefinedEntity(PredefinedEntity.Type type, @NonNull Area location)
PredefinedEntity(PredefinedEntity.Type type, @NonNull Area location, int id)
PredefinedEntity(PredefinedEntity.Type type, @NonNull Area location, java.lang.String name)
PredefinedEntity(PredefinedEntity.Type type, @NonNull Area location, java.util.function.Function<QB,QR> query)
PredefinedEntity(PredefinedEntity.Type type, @NonNull Coordinate location)
PredefinedEntity(PredefinedEntity.Type type, @NonNull Coordinate position, int id)
PredefinedEntity(PredefinedEntity.Type type, @NonNull Coordinate position, java.lang.String name)
PredefinedEntity(PredefinedEntity.Type type, @NonNull Coordinate position, java.util.function.Function<QB,QR> query)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
click()
Clicks this entity in an interactable pointboolean
contains(java.awt.Point point)
Checks if the projected bounds of this entity contains the Point provided.static PredefinedEntity
gameobject(@NonNull Area area, int id)
static PredefinedEntity
gameobject(@NonNull Area area, java.lang.String name)
static PredefinedEntity
gameobject(@NonNull Area area, java.util.function.Function<GameObjectQueryBuilder,LocatableEntityQueryResults<GameObject>> query)
static PredefinedEntity
gameobject(@NonNull Coordinate position, int id)
static PredefinedEntity
gameobject(@NonNull Coordinate position, java.lang.String name)
static PredefinedEntity
gameobject(@NonNull Coordinate position, java.util.function.Function<GameObjectQueryBuilder,LocatableEntityQueryResults<GameObject>> query)
Area.Rectangular
getArea()
The coordinate area occupied on the world-graphArea.Rectangular
getArea(Coordinate regionBase)
Gets the area using the region base as the coordinate to offset from.Coordinate.HighPrecision
getHighPrecisionPosition()
The exact coordinate position of this entity on the region-graph (accurate to hundreds of units per tile)Coordinate.HighPrecision
getHighPrecisionPosition(Coordinate regionBase)
Gets the high precision position using the region base as the coordinate to offset from.int
getId()
InteractablePoint
getInteractionPoint(java.awt.Point origin)
Gets a point within the entity that can be interacted with.Model
getModel()
Gets the polygon-based model of the entityjava.lang.String
getName()
Gets the provided name for this entity.@NonNull Coordinate
getPosition()
The exact coordinate position of this entity on the world-graph@NonNull Coordinate
getPosition(Coordinate regionBase)
Gets the position using the region base as the coordinate to offset from.@NonNull PredefinedEntity.Type
getType()
Gets the type of this predefined entity.double
getVisibility()
Returns a rough estimate of how visible this entity is as a percent (0 to 100)static PredefinedEntity
grounditem(@NonNull Area location, int id)
static PredefinedEntity
grounditem(@NonNull Area location, java.lang.String name)
static PredefinedEntity
grounditem(@NonNull Area location, java.util.function.Function<GroundItemQueryBuilder,LocatableEntityQueryResults<GroundItem>> query)
static PredefinedEntity
grounditem(@NonNull Coordinate position, int id)
static PredefinedEntity
grounditem(@NonNull Coordinate position, java.lang.String name)
static PredefinedEntity
grounditem(@NonNull Coordinate position, java.util.function.Function<GroundItemQueryBuilder,LocatableEntityQueryResults<GroundItem>> query)
boolean
hasDynamicBounds()
boolean
hover()
Moves the mouse over this entityboolean
interact(java.util.regex.Pattern action, java.util.regex.Pattern target)
Attempts to match action and target using Matcher.find() and then interacts with the appropriate menu itemboolean
isValid()
Verifies whether this entity is valid and still exists, typically on the world-graphboolean
isVisible()
Whether the entity is visiblestatic PredefinedEntity
npc(@NonNull Area location, int id)
static PredefinedEntity
npc(@NonNull Area location, java.lang.String name)
static PredefinedEntity
npc(@NonNull Area location, java.util.function.Function<NpcQueryBuilder,LocatableEntityQueryResults<Npc>> query)
static PredefinedEntity
npc(@NonNull Coordinate position, int id)
static PredefinedEntity
npc(@NonNull Coordinate position, java.lang.String name)
static PredefinedEntity
npc(@NonNull Coordinate position, java.util.function.Function<NpcQueryBuilder,LocatableEntityQueryResults<Npc>> query)
void
render(java.awt.Graphics2D g2d)
Renders this entity onto the givenGraphics2D
, use is discouragedvoid
render(javafx.scene.canvas.GraphicsContext gc)
Renders this entity onto the givenGraphicsContext
LocatableEntity
resolve()
void
setBackupModel(int[] frontBottomLeft, int[] backTopRight)
Sets a backup model to be used when the model isn't available.void
setBackupModel(Model backup)
void
setBackupModel(com.runemate.game.api.hybrid.util.collections.Pair<int[],int[]> values)
Sets a pair of points to be used to create a backup model when the in-game model isn't availablevoid
setForcedModel(int[] frontBottomLeft, int[] backTopRight)
Sets a model to be used regardless of whether the in-game model is available.void
setForcedModel(Model forced)
void
setForcedModel(com.runemate.game.api.hybrid.util.collections.Pair<int[],int[]> values)
Sets a pair of points to be used to create a model regardless of whether the in-game model is availablejava.lang.String
toString()
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.runemate.game.api.hybrid.entities.details.Interactable
getInteractionPoint, interact, interact, interact, interact, interact, isHovered
-
Methods inherited from interface com.runemate.game.api.hybrid.entities.details.Locatable
distanceTo, distanceTo, getLocalPosition
-
-
-
-
Constructor Detail
-
PredefinedEntity
public PredefinedEntity(PredefinedEntity.Type type, @NonNull @NonNull Coordinate location)
-
PredefinedEntity
public PredefinedEntity(PredefinedEntity.Type type, @NonNull @NonNull Area location)
-
PredefinedEntity
public PredefinedEntity(PredefinedEntity.Type type, @NonNull @NonNull Coordinate position, int id)
-
PredefinedEntity
public PredefinedEntity(PredefinedEntity.Type type, @NonNull @NonNull Area location, int id)
-
PredefinedEntity
public PredefinedEntity(PredefinedEntity.Type type, @NonNull @NonNull Coordinate position, java.lang.String name)
-
PredefinedEntity
public PredefinedEntity(PredefinedEntity.Type type, @NonNull @NonNull Area location, java.lang.String name)
-
PredefinedEntity
public PredefinedEntity(PredefinedEntity.Type type, @NonNull @NonNull Coordinate position, java.util.function.Function<QB,QR> query)
-
PredefinedEntity
public PredefinedEntity(PredefinedEntity.Type type, @NonNull @NonNull Area location, java.util.function.Function<QB,QR> query)
-
-
Method Detail
-
gameobject
public static PredefinedEntity gameobject(@NonNull @NonNull Coordinate position, int id)
-
gameobject
public static PredefinedEntity gameobject(@NonNull @NonNull Area area, int id)
-
gameobject
public static PredefinedEntity gameobject(@NonNull @NonNull Coordinate position, java.lang.String name)
-
gameobject
public static PredefinedEntity gameobject(@NonNull @NonNull Area area, java.lang.String name)
-
gameobject
public static PredefinedEntity gameobject(@NonNull @NonNull Coordinate position, java.util.function.Function<GameObjectQueryBuilder,LocatableEntityQueryResults<GameObject>> query)
-
gameobject
public static PredefinedEntity gameobject(@NonNull @NonNull Area area, java.util.function.Function<GameObjectQueryBuilder,LocatableEntityQueryResults<GameObject>> query)
-
npc
public static PredefinedEntity npc(@NonNull @NonNull Coordinate position, int id)
-
npc
public static PredefinedEntity npc(@NonNull @NonNull Area location, int id)
-
npc
public static PredefinedEntity npc(@NonNull @NonNull Coordinate position, java.lang.String name)
-
npc
public static PredefinedEntity npc(@NonNull @NonNull Area location, java.lang.String name)
-
npc
public static PredefinedEntity npc(@NonNull @NonNull Coordinate position, java.util.function.Function<NpcQueryBuilder,LocatableEntityQueryResults<Npc>> query)
-
npc
public static PredefinedEntity npc(@NonNull @NonNull Area location, java.util.function.Function<NpcQueryBuilder,LocatableEntityQueryResults<Npc>> query)
-
grounditem
public static PredefinedEntity grounditem(@NonNull @NonNull Coordinate position, int id)
-
grounditem
public static PredefinedEntity grounditem(@NonNull @NonNull Area location, int id)
-
grounditem
public static PredefinedEntity grounditem(@NonNull @NonNull Coordinate position, java.lang.String name)
-
grounditem
public static PredefinedEntity grounditem(@NonNull @NonNull Area location, java.lang.String name)
-
grounditem
public static PredefinedEntity grounditem(@NonNull @NonNull Coordinate position, java.util.function.Function<GroundItemQueryBuilder,LocatableEntityQueryResults<GroundItem>> query)
-
grounditem
public static PredefinedEntity grounditem(@NonNull @NonNull Area location, java.util.function.Function<GroundItemQueryBuilder,LocatableEntityQueryResults<GroundItem>> query)
-
getType
@NonNull public @NonNull PredefinedEntity.Type getType()
Gets the type of this predefined entity.- Returns:
- the PredefinedEntity.Type of this entity.
-
getName
@Nullable public java.lang.String getName()
Gets the provided name for this entity.- Returns:
- The name if it was provided, otherwise null.
-
getId
public int getId()
-
getVisibility
public double getVisibility()
Description copied from interface:Interactable
Returns a rough estimate of how visible this entity is as a percent (0 to 100)- Specified by:
getVisibility
in interfaceInteractable
-
hasDynamicBounds
public boolean hasDynamicBounds()
- Specified by:
hasDynamicBounds
in interfaceInteractable
-
getPosition
@NonNull public @NonNull Coordinate getPosition()
Description copied from interface:Locatable
The exact coordinate position of this entity on the world-graph- Specified by:
getPosition
in interfaceLocatable
- Specified by:
getPosition
in interfaceLocatableEntity
- Returns:
- The coordinate position, or null if unavailable
-
getPosition
@NonNull public @NonNull Coordinate getPosition(Coordinate regionBase)
Description copied from interface:LocatableEntity
Gets the position using the region base as the coordinate to offset from. For optimization.- Specified by:
getPosition
in interfaceLocatableEntity
- Parameters:
regionBase
- The Coordinate base of the loaded region
-
getHighPrecisionPosition
@NonNull public Coordinate.HighPrecision getHighPrecisionPosition()
Description copied from interface:Locatable
The exact coordinate position of this entity on the region-graph (accurate to hundreds of units per tile)- Specified by:
getHighPrecisionPosition
in interfaceLocatable
- Specified by:
getHighPrecisionPosition
in interfaceLocatableEntity
-
getHighPrecisionPosition
@NonNull public Coordinate.HighPrecision getHighPrecisionPosition(Coordinate regionBase)
Description copied from interface:LocatableEntity
Gets the high precision position using the region base as the coordinate to offset from. For optimization.- Specified by:
getHighPrecisionPosition
in interfaceLocatableEntity
- Parameters:
regionBase
- The Coordinate base of the loaded region
-
getArea
@NonNull public Area.Rectangular getArea()
Description copied from interface:Locatable
The coordinate area occupied on the world-graph- Specified by:
getArea
in interfaceLocatable
- Specified by:
getArea
in interfaceLocatableEntity
- Returns:
- The coordinate area, or null if unavailable
-
getArea
@NonNull public Area.Rectangular getArea(Coordinate regionBase)
Description copied from interface:LocatableEntity
Gets the area using the region base as the coordinate to offset from. For optimization.- Specified by:
getArea
in interfaceLocatableEntity
- Parameters:
regionBase
- The Coordinate base of the loaded region
-
isVisible
public boolean isVisible()
Description copied from interface:Interactable
Whether the entity is visible- Specified by:
isVisible
in interfaceInteractable
- Returns:
- true if visible, and false if not visible
-
getInteractionPoint
@Nullable public InteractablePoint getInteractionPoint(java.awt.Point origin)
Description copied from interface:Interactable
Gets a point within the entity that can be interacted with. Takes into account the direction of movement from the origin point.- Specified by:
getInteractionPoint
in interfaceInteractable
-
contains
public boolean contains(java.awt.Point point)
Description copied from interface:Interactable
Checks if the projected bounds of this entity contains the Point provided.- Specified by:
contains
in interfaceInteractable
- Returns:
-
click
public boolean click()
Description copied from interface:Interactable
Clicks this entity in an interactable point- Specified by:
click
in interfaceInteractable
- Returns:
- true if successfully clicked
-
hover
public boolean hover()
Description copied from interface:Interactable
Moves the mouse over this entity- Specified by:
hover
in interfaceInteractable
- Returns:
- true if the mouse is hovering the entity
-
interact
public boolean interact(java.util.regex.Pattern action, java.util.regex.Pattern target)
Description copied from interface:Interactable
Attempts to match action and target using Matcher.find() and then interacts with the appropriate menu item- Specified by:
interact
in interfaceInteractable
- Parameters:
action
- The pattern to match the action with, if null it's ignoredtarget
- The pattern to match the target with, if null it's ignored
-
render
public void render(java.awt.Graphics2D g2d)
Description copied from interface:Renderable
Renders this entity onto the givenGraphics2D
, use is discouraged- Specified by:
render
in interfaceRenderable
-
render
public void render(javafx.scene.canvas.GraphicsContext gc)
Description copied from interface:Renderable
Renders this entity onto the givenGraphicsContext
- Specified by:
render
in interfaceRenderable
-
isValid
public boolean isValid()
Description copied from interface:Validatable
Verifies whether this entity is valid and still exists, typically on the world-graph- Specified by:
isValid
in interfaceValidatable
- Returns:
- true if it's still available, otherwise false
-
getModel
@Nullable public Model getModel()
Description copied from interface:Modeled
Gets the polygon-based model of the entity
-
setBackupModel
public void setBackupModel(int[] frontBottomLeft, int[] backTopRight)
Description copied from interface:Modeled
Sets a backup model to be used when the model isn't available.- Specified by:
setBackupModel
in interfaceModeled
-
setBackupModel
public void setBackupModel(com.runemate.game.api.hybrid.util.collections.Pair<int[],int[]> values)
Description copied from interface:Modeled
Sets a pair of points to be used to create a backup model when the in-game model isn't available- Specified by:
setBackupModel
in interfaceModeled
-
setBackupModel
public void setBackupModel(Model backup)
- Specified by:
setBackupModel
in interfaceModeled
-
setForcedModel
public void setForcedModel(int[] frontBottomLeft, int[] backTopRight)
Description copied from interface:Modeled
Sets a model to be used regardless of whether the in-game model is available.- Specified by:
setForcedModel
in interfaceModeled
-
setForcedModel
public void setForcedModel(com.runemate.game.api.hybrid.util.collections.Pair<int[],int[]> values)
Description copied from interface:Modeled
Sets a pair of points to be used to create a model regardless of whether the in-game model is available- Specified by:
setForcedModel
in interfaceModeled
-
setForcedModel
public void setForcedModel(Model forced)
- Specified by:
setForcedModel
in interfaceModeled
-
resolve
@Nullable public LocatableEntity resolve()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-