api: modify Widget.getWidgetItem to return widget items when no item exists

This allows plugins to get the canvas bounds of where items would be if
they existed. Update existing usages to account for the new behavior.
This commit is contained in:
Adam
2019-06-02 20:02:11 -04:00
committed by Adam
parent 059f8a9ecb
commit 57f60a36e4
3 changed files with 10 additions and 6 deletions

View File

@@ -457,6 +457,7 @@ class DevToolsOverlay extends Overlay
WidgetItem widgetItem = widget.getWidgetItem(itemIndex);
if (widgetItem == null
|| widgetItem.getId() < 0
|| widgetItem.getId() == ITEM_EMPTY
|| widgetItem.getId() == ITEM_FILLED)
{

View File

@@ -120,7 +120,7 @@ public class ExaminePlugin extends Plugin
int widgetChild = TO_CHILD(widgetId);
Widget widget = client.getWidget(widgetGroup, widgetChild);
WidgetItem widgetItem = widget.getWidgetItem(event.getActionParam());
quantity = widgetItem != null ? widgetItem.getQuantity() : 1;
quantity = widgetItem != null && widgetItem.getId() >= 0 ? widgetItem.getQuantity() : 1;
break;
}
case EXAMINE_ITEM_BANK_EQ: