Interface TileContainer
This interface provides low-level access to the tile cache, which maintains
wrapped ITile instances for all tiles in the current world view. The
scene is organized as a 3D grid where tiles are indexed by their X, Y coordinates
and plane (height level).
The container manages the complete tile grid for the loaded scene, typically 104x104 tiles per plane with 4 planes (0-3). It is updated on game state changes and each game tick to keep the cache synchronized with the actual game scene.
For most use cases, prefer using ITiles which
provides a higher-level API with additional querying capabilities.
Example usage:
// Get a tile at scene coordinates on the current plane
ITile tile = tileContainer.getAt(50, 50);
// Get a tile at specific coordinates and plane
ITile upperTile = tileContainer.getAt(50, 50, 1);
// Get all tiles for the current plane
ITile[][] tiles = tileContainer.getAll();
// Get all tiles for all planes
ITile[][][] allFloors = tileContainer.getAllFloors();
// Get scene dimensions
int width = tileContainer.getSizeX();
int height = tileContainer.getSizeY();
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionITile[][]getAll()Gets the 2D array of tiles for the current plane.ITile[][][]Gets the 3D array of tiles for all planes.getAt(int x, int y) Gets the tile at the specified scene coordinates on the current plane.getAt(int x, int y, int z) Gets the tile at the specified scene coordinates and plane.intgetSizeX()Gets the width of the scene in tiles.intgetSizeY()Gets the height of the scene in tiles.intGets the world view ID for this tile container.
-
Method Details
-
getAt
Gets the tile at the specified scene coordinates on the current plane.The coordinates are scene-local (not world coordinates) and range from 0 to the scene size minus one (typically 0-103). The current plane is determined by the player's current height level.
- Parameters:
x- the X coordinate in scene space (0 to sizeX - 1)y- the Y coordinate in scene space (0 to sizeY - 1)- Returns:
- the tile at the specified coordinates, or null if out of bounds
-
getAt
Gets the tile at the specified scene coordinates and plane.The coordinates are scene-local (not world coordinates) and range from 0 to the scene size minus one. The plane (z) represents the height level, typically ranging from 0 (ground level) to 3.
- Parameters:
x- the X coordinate in scene space (0 to sizeX - 1)y- the Y coordinate in scene space (0 to sizeY - 1)z- the plane/height level (typically 0-3)- Returns:
- the tile at the specified coordinates, or null if out of bounds
-
getAll
ITile[][] getAll()Gets the 2D array of tiles for the current plane.Returns a direct reference to the internal tile array for the current height level. The array is indexed as [x][y], with dimensions typically [104][104] for a full scene.
Note: The returned array should not be modified directly.
- Returns:
- the 2D tile array for the current plane, indexed as [x][y]
-
getAllFloors
ITile[][][] getAllFloors()Gets the 3D array of tiles for all planes.Returns a direct reference to the internal tile array for all height levels. The array is indexed as [z][x][y], with dimensions typically [4][104][104] where:
- First dimension (z) is the plane (0-3)
- Second dimension (x) is the X coordinate
- Third dimension (y) is the Y coordinate
Note: The returned array should not be modified directly.
- Returns:
- the 3D tile array for all planes, indexed as [plane][x][y]
-
getSizeX
int getSizeX()Gets the width of the scene in tiles.For a standard scene, this is typically 104 tiles.
- Returns:
- the scene width in tiles
-
getSizeY
int getSizeY()Gets the height of the scene in tiles.For a standard scene, this is typically 104 tiles.
- Returns:
- the scene height in tiles
-
getWorldViewId
int getWorldViewId()Gets the world view ID for this tile container.The world view ID identifies which world view this tile container belongs to. This is primarily relevant in instanced areas where multiple world views may exist simultaneously, such as in certain minigames or instances.
- Returns:
- the world view ID for this tile container
-