Class Model
- java.lang.Object
-
- com.runemate.game.api.hybrid.local.hud.Model
-
- All Implemented Interfaces:
Animable
,Interactable
,Locatable
,Modeled
,Renderable
,Rotatable
,LocatableEntity
,Validatable
- Direct Known Subclasses:
BoundingModel
,CompositeCacheModel
,CompositeModel
,RemoteModel
,RSModel
public abstract class Model extends java.lang.Object implements LocatableEntity, Rotatable, Animable
A 3D in-game entity model
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_HEIGHT_OFFSET
-
Constructor Summary
Constructors Constructor Description Model(LocatableEntity owner)
Model(LocatableEntity owner, int floorHeight)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
animate(int animationId, int animationFrame, int stanceId, int stanceFrame)
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.boolean
equals(java.lang.Object o)
int
getAnimationId()
Gets the entities current animation idArea.Rectangular
getArea(Coordinate regionBase)
Gets the area using the region base as the coordinate to offset from.abstract BoundingModel
getBoundingModel()
Gets the BoundingModel of this model.abstract java.util.Set<java.awt.Color>
getDefaultColors()
Gets a list of colors that are used by default on the models polygons.abstract int
getHeight()
int
getHighPrecisionOrientation()
For internal usage only.Coordinate.HighPrecision
getHighPrecisionPosition(Coordinate regionBase)
Gets the high precision position using the region base as the coordinate to offset from.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 entityint
getOrientationAsAngle()
Gets the current orientation as an angle.LocatableEntity
getOwner()
Coordinate
getPosition(Coordinate regionBase)
Gets the position using the region base as the coordinate to offset from.double
getVisibility()
Returns a rough estimate of how visible this entity is as a percent (0 to 100)int
hashCode()
boolean
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
isFacing(Locatable locatable)
Checks if this rotatable entity is facing a locatable objectboolean
isVisible()
Whether the entity is visibleInteractableRectangle
projectBoundingRectangle()
Deprecated.java.awt.Polygon
projectConvexHull()
abstract java.util.List<Triangle>
projectTriangles()
abstract java.util.List<Triangle>
projectTrianglesWithin(java.awt.Shape viewport)
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
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 interface com.runemate.game.api.hybrid.entities.details.Interactable
getInteractionPoint, hasDynamicBounds, hover, interact, interact, interact, interact, interact, isHovered
-
Methods inherited from interface com.runemate.game.api.hybrid.entities.details.Locatable
distanceTo, distanceTo, getLocalPosition
-
Methods inherited from interface com.runemate.game.api.hybrid.entities.LocatableEntity
getArea, getHighPrecisionPosition, getPosition
-
Methods inherited from interface com.runemate.game.api.hybrid.util.Validatable
isValid
-
-
-
-
Field Detail
-
DEFAULT_HEIGHT_OFFSET
public static final int DEFAULT_HEIGHT_OFFSET
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Model
public Model(LocatableEntity owner)
-
Model
public Model(LocatableEntity owner, int floorHeight)
-
-
Method Detail
-
getOwner
public LocatableEntity getOwner()
-
animate
public void animate(int animationId, int animationFrame, int stanceId, int stanceFrame)
-
projectTriangles
public abstract java.util.List<Triangle> projectTriangles()
-
projectTrianglesWithin
public abstract java.util.List<Triangle> projectTrianglesWithin(java.awt.Shape viewport)
-
getHeight
public abstract int getHeight()
-
projectConvexHull
@Nullable public java.awt.Polygon projectConvexHull()
-
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
-
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
-
getVisibility
public final 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
-
getInteractionPoint
public final 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 final 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 final boolean click()
Description copied from interface:Interactable
Clicks this entity in an interactable point- Specified by:
click
in interfaceInteractable
- Returns:
- true if successfully clicked
-
interact
public final 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
-
getPosition
@Nullable public final 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
@Nullable public final 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
@Nullable 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
-
getHighPrecisionOrientation
public final int getHighPrecisionOrientation()
Description copied from interface:Rotatable
For internal usage only. Subject to removal without notice.- Specified by:
getHighPrecisionOrientation
in interfaceRotatable
-
getOrientationAsAngle
public int getOrientationAsAngle()
Description copied from interface:Rotatable
Gets the current orientation as an angle.- Specified by:
getOrientationAsAngle
in interfaceRotatable
-
isFacing
public boolean isFacing(Locatable locatable)
Description copied from interface:Rotatable
Checks if this rotatable entity is facing a locatable object
-
getAnimationId
public final int getAnimationId()
Description copied from interface:Animable
Gets the entities current animation id- Specified by:
getAnimationId
in interfaceAnimable
- Returns:
- the current animation id, or if unavailable -1
-
getBoundingModel
@Nullable public abstract BoundingModel getBoundingModel()
Gets the BoundingModel of this model.
-
projectBoundingRectangle
@Deprecated public final InteractableRectangle projectBoundingRectangle()
Deprecated.Gets a bounding rectangle of the model.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getDefaultColors
public abstract java.util.Set<java.awt.Color> getDefaultColors()
Gets a list of colors that are used by default on the models polygons. These are sometimes replaced before being rendered and these substitutions can be retrieved from GameObjectDefinition#getColorSubstitutions and NpcDefinition#getColorSubstitutions.
-
getModel
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
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-