use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSClientMixin method getWidgetRoots.
@Inject
@Override
public Widget[] getWidgetRoots() {
int topGroup = getWidgetRoot();
List<Widget> widgets = new ArrayList<Widget>();
for (Widget widget : getWidgets()[topGroup]) {
if (widget != null && widget.getParentId() == -1) {
widgets.add(widget);
}
}
return widgets.toArray(new Widget[widgets.size()]);
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSClientMixin method createItemSprite.
@Inject
@Override
public SpritePixels createItemSprite(int itemId, int quantity, int border, int shadowColor, int stackable, boolean noted, int scale) {
assert isClientThread();
int zoom = get3dZoom();
set3dZoom(scale);
try {
return createItemSprite(itemId, quantity, border, shadowColor, stackable, noted);
} finally {
set3dZoom(zoom);
}
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSClientMixin method mapRegionsChanged.
@FieldHook("mapRegions")
@Inject
public static void mapRegionsChanged(int idx) {
MapRegionChanged regionChanged = new MapRegionChanged();
regionChanged.setIndex(idx);
eventBus.post(regionChanged);
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSClientMixin method playerOptionsChanged.
@FieldHook("playerOptions")
@Inject
public static void playerOptionsChanged(int idx) {
// Reset the menu type
MenuAction[] playerActions = { PLAYER_FIRST_OPTION, PLAYER_SECOND_OPTION, PLAYER_THIRD_OPTION, PLAYER_FOURTH_OPTION, PLAYER_FIFTH_OPTION, PLAYER_SIXTH_OPTION, PLAYER_SEVENTH_OPTION, PLAYER_EIGTH_OPTION };
if (idx >= 0 && idx < playerActions.length) {
MenuAction playerAction = playerActions[idx];
client.getPlayerMenuTypes()[idx] = playerAction.getId();
}
PlayerMenuOptionsChanged optionsChanged = new PlayerMenuOptionsChanged();
optionsChanged.setIndex(idx);
eventBus.post(optionsChanged);
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSTileMixin method gameObjectsChanged.
@FieldHook("objects")
@Inject
public void gameObjectsChanged(int idx) {
if (// this happens from the field assignment
idx == -1) {
return;
}
if (previousGameObjects == null) {
previousGameObjects = new GameObject[5];
}
// Previous game object
GameObject previous = previousGameObjects[idx];
// GameObject that was changed.
RSGameObject current = (RSGameObject) getGameObjects()[idx];
// Last game object
GameObject last = lastGameObject;
// Update last game object
lastGameObject = current;
// Update previous object to current
previousGameObjects[idx] = current;
// Duplicate event, return
if (current != null && current.equals(last)) {
return;
}
// Characters seem to generate a constant stream of new GameObjects
if (current == null || !(current.getRenderable() instanceof Actor)) {
if (current == null && previous != null) {
GameObjectDespawned gameObjectDespawned = new GameObjectDespawned();
gameObjectDespawned.setTile(this);
gameObjectDespawned.setGameObject(previous);
eventBus.post(gameObjectDespawned);
} else if (current != null && previous == null) {
GameObjectSpawned gameObjectSpawned = new GameObjectSpawned();
gameObjectSpawned.setTile(this);
gameObjectSpawned.setGameObject(current);
eventBus.post(gameObjectSpawned);
} else if (current != null && previous != null) {
GameObjectChanged gameObjectsChanged = new GameObjectChanged();
gameObjectsChanged.setTile(this);
gameObjectsChanged.setPrevious(previous);
gameObjectsChanged.setGameObject(current);
eventBus.post(gameObjectsChanged);
}
}
}
Aggregations