Class SceneObject

java.lang.Object
com.valhalla.sdk.api.entities.SceneObject
All Implemented Interfaces:
GameObject, Identifiable, Interactable, Locatable, Nameable

public final class SceneObject extends Object implements GameObject
Immutable scene-object snapshot backed by the native action API.
  • Field Details

    • NO_ANIMATION

      public static final int NO_ANIMATION
      Sentinel for a static object or a client without scene-object-animation.
      See Also:
  • Constructor Details

    • SceneObject

      public SceneObject(int id, String name, Tile tile)
      Creates an object snapshot without a decoded scene-container type.
      Parameters:
      id - object definition identifier
      name - captured object name, possibly blank
      tile - world location
    • SceneObject

      public SceneObject(int id, String name, Tile tile, int type)
      Creates an immutable object snapshot.
      Parameters:
      id - object definition identifier
      name - captured object name, possibly blank
      tile - world location
      type - native scene container: 0 boundary, 1 wall decoration, 2 game object, 3 floor decoration, or -1 when unresolved
    • SceneObject

      public SceneObject(int id, String name, Tile tile, int type, ObjectDefinition definition)
      Creates an immutable object snapshot with revision-pinned cache metadata.
      Parameters:
      id - object definition identifier
      name - captured object name, possibly blank
      tile - world location
      type - native scene container: 0 boundary, 1 wall decoration, 2 game object, 3 floor decoration, or -1 when unresolved
      definition - revision-pinned cache definition, or null when unavailable
    • SceneObject

      public SceneObject(int id, String name, Tile tile, int type, ObjectDefinition definition, int animation)
      Creates a snapshot that also carries the object's current animation.
      Parameters:
      id - object definition identifier
      name - captured object name, possibly blank
      tile - world location
      type - native scene container
      definition - revision-pinned cache definition, or null
      animation - current sequence id of an animated (dynamic) object, or NO_ANIMATION for a static object or an unsupported client
  • Method Details

    • getAnimation

      public int getAnimation()
      Returns the current animation (sequence) id of a dynamic scene object.

      Static objects and clients without the scene-object-animation capability report NO_ANIMATION.

      Returns:
      current sequence id, or NO_ANIMATION
    • isAnimating

      public boolean isAnimating(int sequenceId)
      Returns true when this object currently plays the given sequence.
      Returns:
      true when this object currently plays the given sequence
    • getId

      public int getId()
      Returns the object definition identifier.
      Specified by:
      getId in interface Identifiable
      Returns:
      object definition identifier
    • getName

      public String getName()
      Returns the captured object name.
      Specified by:
      getName in interface Nameable
      Returns:
      captured object name, possibly blank
    • hasDefinition

      public boolean hasDefinition()
      Reports whether revision-pinned cache metadata was resolved.
      Returns:
      whether this snapshot carries an object definition
    • getDefinition

      public Optional<ObjectDefinition> getDefinition()
      Returns the revision-pinned cache metadata captured for this object ID.
      Returns:
      cache definition, or empty when this payload has no matching definition
    • getType

      public int getType()
      Returns the native scene container category.
      Returns:
      0 boundary, 1 wall decoration, 2 game object, 3 floor decoration, or -1 when unresolved
    • getTile

      public Tile getTile()
      Returns the object's captured location.
      Specified by:
      getTile in interface Locatable
      Returns:
      object world tile
    • interact

      public boolean interact(int action)
      Dispatches a raw object action opcode.
      Specified by:
      interact in interface Interactable
      Parameters:
      action - native action opcode
      Returns:
      true when accepted; verify scene/player state for completion
    • toString

      public String toString()
      Overrides:
      toString in class Object