Record Class Npc
java.lang.Object
java.lang.Record
com.botwithus.bot.api.snapshot.Npc
- Record Components:
serverIndex- server-side NPC slottypeId- NPC type id, or-1if not resolvedtileX- absolute world tile XtileY- absolute world tile Yplane-0..3flags- bitset; bit 0 = moving (seeisMoving())followingIndex- server index of the follow target, or-1animationId- current animation id, or-1stanceId- current stance idhp- current HPmaxHp- max HPspotAnimId- first active spot anim (graphic) id, or-1if noneorientation- 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
ConstructorsConstructorDescriptionNpc(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 aNpcrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theanimationIdrecord component.final booleanIndicates whether some other object is "equal to" this one.intflags()Returns the value of theflagsrecord component.intReturns the value of thefollowingIndexrecord component.final inthashCode()Returns a hash code value for this object.inthp()Returns the value of thehprecord component.booleanisMoving()intmaxHp()Returns the value of themaxHprecord component.Returns the value of theorientationrecord component.intplane()Returns the value of theplanerecord component.intReturns the value of theserverIndexrecord component.intReturns the value of thespotAnimIdrecord component.intstanceId()Returns the value of thestanceIdrecord component.inttileX()Returns the value of thetileXrecord component.inttileY()Returns the value of thetileYrecord component.final StringtoString()Returns a string representation of this record class.inttypeId()Returns the value of thetypeIdrecord component.
-
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 aNpcrecord class.- Parameters:
serverIndex- the value for theserverIndexrecord componenttypeId- the value for thetypeIdrecord componenttileX- the value for thetileXrecord componenttileY- the value for thetileYrecord componentplane- the value for theplanerecord componentflags- the value for theflagsrecord componentfollowingIndex- the value for thefollowingIndexrecord componentanimationId- the value for theanimationIdrecord componentstanceId- the value for thestanceIdrecord componenthp- the value for thehprecord componentmaxHp- the value for themaxHprecord componentspotAnimId- the value for thespotAnimIdrecord componentorientation- the value for theorientationrecord component
-
-
Method Details
-
isMoving
public boolean isMoving() -
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
serverIndex
public int serverIndex()Returns the value of theserverIndexrecord component.- Returns:
- the value of the
serverIndexrecord component
-
typeId
-
tileX
-
tileY
-
plane
-
flags
-
followingIndex
public int followingIndex()Returns the value of thefollowingIndexrecord component.- Returns:
- the value of the
followingIndexrecord component
-
animationId
public int animationId()Returns the value of theanimationIdrecord component.- Returns:
- the value of the
animationIdrecord component
-
stanceId
-
hp
-
maxHp
-
spotAnimId
public int spotAnimId()Returns the value of thespotAnimIdrecord component.- Returns:
- the value of the
spotAnimIdrecord component
-
orientation
Returns the value of theorientationrecord component.- Returns:
- the value of the
orientationrecord component
-