Merge pull request #7824 from Abextm/decorative-hulls
Fix DecorativeObject ConvexHulls
This commit is contained in:
@@ -38,6 +38,7 @@ public interface DecorativeObject extends TileObject
|
||||
* @see net.runelite.api.model.Jarvis
|
||||
*/
|
||||
Polygon getConvexHull();
|
||||
Polygon getConvexHull2();
|
||||
|
||||
Renderable getRenderable();
|
||||
Renderable getRenderable2();
|
||||
|
||||
@@ -347,6 +347,12 @@ class DevToolsOverlay extends Overlay
|
||||
{
|
||||
graphics.drawPolygon(p);
|
||||
}
|
||||
|
||||
p = decorObject.getConvexHull2();
|
||||
if (p != null)
|
||||
{
|
||||
graphics.drawPolygon(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user