Enum Class EntityRef

java.lang.Object
java.lang.Enum<EntityRef>
com.botwithus.bot.api.draw.EntityRef
All Implemented Interfaces:
Serializable, Comparable<EntityRef>, Constable

public enum EntityRef extends Enum<EntityRef>
Which list a highlighted entity's index belongs to.

highlight_entity takes exactly one of npc, player or self: two is an error and none is an error, because "which one wins" is not a rule a caller could guess from a reply that succeeded. An index alone is ambiguous — npc 42 and player 42 are different entities in different lists — so the reference is the pair, and this enum is the half that says which list.

SELF carries no index, deliberately. The local player's list slot is re-resolved by the producer every tick, so a stored slot would point at whoever took the seat after a world hop. hasIndex() is what the encoder and the auto-key formatter both branch on rather than each spelling the rule again.

One name, two jobs, and that is true on the wire rather than a shortcut taken here. wireName() is both the parameter the producer reads the reference from and the prefix of the key it generates when the caller names none — npc:42, player:7, self. Mirrors overlay::EntityKind in NXTLibrary/src/overlay/DrawTypes.h and the prefix Handle_HighlightEntity formats.

  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    An NPC, by its server-side NPC slot.
    Another player, by its server-side player slot.
    The local player, with no index at all — the producer re-resolves the slot every tick so the highlight survives a world hop.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Whether this reference is completed by a server index.
    static EntityRef
    Returns the enum constant of this class with the specified name.
    static EntityRef[]
    Returns an array containing the constants of this enum class, in the order they are declared.
    The lower-case token this reference is spelled as — both as the highlight_entity parameter name and as the auto key's prefix.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • NPC

      public static final EntityRef NPC
      An NPC, by its server-side NPC slot.
    • PLAYER

      public static final EntityRef PLAYER
      Another player, by its server-side player slot.
    • SELF

      public static final EntityRef SELF
      The local player, with no index at all — the producer re-resolves the slot every tick so the highlight survives a world hop.
  • Method Details

    • values

      public static EntityRef[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static EntityRef valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • wireName

      public String wireName()
      The lower-case token this reference is spelled as — both as the highlight_entity parameter name and as the auto key's prefix.
    • hasIndex

      public boolean hasIndex()
      Whether this reference is completed by a server index. False for SELF only.