Record Class Npc

java.lang.Object
java.lang.Record
com.botwithus.bot.api.snapshot.Npc
Record Components:
serverIndex - server-side NPC slot
typeId - NPC type id, or -1 if not resolved
tileX - absolute world tile X
tileY - absolute world tile Y
plane - 0..3
flags - bitset; bit 0 = moving (see isMoving())
followingIndex - server index of the follow target, or -1
animationId - current animation id, or -1
stanceId - current stance id
hp - current HP
maxHp - max HP
spotAnimId - first active spot anim (graphic) id, or -1 if none
orientation - rendered facing (wire v21); Orientation.unknown() when not read

public record Npc(int serverIndex, int typeId, int tileX, int tileY, int plane, int flags, int followingIndex, int animationId, int stanceId, int hp, int maxHp, int spotAnimId, Orientation orientation) extends Record
Snapshot of one NPC at the producer's current tick.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Npc(int serverIndex, int typeId, int tileX, int tileY, int plane, int flags, int followingIndex, int animationId, int stanceId, int hp, int maxHp, int spotAnimId)
    Builds a row with an unknown facing; kept so pre-v21 callers compile unchanged.
    Npc(int serverIndex, int typeId, int tileX, int tileY, int plane, int flags, int followingIndex, int animationId, int stanceId, int hp, int maxHp, int spotAnimId, Orientation orientation)
    Creates an instance of a Npc record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the animationId record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the flags record component.
    int
    Returns the value of the followingIndex record component.
    final int
    Returns a hash code value for this object.
    int
    hp()
    Returns the value of the hp record component.
    boolean
     
    int
    Returns the value of the maxHp record component.
    Returns the value of the orientation record component.
    int
    Returns the value of the plane record component.
    int
    Returns the value of the serverIndex record component.
    int
    Returns the value of the spotAnimId record component.
    int
    Returns the value of the stanceId record component.
    int
    Returns the value of the tileX record component.
    int
    Returns the value of the tileY record component.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the typeId record component.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Npc

      public Npc(int serverIndex, int typeId, int tileX, int tileY, int plane, int flags, int followingIndex, int animationId, int stanceId, int hp, int maxHp, int spotAnimId)
      Builds a row with an unknown facing; kept so pre-v21 callers compile unchanged.
    • Npc

      public Npc(int serverIndex, int typeId, int tileX, int tileY, int plane, int flags, int followingIndex, int animationId, int stanceId, int hp, int maxHp, int spotAnimId, Orientation orientation)
      Creates an instance of a Npc record class.
      Parameters:
      serverIndex - the value for the serverIndex record component
      typeId - the value for the typeId record component
      tileX - the value for the tileX record component
      tileY - the value for the tileY record component
      plane - the value for the plane record component
      flags - the value for the flags record component
      followingIndex - the value for the followingIndex record component
      animationId - the value for the animationId record component
      stanceId - the value for the stanceId record component
      hp - the value for the hp record component
      maxHp - the value for the maxHp record component
      spotAnimId - the value for the spotAnimId record component
      orientation - the value for the orientation record component
  • Method Details

    • isMoving

      public boolean isMoving()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • serverIndex

      public int serverIndex()
      Returns the value of the serverIndex record component.
      Returns:
      the value of the serverIndex record component
    • typeId

      public int typeId()
      Returns the value of the typeId record component.
      Returns:
      the value of the typeId record component
    • tileX

      public int tileX()
      Returns the value of the tileX record component.
      Returns:
      the value of the tileX record component
    • tileY

      public int tileY()
      Returns the value of the tileY record component.
      Returns:
      the value of the tileY record component
    • plane

      public int plane()
      Returns the value of the plane record component.
      Returns:
      the value of the plane record component
    • flags

      public int flags()
      Returns the value of the flags record component.
      Returns:
      the value of the flags record component
    • followingIndex

      public int followingIndex()
      Returns the value of the followingIndex record component.
      Returns:
      the value of the followingIndex record component
    • animationId

      public int animationId()
      Returns the value of the animationId record component.
      Returns:
      the value of the animationId record component
    • stanceId

      public int stanceId()
      Returns the value of the stanceId record component.
      Returns:
      the value of the stanceId record component
    • hp

      public int hp()
      Returns the value of the hp record component.
      Returns:
      the value of the hp record component
    • maxHp

      public int maxHp()
      Returns the value of the maxHp record component.
      Returns:
      the value of the maxHp record component
    • spotAnimId

      public int spotAnimId()
      Returns the value of the spotAnimId record component.
      Returns:
      the value of the spotAnimId record component
    • orientation

      public Orientation orientation()
      Returns the value of the orientation record component.
      Returns:
      the value of the orientation record component