use of net.runelite.api.mixins.FieldHook 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);
}
}
}
use of net.runelite.api.mixins.FieldHook in project runelite by runelite.
the class RSWidgetMixin method onHiddenChanged.
@FieldHook("isHidden")
@Inject
public void onHiddenChanged(int idx) {
int id = getId();
if (id == -1) {
return;
}
Widget parent = getParent();
// so ignore them
if (parent != null) {
if (parent.isHidden()) {
return;
}
} else if (TO_GROUP(id) != client.getWidgetRoot()) {
return;
}
broadcastHidden(isSelfHidden());
}
use of net.runelite.api.mixins.FieldHook in project runelite by runelite.
the class RSActorMixin method graphicChanged.
@FieldHook("graphic")
@Inject
public void graphicChanged(int idx) {
GraphicChanged graphicChanged = new GraphicChanged();
graphicChanged.setActor(this);
eventBus.post(graphicChanged);
}
use of net.runelite.api.mixins.FieldHook in project runelite by runelite.
the class RSClientMixin method draggingWidgetChanged.
@FieldHook("draggingWidget")
@Inject
public static void draggingWidgetChanged(int idx) {
DraggingWidgetChanged draggingWidgetChanged = new DraggingWidgetChanged();
draggingWidgetChanged.setDraggingWidget(client.isDraggingWidget());
eventBus.post(draggingWidgetChanged);
}
use of net.runelite.api.mixins.FieldHook in project runelite by runelite.
the class RSClientMixin method experiencedChanged.
@FieldHook("skillExperiences")
@Inject
public static void experiencedChanged(int idx) {
ExperienceChanged experienceChanged = new ExperienceChanged();
Skill[] possibleSkills = Skill.values();
// We subtract one here because 'Overall' isn't considered a skill that's updated.
if (idx < possibleSkills.length - 1) {
Skill updatedSkill = possibleSkills[idx];
experienceChanged.setSkill(updatedSkill);
eventBus.post(experienceChanged);
}
}
Aggregations