use of net.runelite.api.Tile in project runelite by runelite.
the class RSRegionMixin method rl$addBoundary.
@Replace("addBoundary")
public void rl$addBoundary(int plane, int x, int y, int hash, Renderable var5, Renderable var6, int var7, int var8, int var9, int var10) {
rs$addBoundary(plane, x, y, hash, var5, var6, var7, var8, var9, var10);
Tile tile = getTiles()[plane][x][y];
if (tile != null) {
RSWallObject wallObject = (RSWallObject) tile.getWallObject();
if (wallObject != null) {
wallObject.setPlane(plane);
}
}
}
use of net.runelite.api.Tile in project runelite by runelite.
the class TileObjectQuery method getTiles.
protected List<Tile> getTiles(Client client) {
List<Tile> tilesList = new ArrayList<>();
Region region = client.getRegion();
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;
}
tilesList.add(tile);
}
}
return tilesList;
}
use of net.runelite.api.Tile in project runelite by runelite.
the class HunterPlugin method onGameTick.
/**
* Iterates over all the traps that were placed by the local player and
* checks if the trap is still there. If the trap is gone, it removes
* the trap from the local players trap collection.
*/
@Subscribe
public void onGameTick(GameTick event) {
// Check if all traps are still there, and remove the ones that are not.
Iterator<Map.Entry<WorldPoint, HunterTrap>> it = traps.entrySet().iterator();
Tile[][][] tiles = client.getRegion().getTiles();
Instant expire = Instant.now().minus(HunterTrap.TRAP_TIME.multipliedBy(2));
while (it.hasNext()) {
Map.Entry<WorldPoint, HunterTrap> entry = it.next();
HunterTrap trap = entry.getValue();
WorldPoint world = entry.getKey();
LocalPoint local = LocalPoint.fromWorld(client, world);
// Not within the client's viewport
if (local == null) {
// Cull very old traps
if (trap.getPlacedOn().isBefore(expire)) {
log.debug("Trap removed from personal trap collection due to timeout, {} left", traps.size());
it.remove();
continue;
}
continue;
}
Tile tile = tiles[world.getPlane()][local.getRegionX()][local.getRegionY()];
GameObject[] objects = tile.getGameObjects();
boolean containsBoulder = false;
boolean containsAnything = false;
for (GameObject object : objects) {
if (object != null) {
containsAnything = true;
if (object.getId() == ObjectID.BOULDER_19215 || object.getId() == ObjectID.LARGE_BOULDER) {
containsBoulder = true;
break;
}
}
}
if (!containsAnything) {
it.remove();
log.debug("Trap removed from personal trap collection, {} left", traps.size());
} else if (// For traps like deadfalls. This is different because when the trap is gone, there is still a GameObject (boulder)
containsBoulder) {
it.remove();
log.debug("Special trap removed from personal trap collection, {} left", traps.size());
// Case we have notifications enabled and the action was not manual, throw notification
if (config.maniacalMonkeyNotify() && trap.getObjectId() == ObjectID.MONKEY_TRAP && !trap.getState().equals(HunterTrap.State.FULL) && !trap.getState().equals(HunterTrap.State.OPEN)) {
notifier.notify("The monkey escaped.");
}
}
}
}
use of net.runelite.api.Tile in project runelite by runelite.
the class MapClue method makeWorldOverlayHint.
@Override
public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) {
LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation());
if (localLocation == null) {
return;
}
// Mark game object
if (objectId != -1) {
Region region = plugin.getClient().getRegion();
Tile[][][] tiles = region.getTiles();
Tile tile = tiles[plugin.getClient().getPlane()][localLocation.getRegionX()][localLocation.getRegionY()];
net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition();
for (GameObject gameObject : tile.getGameObjects()) {
if (gameObject != null) {
OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR);
OverlayUtil.renderImageLocation(plugin.getClient(), graphics, localLocation, CLUE_SCROLL_IMAGE, IMAGE_Z_OFFSET);
}
}
} else {
OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, SPADE_IMAGE, Color.ORANGE);
}
}
use of net.runelite.api.Tile in project runelite by runelite.
the class DevToolsOverlay method renderTileObjects.
private void renderTileObjects(Graphics2D graphics) {
Region region = client.getRegion();
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;
}
Player player = client.getLocalPlayer();
if (player == null) {
continue;
}
if (plugin.isToggleGroundItems()) {
renderGroundItems(graphics, tile, player);
}
if (plugin.isToggleGroundObjects()) {
renderGroundObject(graphics, tile, player);
}
if (plugin.isToggleGameObjects()) {
renderGameObjects(graphics, tile, player);
}
if (plugin.isToggleWalls()) {
renderWallObject(graphics, tile, player);
}
if (plugin.isToggleDecor()) {
renderDecorObject(graphics, tile, player);
}
}
}
}
Aggregations