runelite-api: add getRegionMin/MaxLocation for GameObject

This commit is contained in:
Adam
2017-11-21 17:35:10 -05:00
parent 880a2bd282
commit ac071771b0
2 changed files with 30 additions and 0 deletions

View File

@@ -32,5 +32,20 @@ import java.awt.Polygon;
*/
public interface GameObject extends TileObject
{
/**
* Returns the min x,y for this game object
*
* @return
*/
Point getRegionMinLocation();
/**
* Returns the max x,y for this game object. This is different from
* {@link #getRegionMinLocation()} for objects larger than 1 tile.
*
* @return
*/
Point getRegionMaxLocation();
Polygon getConvexHull();
}

View File

@@ -26,6 +26,7 @@ package net.runelite.mixins;
import java.awt.Polygon;
import net.runelite.api.Model;
import net.runelite.api.Point;
import net.runelite.api.Renderable;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
@@ -34,6 +35,20 @@ import net.runelite.rs.api.RSGameObject;
@Mixin(RSGameObject.class)
public abstract class RSGameObjectMixin implements RSGameObject
{
@Inject
@Override
public Point getRegionMinLocation()
{
return new Point(getRelativeX(), getRelativeY());
}
@Inject
@Override
public Point getRegionMaxLocation()
{
return new Point(getOffsetX(), getOffsetY());
}
@Inject
@Override
public Polygon getConvexHull()