Package org.dreambot.api.methods.map
Class Area
- java.lang.Object
-
- org.dreambot.api.methods.map.Area
-
-
Constructor Summary
Constructors Constructor Description Area(int x1, int y1, int x2, int y2)
Creates a rectangular area using basic coordinates for plane 0.Area(int x1, int y1, int x2, int y2, int z)
Creates a rectangular area using basic coordinates.Area(Tile... tiles)
Area(Tile northeastTile, Tile southwestTile)
Creates an Area based on the northeast and southwest corner tiles (both inclusive)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(int x, int y)
Checks if the Area contains the x and the y pointsboolean
contains(Tile tile)
Checks if the Area contains the provided Tileboolean
contains(Entity entity)
Checks if an Area contains the provided Entitystatic Area
generateArea(int radius, Tile center)
java.util.List<Tile>
getBoundaryPoints()
Gets the boundary Tiles, or a list of the area's defined pointsjava.awt.Rectangle
getBoundingBox()
Gets the bounding box of the areaTile
getCenter()
Gets the center Tile of the AreaTile
getNearestTile(Entity entity)
Gets the closest Tile in the Area to the provided entityjava.awt.Polygon
getPolygonArea()
Gets the polygon shape of the AreaTile
getRandomTile()
Gets a random Tile inside the AreaTile
getTile()
Gets tile of the object.Tile[]
getTiles()
Gets all of the tiles contained in the Areavoid
setZ(int plane)
Area
withArea(Area area)
Creates a newArea
containing the tiles from this area and the given area-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.dreambot.api.wrappers.interactive.Locatable
canReach, canReach, distance, getGridX, getGridY, getTileReference, getX, getY, getZ, tileDistance, walkingDistance
-
-
-
-
Constructor Detail
-
Area
public Area(Tile... tiles)
-
Area
public Area(Tile northeastTile, Tile southwestTile)
Creates an Area based on the northeast and southwest corner tiles (both inclusive)- Parameters:
northeastTile
- Northeast tilesouthwestTile
- Southwest tile
-
Area
public Area(int x1, int y1, int x2, int y2)
Creates a rectangular area using basic coordinates for plane 0. The x and y positions provided do not need to be any specific corner.- Parameters:
x1
- X of first cornery1
- Y of first cornerx2
- X of second cornery2
- Y of second corner
-
Area
public Area(int x1, int y1, int x2, int y2, int z)
Creates a rectangular area using basic coordinates. The x and y positions provided do not need to be any specific corner.- Parameters:
x1
- X of first cornery1
- Y of first cornerx2
- X of second cornery2
- Y of second cornerz
- The plane.
-
-
Method Detail
-
setZ
public void setZ(int plane)
-
getTiles
public Tile[] getTiles()
Gets all of the tiles contained in the Area- Returns:
- An array of Tile's contained within the Area
-
getNearestTile
public Tile getNearestTile(Entity entity)
Gets the closest Tile in the Area to the provided entity- Parameters:
entity
- The entity- Returns:
- The Tile closest to the provided entity
-
getRandomTile
public Tile getRandomTile()
Gets a random Tile inside the Area- Returns:
- A random Tile from the Area
-
getCenter
public Tile getCenter()
Gets the center Tile of the Area- Returns:
- The center Tile of the Area
-
getPolygonArea
public java.awt.Polygon getPolygonArea()
Gets the polygon shape of the Area- Returns:
- The polygon shape of the Area
-
getBoundingBox
public java.awt.Rectangle getBoundingBox()
Gets the bounding box of the area- Returns:
- The rectangle bounding box
-
contains
public boolean contains(int x, int y)
Checks if the Area contains the x and the y points- Parameters:
x
- X value of Tiley
- Y value of Tile- Returns:
- True if the area contains the point, otherwise False
-
contains
public boolean contains(Tile tile)
Checks if the Area contains the provided Tile- Parameters:
tile
- Tile to check for- Returns:
- True if the Area contains Tile, otherwise False
-
contains
public boolean contains(Entity entity)
Checks if an Area contains the provided Entity- Parameters:
entity
- Entity to check- Returns:
- True if the Area contains the Entity, otherwise False
-
withArea
public Area withArea(Area area)
Creates a newArea
containing the tiles from this area and the given area- Parameters:
area
- Area to append the tiles from to this area- Returns:
- new Area instance containing tiles from both this area and the given area
-
getBoundaryPoints
public java.util.List<Tile> getBoundaryPoints()
Gets the boundary Tiles, or a list of the area's defined points- Returns:
- List of
Tile
s that make up the area's boundary/defined points. Empty if no points defined.
-
-