Class GroundItem

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

public final class GroundItem extends Object implements Locatable, Identifiable, Nameable, Interactable
Immutable ground-item stack snapshot.
  • Constructor Details

    • GroundItem

      public GroundItem(int id, int amount, String name, Tile tile)
      Creates an immutable scene snapshot of a ground-item stack.
      Parameters:
      id - item definition identifier
      amount - stack amount
      name - captured display name, possibly blank
      tile - world location
  • Method Details

    • getId

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

      public int getAmount()
      Returns the captured stack amount.
      Returns:
      stack amount captured in this snapshot
    • getName

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

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

      public boolean interact(int action)
      Dispatches a raw ground-item action opcode.
      Specified by:
      interact in interface Interactable
      Parameters:
      action - native action opcode
      Returns:
      true when the runtime accepted the action
    • interact

      public boolean interact(GroundItemAction action)
      Dispatches a typed ground-item menu action.
      Parameters:
      action - action to dispatch
      Returns:
      true when accepted; verify inventory or scene state for completion
    • toString

      public String toString()
      Overrides:
      toString in class Object