Enum Class EntityRef
- All Implemented Interfaces:
Serializable, Comparable<EntityRef>, Constable
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasIndex()Whether this reference is completed by a server index.static EntityRefReturns the enum constant of this class with the specified name.static EntityRef[]values()Returns an array containing the constants of this enum class, in the order they are declared.wireName()The lower-case token this reference is spelled as — both as thehighlight_entityparameter name and as the auto key's prefix.Methods inherited from class Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
NPC
An NPC, by its server-side NPC slot. -
PLAYER
Another player, by its server-side player slot. -
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
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
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 nameNullPointerException- if the argument is null
-
wireName
The lower-case token this reference is spelled as — both as thehighlight_entityparameter name and as the auto key's prefix. -
hasIndex
public boolean hasIndex()Whether this reference is completed by a server index. False forSELFonly.
-