Record Class DrawEntry

java.lang.Object
java.lang.Record
com.botwithus.bot.api.draw.DrawEntry
Record Components:
key - the command's key within its connection
kind - the primitive, or null if this build does not know the name the producer used
space - coordinate space
color - packed 0xAARRGGBB
thickness - stroke width
z - draw order
isFilled - filled rather than stroked
isClosed - polyline closed
geometry - the command's four raw geometry slots, as the producer stores them
isResolved - whether the producer currently holds a screen position for what this command marks. Permanently false, and harmless, for a screen-space primitive; a health bit only for a component highlight and for world-space commands, entity and tile highlights included. See the class javadoc before branching on it
rect - the last resolved rect [x, y, w, h], in layout units
remainingTtlMs - milliseconds left, or -1 for no expiry
text - the words this entry draws. Populated for a DrawKind.TEXT entry and — since the producer gained captions — for a DrawKind.COMPONENT entry too, where it carries the highlight's label. Empty when the entry has no caption. A fixed-point caption arrives already formatted, because the producer does the formatting and this wire has no float to send back.
font - the style the caption is drawn in; DrawFont.NORMAL when the entry has no caption

public record DrawEntry(String key, DrawKind kind, DrawSpace space, int color, int thickness, int z, boolean isFilled, boolean isClosed, List<Integer> geometry, boolean isResolved, List<Integer> rect, long remainingTtlMs, String text, DrawFont font) extends Record
One retained draw command as the producer currently holds it.

Answered by Draw.list(). This is the producer's view, not an echo of what you sent, and two fields make that difference load-bearing:

  • remainingTtlMs() is what is left, not what you asked for. Round-tripping a TTL through this is not symmetric — a command sent with ttl(3000) reports something under 3000 a moment later, and -1 when it was sent with DrawLimits.TTL_UNTIL_CLEARED.
  • rect() on a DrawKind.COMPONENT entry is the last rect the game thread resolved, in the client's layout units rather than surface pixels — the same units get_component reports. Anyone comparing it against a screenshot needs to know the producer scales it by surface/layout before drawing. It is meaningful only when isResolved().

isResolved() means two different things and this row does not say which. Read it against kind() and space(), never on its own:

  • For a screen-space primitive — a rect, line, ellipse, poly or text in DrawSpace.SCREEN — it is permanently false, and the command is perfectly fine. Nothing was resolved because nothing needed resolving: the coordinates were already pixels. A consumer that reads false here as "my drawing is broken" will be wrong about every screen command it ever sends.
  • For a component highlight, and for anything in DrawSpace.WORLD — which includes every DrawKind.ENTITY and DrawKind.TILE row, since the semantic highlights are world-space by construction — it is a health bit. false means the producer has no usable screen position for what the command marks: no scene, no window, behind the camera, or a plane it cannot height. Nothing is drawn, and rect() is zeroed rather than left holding the last good value, so a stale-but-plausible rectangle can never be read back at the moment a marker goes invalid.

Two further traps on the world side. isResolved() == true does not promise a paintable area — a footprint far enough away that all four projected corners round to one pixel, and every text command, legitimately report a zero extent — so code that needs somewhere to draw must check the extent, not only the flag. And the flag cannot distinguish "outside the viewport but real and clampable" from "behind the camera, no usable position exists"; the producer's project field carries that distinction in five states and this record does not surface it yet.

  • Field Details

    • NO_EXPIRY

      public static final long NO_EXPIRY
      Milliseconds reported for a command that never expires.
      See Also:
  • Constructor Details

    • DrawEntry

      public DrawEntry(String key, DrawKind kind, DrawSpace space, int color, int thickness, int z, boolean isFilled, boolean isClosed, List<Integer> geometry, boolean isResolved, List<Integer> rect, long remainingTtlMs, String text, DrawFont font)
      Creates an instance of a DrawEntry record class.
      Parameters:
      key - the value for the key record component
      kind - the value for the kind record component
      space - the value for the space record component
      color - the value for the color record component
      thickness - the value for the thickness record component
      z - the value for the z record component
      isFilled - the value for the isFilled record component
      isClosed - the value for the isClosed record component
      geometry - the value for the geometry record component
      isResolved - the value for the isResolved record component
      rect - the value for the rect record component
      remainingTtlMs - the value for the remainingTtlMs record component
      text - the value for the text record component
      font - the value for the font record component
  • Method Details

    • isPersistent

      public boolean isPersistent()
      True when this command has no expiry and lives until replaced or cleared.
    • 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.
    • key

      public String key()
      Returns the value of the key record component.
      Returns:
      the value of the key record component
    • kind

      public DrawKind kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • space

      public DrawSpace space()
      Returns the value of the space record component.
      Returns:
      the value of the space record component
    • color

      public int color()
      Returns the value of the color record component.
      Returns:
      the value of the color record component
    • thickness

      public int thickness()
      Returns the value of the thickness record component.
      Returns:
      the value of the thickness record component
    • z

      public int z()
      Returns the value of the z record component.
      Returns:
      the value of the z record component
    • isFilled

      public boolean isFilled()
      Returns the value of the isFilled record component.
      Returns:
      the value of the isFilled record component
    • isClosed

      public boolean isClosed()
      Returns the value of the isClosed record component.
      Returns:
      the value of the isClosed record component
    • geometry

      public List<Integer> geometry()
      Returns the value of the geometry record component.
      Returns:
      the value of the geometry record component
    • isResolved

      public boolean isResolved()
      Returns the value of the isResolved record component.
      Returns:
      the value of the isResolved record component
    • rect

      public List<Integer> rect()
      Returns the value of the rect record component.
      Returns:
      the value of the rect record component
    • remainingTtlMs

      public long remainingTtlMs()
      Returns the value of the remainingTtlMs record component.
      Returns:
      the value of the remainingTtlMs record component
    • text

      public String text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • font

      public DrawFont font()
      Returns the value of the font record component.
      Returns:
      the value of the font record component