use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSTileMixin method itemLayerChanged.
@FieldHook("itemLayer")
@Inject
public void itemLayerChanged(int idx) {
ItemLayerChanged itemLayerChanged = new ItemLayerChanged(this);
eventBus.post(itemLayerChanged);
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSWallObjectMixin method getClickbox.
@Inject
@Override
public Area getClickbox() {
Area clickbox = new Area();
Area clickboxA = Perspective.getClickbox(client, getModelA(), getOrientationA(), getX(), getY());
Area clickboxB = Perspective.getClickbox(client, getModelB(), getOrientationB(), getX(), getY());
if (clickboxA == null && clickboxB == null) {
return null;
}
if (clickboxA != null) {
clickbox.add(clickboxA);
}
if (clickboxB != null) {
clickbox.add(clickboxB);
}
return clickbox;
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class StretchedFixedModeMixin method getStretchedDimensions.
@Inject
@Override
public Dimension getStretchedDimensions() {
Canvas canvas = getCanvas();
int width = canvas.getWidth();
int height = canvas.getHeight();
if (cachedStretchedDimensions == null || width != lastCanvasDimensions.width || height != lastCanvasDimensions.height) {
if (stretchedKeepAspectRatio) {
int tempNewWidth = (int) (height * Constants.GAME_FIXED_ASPECT_RATIO);
if (tempNewWidth > canvas.getWidth()) {
height = (int) (width / Constants.GAME_FIXED_ASPECT_RATIO);
} else {
width = tempNewWidth;
}
}
cachedStretchedDimensions = new Dimension(width, height);
lastCanvasDimensions = new Dimension(width, height);
}
return cachedStretchedDimensions;
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSWidgetMixin method getWidgetItem.
@Inject
@Override
public WidgetItem getWidgetItem(int index) {
int[] itemIds = getItemIds();
int[] itemQuantities = getItemQuantities();
if (itemIds == null || itemQuantities == null) {
return null;
}
// the number of item slot columns is stored here
int columns = getWidth();
int paddingX = getPaddingX();
int paddingY = getPaddingY();
int itemId = itemIds[index];
int itemQuantity = itemQuantities[index];
Point widgetCanvasLocation = getCanvasLocation();
if (itemId <= 0 || itemQuantity <= 0 || columns <= 0) {
return null;
}
int row = index / columns;
int col = index % columns;
int itemX = widgetCanvasLocation.getX() + ((ITEM_SLOT_SIZE + paddingX) * col);
int itemY = widgetCanvasLocation.getY() + ((ITEM_SLOT_SIZE + paddingY) * row);
Rectangle bounds = new Rectangle(itemX - 1, itemY - 1, ITEM_SLOT_SIZE, ITEM_SLOT_SIZE);
return new WidgetItem(itemId - 1, itemQuantity, index, bounds);
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSWidgetMixin method getWidgetItems.
@Inject
@Override
public Collection<WidgetItem> getWidgetItems() {
int[] itemIds = getItemIds();
if (itemIds == null) {
return null;
}
List<WidgetItem> items = new ArrayList<WidgetItem>(itemIds.length);
for (int i = 0; i < itemIds.length; ++i) {
WidgetItem item = getWidgetItem(i);
if (item != null) {
items.add(item);
}
}
return items;
}
Aggregations