Record Class DrawCommand.Area

java.lang.Object
java.lang.Record
com.botwithus.bot.api.draw.DrawCommand.Area
Record Components:
key - the command's identity within this connection
style - colour, stroke, fill, order and lifetime
tileX - minimum-corner world tile X
tileY - minimum-corner world tile Y
widthTiles - width in tiles
heightTiles - height in tiles
plane - 0..DrawLimits.MAX_PLANE
caption - the label drawn against the resolved footprint, or DrawCaption.NONE
All Implemented Interfaces:
DrawCommand, DrawCommand.Highlight
Enclosing interface:
DrawCommand

public static record DrawCommand.Area(String key, DrawStyle style, int tileX, int tileY, int widthTiles, int heightTiles, int plane, DrawCaption caption) extends Record implements DrawCommand.Highlight
A highlight over a widthTiles by heightTiles block of ground, anchored at its minimum corner.

Everything DrawCommand.Tile says applies, including the plane-by-refusal rule: an area on a floor the local player is not standing on resolves unavailable and draws nothing.

kind() reports DrawKind.TILE rather than an area of its own, because that is what the producer stores — highlight_area and highlight_tile write one kind with different extents, so an area reads back from debug_draw_list spelled tile. Reporting a kind this host invented would make DrawEntry.kind() disagree with the producer for the same drawing.

  • Constructor Details

    • Area

      public Area(String key, DrawStyle style, int tileX, int tileY, int widthTiles, int heightTiles, int plane, DrawCaption caption)
      Creates an instance of a Area record class.
      Parameters:
      key - the value for the key record component
      style - the value for the style record component
      tileX - the value for the tileX record component
      tileY - the value for the tileY record component
      widthTiles - the value for the widthTiles record component
      heightTiles - the value for the heightTiles record component
      plane - the value for the plane record component
      caption - the value for the caption record component
  • Method Details

    • autoKey

      public static String autoKey(int tileX, int tileY, int widthTiles, int heightTiles, int plane)
      The key an area highlight gets when the caller names none: area:<x>:<y>:<w>:<h>:<plane>.

      The extent is in the key for the same reason the plane is — two areas sharing a corner at different sizes are two different regions, and a key that omitted the size would let the second silently replace the first. Worst case is 32 bytes, inside DrawLimits.MAX_KEY_BYTES.

    • kind

      public DrawKind kind()
      Description copied from interface: DrawCommand
      The primitive this command draws.
      Specified by:
      kind in interface DrawCommand
    • 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.
      Specified by:
      key in interface DrawCommand
      Returns:
      the value of the key record component
    • style

      public DrawStyle style()
      Returns the value of the style record component.
      Specified by:
      style in interface DrawCommand
      Returns:
      the value of the style record component
    • tileX

      public int tileX()
      Returns the value of the tileX record component.
      Returns:
      the value of the tileX record component
    • tileY

      public int tileY()
      Returns the value of the tileY record component.
      Returns:
      the value of the tileY record component
    • widthTiles

      public int widthTiles()
      Returns the value of the widthTiles record component.
      Returns:
      the value of the widthTiles record component
    • heightTiles

      public int heightTiles()
      Returns the value of the heightTiles record component.
      Returns:
      the value of the heightTiles record component
    • plane

      public int plane()
      Returns the value of the plane record component.
      Returns:
      the value of the plane record component
    • caption

      public DrawCaption caption()
      Returns the value of the caption record component.
      Specified by:
      caption in interface DrawCommand.Highlight
      Returns:
      the value of the caption record component