The WorldView interface provides access to the game world, including the scene, players, NPCs, and world entities. The World interface represents individual RuneScape worlds.
WorldView
Getting the WorldView
The top-level WorldView contains the main game scene:
WorldView worldView = client . getTopLevelWorldView ();
WorldView ID
The world view ID, or -1 if this is the top level
int id = worldView . getId ();
boolean isTopLevel = worldView . isTopLevel (); // true if ID == -1
Scene
Gets the scene contained in this worldview.
Scene scene = worldView . getScene ();
Tile [][][] tiles = scene . getTiles ();
Entities
players
Gets all players in the worldview.
for ( Player player : worldView . players ()) {
if (player != null ) {
// Process player
String name = player . getName ();
WorldPoint location = player . getWorldLocation ();
}
}
npcs
Gets all NPCs in the worldview.
for ( NPC npc : worldView . npcs ()) {
if (npc != null ) {
int id = npc . getId ();
String name = npc . getName ();
}
}
worldEntities
Returns
IndexedObjectSet<WorldEntity>
All world entities in this view
Gets all world entities in the worldview.
for ( WorldEntity entity : worldView . worldEntities ()) {
if (entity != null ) {
// Process world entity
}
}
worldViews
Returns
IndexedObjectSet<WorldView>
Child worldviews
Gets the worldviews of each world entity in this worldview.
for ( WorldView subView : worldView . worldViews ()) {
if (subView != null ) {
// Process sub-worldview
}
}
Coordinates and Plane
getPlane
Gets the current plane the player is on.
int plane = worldView . getPlane ();
// 0 = ground level, 1 = first floor, etc.
// Caves/dungeons are also plane 0 with different coordinates
Base Coordinates
The base X or Y coordinate
Gets the world coordinate of tile (0, 0) in the scene.
int baseX = worldView . getBaseX ();
int baseY = worldView . getBaseY ();
// Scene tile (sceneX, sceneY) = world coordinates (baseX + sceneX, baseY + sceneY)
getSizeX / getSizeY
The size of the world view
Gets the size of the world view on the X or Y axis.
int sizeX = worldView . getSizeX ();
int sizeY = worldView . getSizeY ();
// Typically 104x104 for normal scenes
Tile Data
getTileHeights
3D array of tile heights [plane][x][y]
Gets the heights of tiles in the scene.
int [][][] tileHeights = worldView . getTileHeights ();
int height = tileHeights[plane][x][y];
getTileHeight
Gets the tile height at coordinates, interpolating from adjacent tiles.
LocalPoint lp = player . getLocalLocation ();
int height = worldView . getTileHeight ( lp . getX (), lp . getY (), plane);
getTileSettings
3D array of tile settings [plane][x][y]
Gets the settings/flags of tiles.
byte [][][] tileSettings = worldView . getTileSettings ();
// Settings contain collision and bridge flags
Collision
getCollisionMaps
Array of collision data per plane
Gets tile collision data.
CollisionData [] collisionMaps = worldView . getCollisionMaps ();
if (collisionMaps != null && collisionMaps[plane] != null ) {
int [][] flags = collisionMaps[plane]. getFlags ();
int flag = flags[x][y];
// Check collision flags
boolean blocked = (flag & CollisionDataFlag . BLOCK_MOVEMENT_FULL ) != 0 ;
boolean isWall = (flag & CollisionDataFlag . BLOCK_MOVEMENT_NORTH_WEST ) != 0 ;
}
Graphics Objects and Projectiles
getGraphicsObjects
Gets all graphics objects currently drawn (spotanims on the ground).
for ( GraphicsObject graphicsObject : worldView . getGraphicsObjects ()) {
int id = graphicsObject . getId ();
LocalPoint location = graphicsObject . getLocation ();
// Graphics like AoE indicators, spell effects, etc.
}
Selected Tile
getSelectedSceneTile
Gets the currently selected tile (last right-clicked tile).
Tile selectedTile = worldView . getSelectedSceneTile ();
if (selectedTile != null ) {
WorldPoint location = selectedTile . getWorldLocation ();
log . info ( "Selected tile: " + location);
}
Instances
isInstance
True if this is an instanced area
Checks if the scene is an instance.
if ( worldView . isInstance ()) {
// Player is in an instanced area (e.g., raid, private area)
int [][][] instanceChunks = worldView . getInstanceTemplateChunks ();
}
getInstanceTemplateChunks
3D array of template chunks [plane][chunkX][chunkY]
Gets template chunks for instanced areas.
if ( worldView . isInstance ()) {
int [][][] chunks = worldView . getInstanceTemplateChunks ();
// Each int contains: rotation, chunk coords, plane
// See Constants.CHUNK_SIZE and InstanceTemplates
}
Map Regions
getMapRegions
Array of loaded map region IDs
Gets the map region IDs currently loaded.
int [] regions = worldView . getMapRegions ();
for ( int regionId : regions) {
log . debug ( "Loaded region: " + regionId);
}
getXteaKeys
Gets the XTEA encryption keys for loaded regions.
int [][] xteaKeys = worldView . getXteaKeys ();
// Keys for decrypting region files
// xteaKeys[i] corresponds to getMapRegions()[i]
Coordinate Containment
contains (WorldPoint)
True if worldview contains the point
Tests if this worldview contains the given world point.
WorldPoint point = new WorldPoint ( 3200 , 3200 , 0 );
if ( worldView . contains (point)) {
// Point is in this worldview
}
contains (LocalPoint)
True if worldview contains the point
Tests if this worldview contains the given local point.
LocalPoint lp = new LocalPoint ( 6400 , 6400 );
if ( worldView . contains (lp)) {
// Point is visible in this worldview
}
Projections
getMainWorldProjection
Returns a projection to translate from this world view to the main world.
Projection projection = worldView . getMainWorldProjection ();
if (projection != null ) {
// Use projection for coordinate transformations
}
getCanvasProjection
Returns a projection to translate from this world view to the canvas.
Projection canvasProjection = worldView . getCanvasProjection ();
if (canvasProjection != null ) {
float [] projected = canvasProjection . project (x, y, z);
}
Click Actions
getYellowClickAction
Gets how clicking on tiles should behave for this WorldView.
int clickAction = worldView . getYellowClickAction ();
switch (clickAction) {
case Constants . CLICK_ACTION_NONE :
// Clicking does nothing
break ;
case Constants . CLICK_ACTION_WALK :
// Clicking walks to tile
break ;
case Constants . CLICK_ACTION_SET_HEADING :
// Clicking sets heading only
break ;
}
World Interface
World Properties
The World interface represents individual RuneScape worlds:
World [] worlds = client . getWorldList ();
for ( World world : worlds) {
int worldId = world . getId (); // World number
int players = world . getPlayerCount (); // Current players
String activity = world . getActivity (); // e.g., "Trade - Members"
String address = world . getAddress (); // Server address
int location = world . getLocation (); // Geographic location
EnumSet < WorldType > types = world . getTypes (); // World properties
}
World Types
World world = getCurrentWorld ();
EnumSet < WorldType > types = world . getTypes ();
if ( types . contains ( WorldType . MEMBERS )) {
// Members world
}
if ( types . contains ( WorldType . PVP )) {
// PvP world
}
if ( types . contains ( WorldType . SKILL_TOTAL )) {
// Skill total world
}
if ( types . contains ( WorldType . LEAGUE )) {
// League world
}
Getting Current World
// Get current world number
int currentWorldId = client . getWorld ();
// Find World object
World currentWorld = null ;
for ( World world : client . getWorldList ()) {
if ( world . getId () == currentWorldId) {
currentWorld = world;
break ;
}
}
if (currentWorld != null ) {
EnumSet < WorldType > types = client . getWorldType ();
// or: types = currentWorld.getTypes();
}
World Hopping
// Open world hopper interface
client . openWorldHopper ();
// Hop to specific world
for ( World world : client . getWorldList ()) {
if ( world . getId () == 301 ) {
client . hopToWorld (world);
break ;
}
}
// Create a World object
World world = client . createWorld ();
world . setId ( 301 );
world . setAddress ( "oldschool1.runescape.com" );
client . changeWorld (world);
Example: Scene Walker
public void walkScene () {
WorldView worldView = client . getTopLevelWorldView ();
Scene scene = worldView . getScene ();
Tile [][][] tiles = scene . getTiles ();
int plane = worldView . getPlane ();
// Walk all tiles on current plane
for ( int x = 0 ; x < Constants . SCENE_SIZE ; x ++ ) {
for ( int y = 0 ; y < Constants . SCENE_SIZE ; y ++ ) {
Tile tile = tiles[plane][x][y];
if (tile == null ) continue ;
// Get world location
WorldPoint worldLoc = tile . getWorldLocation ();
// Check tile objects
GameObject [] gameObjects = tile . getGameObjects ();
for ( GameObject obj : gameObjects) {
if (obj != null ) {
int id = obj . getId ();
// Process object
}
}
// Check ground object
GroundObject groundObj = tile . getGroundObject ();
if (groundObj != null ) {
// Process ground object
}
// Check wall object
WallObject wall = tile . getWallObject ();
if (wall != null ) {
// Process wall
}
// Check decorative object
DecorativeObject decor = tile . getDecorativeObject ();
if (decor != null ) {
// Process decoration
}
}
}
}
Example: Collision Detection
public boolean canWalkTo ( WorldPoint dest) {
WorldView worldView = client . getTopLevelWorldView ();
CollisionData [] collisionMaps = worldView . getCollisionMaps ();
if (collisionMaps == null ) {
return false ;
}
int plane = dest . getPlane ();
if (plane < 0 || plane >= collisionMaps . length ) {
return false ;
}
CollisionData collisionData = collisionMaps[plane];
if (collisionData == null ) {
return false ;
}
// Convert to scene coordinates
int sceneX = dest . getX () - worldView . getBaseX ();
int sceneY = dest . getY () - worldView . getBaseY ();
int [][] flags = collisionData . getFlags ();
int flag = flags[sceneX][sceneY];
// Check if tile is blocked
return (flag & CollisionDataFlag . BLOCK_MOVEMENT_FULL ) == 0 ;
}
See Also
Scene and Tiles Scene and Tile interfaces