Merge pull request #7824 from Abextm/decorative-hulls

Fix DecorativeObject ConvexHulls
This commit is contained in:
Adam
2019-02-16 19:15:18 -05:00
committed by GitHub
4 changed files with 51 additions and 1 deletions

View File

@@ -38,6 +38,7 @@ public interface DecorativeObject extends TileObject
* @see net.runelite.api.model.Jarvis
*/
Polygon getConvexHull();
Polygon getConvexHull2();
Renderable getRenderable();
Renderable getRenderable2();

View File

@@ -347,6 +347,12 @@ class DevToolsOverlay extends Overlay
{
graphics.drawPolygon(p);
}
p = decorObject.getConvexHull2();
if (p != null)
{
graphics.drawPolygon(p);
}
}
}

View File

@@ -82,6 +82,29 @@ public abstract class RSDecorativeObjectMixin implements RSDecorativeObject
return model;
}
@Inject
private RSModel getModel2()
{
RSRenderable renderable = getRenderable2();
if (renderable == null)
{
return null;
}
RSModel model;
if (renderable instanceof Model)
{
model = (RSModel) renderable;
}
else
{
model = renderable.getModel();
}
return model;
}
@Inject
@Override
public Area getClickbox()
@@ -100,6 +123,20 @@ public abstract class RSDecorativeObjectMixin implements RSDecorativeObject
return null;
}
return model.getConvexHull(getX(), getY(), getOrientation());
return model.getConvexHull(getX() + getXOffset(), getY() + getYOffset(), 0);
}
@Inject
@Override
public Polygon getConvexHull2()
{
RSModel model = getModel2();
if (model == null)
{
return null;
}
return model.getConvexHull(getX(), getY(), 0);
}
}

View File

@@ -39,6 +39,12 @@ public interface RSDecorativeObject extends DecorativeObject
@Import("y")
int getY();
@Import("offsetX")
int getXOffset();
@Import("offsetY")
int getYOffset();
@Import("rotation")
int getOrientation();