Class Destination
- java.lang.Object
-
- net.openosrs.api.input.target.Destination
-
- Direct Known Subclasses:
ActorDestination,ObjectDestination,PointDestination,ShapeDestination
public abstract class Destination extends java.lang.ObjectSomething the cursor can be sent to.A destination is not a coordinate. It is a thing that knows its own shape on screen, knows whether it is currently reachable, and can produce a fresh aim point every time it is asked. That last part matters: a target clicked twice at the identical pixel is the clearest possible tell, so
suitablePoint(Random)deliberately returns a different point each call.Implementations must be cheap to re-query. The planner re-reads the shape mid-movement to track targets that walk away.
-
-
Constructor Summary
Constructors Constructor Description Destination()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.awt.geom.Areaarea()java.awt.Rectanglebounds()booleancameraCanHelp()Whether the camera can plausibly fix this destination at all.net.runelite.api.Pointcentre()booleancontains(net.runelite.api.Point point)abstract java.lang.Stringdescribe()A short label for logging and the overlay.net.runelite.api.coords.LocalPointfocusPoint()Where in the scene the camera should look to reveal this destination, ornullwhen the concept does not apply.java.awt.RectanglegetViewport()booleanisCurrent()Revalidate the captured scene/widget identity before using its geometry.booleanisVisible()Whether the destination can be clicked right now.booleanneedsCamera()Whether reaching this destination needs the camera moved first.booleanneedsScroll()Whether reaching this destination requires scrolling a parent container first.java.awt.RectanglescrollContainer()The scrollable container bounding area, or null if no scroll is needed.intscrollDirection()The direction of scroll wheel rotation needed (-1 for up, 1 for down, 0 if in view).abstract java.awt.Shapeshape()The raw clickable outline in canvas pixels, ornullwhen the target has no projection at all.net.runelite.api.PointsuitablePoint(java.util.Random random)A point to aim at, biased toward the middle and different every call.java.lang.StringtoString()java.awt.ShapevisibleShape()The part of the outline that is genuinely on screen, ornullwhen none of it is.DestinationwithValidity(java.util.function.BooleanSupplier check)DestinationwithViewport(java.awt.Rectangle viewport)Restrict this destination to the drawable area.
-
-
-
Method Detail
-
shape
public abstract java.awt.Shape shape()
The raw clickable outline in canvas pixels, ornullwhen the target has no projection at all.This is unclipped on purpose. The client projects actors and objects that are behind or beside the camera to coordinates far outside the canvas rather than returning null, so a non-null shape here is not a claim that anything is on screen. Use
visibleShape()for that.
-
describe
public abstract java.lang.String describe()
A short label for logging and the overlay.
-
withValidity
public Destination withValidity(java.util.function.BooleanSupplier check)
-
isCurrent
public boolean isCurrent()
Revalidate the captured scene/widget identity before using its geometry.
-
withViewport
public Destination withViewport(java.awt.Rectangle viewport)
Restrict this destination to the drawable area.Set by whoever resolves the destination, because the canvas size is a client concern and this package deliberately has no client access. With no viewport set nothing is clipped, which keeps the type usable in tests.
-
getViewport
public java.awt.Rectangle getViewport()
-
visibleShape
public java.awt.Shape visibleShape()
The part of the outline that is genuinely on screen, ornullwhen none of it is. Everything that decides where to click goes through here.
-
bounds
public java.awt.Rectangle bounds()
-
isVisible
public boolean isVisible()
Whether the destination can be clicked right now. A non-null projection is not enough: a target behind the camera still projects, and a shape clipped to nothing by the viewport is not visible.
-
contains
public boolean contains(net.runelite.api.Point point)
-
area
public java.awt.geom.Area area()
-
needsCamera
public boolean needsCamera()
Whether reaching this destination needs the camera moved first. Targets that are simply off screen answertrue; fixed screen furniture such as an inventory slot never does.
-
needsScroll
public boolean needsScroll()
Whether reaching this destination requires scrolling a parent container first.
-
scrollContainer
public java.awt.Rectangle scrollContainer()
The scrollable container bounding area, or null if no scroll is needed.
-
scrollDirection
public int scrollDirection()
The direction of scroll wheel rotation needed (-1 for up, 1 for down, 0 if in view).
-
cameraCanHelp
public boolean cameraCanHelp()
Whether the camera can plausibly fix this destination at all. A dropped item four hundred tiles away needs walking, not rotating, and the backend should not spin the camera pointlessly before giving up.
-
focusPoint
public net.runelite.api.coords.LocalPoint focusPoint()
Where in the scene the camera should look to reveal this destination, ornullwhen the concept does not apply.Screen furniture has no scene position, so it returns null and the camera is left alone. World targets return their location and the camera controller works out the rotation from there.
-
centre
public net.runelite.api.Point centre()
-
suitablePoint
public net.runelite.api.Point suitablePoint(java.util.Random random)
A point to aim at, biased toward the middle and different every call.Samples a normal cloud around the centre and takes the first sample that actually lands inside the shape, which matters for concave outlines such as a model hull where the bounding-box centre can sit in empty space. Falls back to the centre only if every sample misses.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-