Record Class DrawCommand.Entity
- Record Components:
key- the command's identity within this connectionstyle- colour, stroke, fill, order and lifetimeref- which listserverIndexindexesserverIndex- the entity's server-side slot; normalised to0forEntityRef.SELF, which carries no index because the producer re-resolves the local player's slot every tickwidthTiles- footprint width in tiles, not sub-tilesheightTiles- footprint height in tilescaption- the label drawn against the resolved box, orDrawCaption.NONE
- All Implemented Interfaces:
DrawCommand, DrawCommand.Highlight
- Enclosing interface:
DrawCommand
Carries no coordinates. The producer keeps (ref, serverIndex) and
re-reads the entity's position on the game thread every tick, so the box
follows a walking NPC instead of staying where the NPC was when the call was
made. It reads the fractional scene position rather than the truncated
tile, so it tracks smoothly rather than jumping a tile at a time, and the
footprint is centred on the entity.
This is the one world kind with no height approximation in it, and that
is why it exists. Every other world command is drawn at the local player's
own elevation, because that is the producer's only ground-height source — so a
command naming a different plane resolves unavailable rather than
being drawn convincingly wrong on the player's floor (see DrawCommand.Tile). An
entity carries its own height, so an entity highlight needs no plane, is
exempt from that refusal, and is exact upstairs, on a slope and on a
staircase. It is the recommended way to mark anything that moves.
-
Nested Class Summary
Nested classes/interfaces inherited from interface DrawCommand
DrawCommand.Area, DrawCommand.ComponentTarget, DrawCommand.Ellipse, DrawCommand.Entity, DrawCommand.Highlight, DrawCommand.Line, DrawCommand.Poly, DrawCommand.Primitive, DrawCommand.Rect, DrawCommand.Text, DrawCommand.Tile -
Constructor Summary
ConstructorsConstructorDescriptionEntity(String key, DrawStyle style, EntityRef ref, int serverIndex, int widthTiles, int heightTiles, DrawCaption caption) Creates an instance of aEntityrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringThe key an entity highlight gets when the caller names none:npc:<index>,player:<index>, or bareself.caption()Returns the value of thecaptionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of theheightTilesrecord component.key()Returns the value of thekeyrecord component.kind()The primitive this command draws.ref()Returns the value of therefrecord component.intReturns the value of theserverIndexrecord component.style()Returns the value of thestylerecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thewidthTilesrecord component.Methods inherited from interface DrawCommand.Highlight
space
-
Constructor Details
-
Entity
public Entity(String key, DrawStyle style, EntityRef ref, int serverIndex, int widthTiles, int heightTiles, DrawCaption caption) Creates an instance of aEntityrecord class.- Parameters:
key- the value for thekeyrecord componentstyle- the value for thestylerecord componentref- the value for therefrecord componentserverIndex- the value for theserverIndexrecord componentwidthTiles- the value for thewidthTilesrecord componentheightTiles- the value for theheightTilesrecord componentcaption- the value for thecaptionrecord component
-
-
Method Details
-
autoKey
The key an entity highlight gets when the caller names none:npc:<index>,player:<index>, or bareself.Decimal, no padding, and no trailing field — the entity is the identity. Two highlights on one NPC with different footprints or colours are the same highlight restyled, and a key that replaces is the right answer;
selfcarries no index because the local player does not have a stable one.That format is the producer's contract and it exists so a caller who omitted a key still has a way to name the highlight in order to clear it. Computed here rather than read back, so
DrawBuilder.submit()can answer the key before the round-trip — and asserted against the producer by a live test rather than assumed. -
kind
Description copied from interface:DrawCommandThe primitive this command draws.- Specified by:
kindin interfaceDrawCommand
-
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. -
key
Returns the value of thekeyrecord component.- Specified by:
keyin interfaceDrawCommand- Returns:
- the value of the
keyrecord component
-
style
Returns the value of thestylerecord component.- Specified by:
stylein interfaceDrawCommand- Returns:
- the value of the
stylerecord component
-
ref
-
serverIndex
public int serverIndex()Returns the value of theserverIndexrecord component.- Returns:
- the value of the
serverIndexrecord component
-
widthTiles
public int widthTiles()Returns the value of thewidthTilesrecord component.- Returns:
- the value of the
widthTilesrecord component
-
heightTiles
public int heightTiles()Returns the value of theheightTilesrecord component.- Returns:
- the value of the
heightTilesrecord component
-
caption
Returns the value of thecaptionrecord component.- Specified by:
captionin interfaceDrawCommand.Highlight- Returns:
- the value of the
captionrecord component
-