Search in sources :

Example 1 with Tile

use of net.runelite.api.Tile in project runelite by runelite.

the class RSRegionMixin method rl$addItemPile.

@Replace("addItemPile")
public void rl$addItemPile(int plane, int x, int y, int hash, Renderable var5, int var6, Renderable var7, Renderable var8) {
    rs$addItemPile(plane, x, y, hash, var5, var6, var7, var8);
    Tile tile = getTiles()[plane][x][y];
    if (tile != null) {
        RSItemLayer itemLayer = (RSItemLayer) tile.getItemLayer();
        if (itemLayer != null) {
            itemLayer.setPlane(plane);
        }
    }
}
Also used : RSItemLayer(net.runelite.rs.api.RSItemLayer) Tile(net.runelite.api.Tile) Replace(net.runelite.api.mixins.Replace)

Example 2 with Tile

use of net.runelite.api.Tile in project runelite by runelite.

the class RSRegionMixin method rl$groundObjectSpawned.

@Replace("groundObjectSpawned")
public void rl$groundObjectSpawned(int plane, int x, int y, int hash, Renderable var5, int var6, int var7) {
    rs$groundObjectSpawned(plane, x, y, hash, var5, var6, var7);
    Tile tile = getTiles()[plane][x][y];
    if (tile != null) {
        RSGroundObject groundObject = (RSGroundObject) tile.getGroundObject();
        if (groundObject != null) {
            groundObject.setPlane(plane);
        }
    }
}
Also used : RSGroundObject(net.runelite.rs.api.RSGroundObject) Tile(net.runelite.api.Tile) Replace(net.runelite.api.mixins.Replace)

Example 3 with Tile

use of net.runelite.api.Tile in project runelite by runelite.

the class RegionTileManager method forEachTile.

/**
 * Iterates over each tile in current region if player is logged in
 * @param consumer consumer accepting tile as parameter
 */
public void forEachTile(Consumer<Tile> consumer) {
    final Client client = clientProvider.get();
    if (client == null || client.getGameState() != GameState.LOGGED_IN) {
        return;
    }
    final Region region = client.getRegion();
    final Tile[][][] tiles = region.getTiles();
    int z = client.getPlane();
    for (int x = 0; x < REGION_SIZE; ++x) {
        for (int y = 0; y < REGION_SIZE; ++y) {
            Tile tile = tiles[z][x][y];
            if (tile == null) {
                continue;
            }
            consumer.accept(tile);
        }
    }
}
Also used : Region(net.runelite.api.Region) Tile(net.runelite.api.Tile) Client(net.runelite.api.Client)

Example 4 with Tile

use of net.runelite.api.Tile in project runelite by runelite.

the class RaidsPlugin method buildRaid.

private Raid buildRaid() {
    Point gridBase = findLobbyBase();
    if (gridBase == null) {
        return null;
    }
    Raid raid = new Raid();
    Tile[][] tiles;
    int position, x, y, offsetX;
    int startX = -2;
    for (int plane = 3; plane > 1; plane--) {
        tiles = client.getRegion().getTiles()[plane];
        if (tiles[gridBase.getX() + RaidRoom.ROOM_MAX_SIZE][gridBase.getY()] == null) {
            position = 1;
        } else {
            position = 0;
        }
        for (int i = 1; i > -2; i--) {
            y = gridBase.getY() + (i * RaidRoom.ROOM_MAX_SIZE);
            for (int j = startX; j < 4; j++) {
                x = gridBase.getX() + (j * RaidRoom.ROOM_MAX_SIZE);
                offsetX = 0;
                if (x > SCENE_SIZE && position > 1 && position < 4) {
                    position++;
                }
                if (x < 0) {
                    // add 1 because the tile at x=0 will always be null
                    offsetX = Math.abs(x) + 1;
                }
                if (x < SCENE_SIZE && y >= 0 && y < SCENE_SIZE) {
                    if (tiles[x + offsetX][y] == null) {
                        if (position == 4) {
                            position++;
                            break;
                        }
                        continue;
                    }
                    if (position == 0 && startX != j) {
                        startX = j;
                    }
                    Tile base = tiles[offsetX > 0 ? 1 : x][y];
                    RaidRoom room = determineRoom(base);
                    raid.setRoom(room, position + Math.abs((plane - 3) * 8));
                    position++;
                }
            }
        }
    }
    return raid;
}
Also used : Tile(net.runelite.api.Tile) Point(net.runelite.api.Point) Point(net.runelite.api.Point)

Example 5 with Tile

use of net.runelite.api.Tile in project runelite by runelite.

the class RSRegionMixin method rl$addBoundaryDecoration.

@Replace("addBoundaryDecoration")
public void rl$addBoundaryDecoration(int plane, int x, int y, int hash, Renderable var5, Renderable var6, int var7, int var8, int var9, int var10, int var11, int var12) {
    rs$addBoundaryDecoration(plane, x, y, hash, var5, var6, var7, var8, var9, var10, var11, var12);
    Tile tile = getTiles()[plane][x][y];
    if (tile != null) {
        RSDecorativeObject object = (RSDecorativeObject) tile.getDecorativeObject();
        if (object != null) {
            object.setPlane(plane);
        }
    }
}
Also used : RSDecorativeObject(net.runelite.rs.api.RSDecorativeObject) Tile(net.runelite.api.Tile) Replace(net.runelite.api.mixins.Replace)

Aggregations

Tile (net.runelite.api.Tile)13 Region (net.runelite.api.Region)6 LocalPoint (net.runelite.api.coords.LocalPoint)6 Replace (net.runelite.api.mixins.Replace)4 WorldPoint (net.runelite.api.coords.WorldPoint)3 Subscribe (com.google.common.eventbus.Subscribe)2 Color (java.awt.Color)2 GameObject (net.runelite.api.GameObject)2 Item (net.runelite.api.Item)2 ItemLayer (net.runelite.api.ItemLayer)2 Node (net.runelite.api.Node)2 Player (net.runelite.api.Player)2 Area (java.awt.geom.Area)1 Instant (java.time.Instant)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Client (net.runelite.api.Client)1 ItemComposition (net.runelite.api.ItemComposition)1 MenuEntry (net.runelite.api.MenuEntry)1