Class SimulationSnapshot


  • public final class SimulationSnapshot
    extends java.lang.Object
    Immutable snapshot used as the input payload for simulation.
    • Constructor Detail

      • SimulationSnapshot

        public SimulationSnapshot​(int gameTick,
                                  int plane,
                                  int baseX,
                                  int baseY,
                                  int[][] collisionFlags,
                                  @NonNull
                                  @NonNull SimulationPlayerSnapshot player,
                                  java.util.List<SimulationNpcSnapshot> npcs)
        Creates a snapshot from collision, player, and npc input.
        Parameters:
        gameTick - client game tick at capture.
        plane - current plane.
        baseX - world base x for the collision array.
        baseY - world base y for the collision array.
        collisionFlags - scene collision map indexed as [sceneX][sceneY].
        player - player snapshot.
        npcs - npc position snapshots.
    • Method Detail

      • getSceneWidth

        public int getSceneWidth()
        Returns:
        scene width in tiles.
      • getSceneHeight

        public int getSceneHeight()
        Returns:
        scene height in tiles.
      • isSceneInBounds

        public boolean isSceneInBounds​(int sceneX,
                                       int sceneY)
        Checks whether scene coordinates are in the captured collision area.
        Parameters:
        sceneX - scene x coordinate.
        sceneY - scene y coordinate.
        Returns:
        true when the tile is in bounds.
      • isWorldInBounds

        public boolean isWorldInBounds​(int worldX,
                                       int worldY)
        Checks whether a world tile is in the captured collision area.
        Parameters:
        worldX - world x coordinate.
        worldY - world y coordinate.
        Returns:
        true when the tile is in bounds.
      • getCollisionFlagAtScene

        public int getCollisionFlagAtScene​(int sceneX,
                                           int sceneY)
        Reads collision flags by scene coordinate.
        Parameters:
        sceneX - scene x coordinate.
        sceneY - scene y coordinate.
        Returns:
        collision flags, or 0 if out of bounds.
      • getCollisionFlagAtWorld

        public int getCollisionFlagAtWorld​(int worldX,
                                           int worldY)
        Reads collision flags by world coordinate.
        Parameters:
        worldX - world x coordinate.
        worldY - world y coordinate.
        Returns:
        collision flags, or 0 if out of bounds.
      • copyCollisionFlags

        public int[][] copyCollisionFlags()
        Returns:
        deep copy of the collision map.
      • getPlayerWorldPoint

        public net.runelite.api.coords.WorldPoint getPlayerWorldPoint()
        Returns:
        player world point from this snapshot.
      • createState

        public SimulationState createState()
        Creates a mutable root state using default npc profiles.
        Returns:
        root simulation state.
      • collisionFlagsUnsafe

        public int[][] collisionFlagsUnsafe()