Search in sources :

Example 1 with GroundObjectDespawned

use of net.runelite.api.events.GroundObjectDespawned in project runelite by runelite.

the class RSTileMixin method groundObjectChanged.

@FieldHook("groundObject")
@Inject
public void groundObjectChanged(int idx) {
    GroundObject previous = previousGroundObject;
    GroundObject current = getGroundObject();
    previousGroundObject = current;
    if (current == null && previous != null) {
        GroundObjectDespawned groundObjectDespawned = new GroundObjectDespawned();
        groundObjectDespawned.setTile(this);
        groundObjectDespawned.setGroundObject(previous);
        eventBus.post(groundObjectDespawned);
    } else if (current != null && previous == null) {
        GroundObjectSpawned groundObjectSpawned = new GroundObjectSpawned();
        groundObjectSpawned.setTile(this);
        groundObjectSpawned.setGroundObject(current);
        eventBus.post(groundObjectSpawned);
    } else if (current != null && previous != null) {
        GroundObjectChanged groundObjectChanged = new GroundObjectChanged();
        groundObjectChanged.setTile(this);
        groundObjectChanged.setPrevious(previous);
        groundObjectChanged.setGroundObject(current);
        eventBus.post(groundObjectChanged);
    }
}
Also used : GroundObjectSpawned(net.runelite.api.events.GroundObjectSpawned) GroundObject(net.runelite.api.GroundObject) GroundObjectChanged(net.runelite.api.events.GroundObjectChanged) GroundObjectDespawned(net.runelite.api.events.GroundObjectDespawned) Inject(net.runelite.api.mixins.Inject) FieldHook(net.runelite.api.mixins.FieldHook)

Aggregations

GroundObject (net.runelite.api.GroundObject)1 GroundObjectChanged (net.runelite.api.events.GroundObjectChanged)1 GroundObjectDespawned (net.runelite.api.events.GroundObjectDespawned)1 GroundObjectSpawned (net.runelite.api.events.GroundObjectSpawned)1 FieldHook (net.runelite.api.mixins.FieldHook)1 Inject (net.runelite.api.mixins.Inject)1