Record Class StyleTable

java.lang.Object
java.lang.Record
cromveil.combatnumbers.styles.StyleTable

public record StyleTable(List<net.minecraft.resources.Identifier> skinIds, List<net.minecraft.resources.Identifier> animationIds) extends Record
The finite, ordered set of skin and animation ids the server's rules can emit. The server builds this from the RuleEngine after a styles syncs it to clients. We then reference entries by index instead of sending full ids, keeping packets lean.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final StyleTable
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    StyleTable(List<net.minecraft.resources.Identifier> skinIds, List<net.minecraft.resources.Identifier> animationIds)
    Creates an instance of a StyleTable record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.resources.Identifier
    animationAt(int index)
     
    List<net.minecraft.resources.Identifier>
    Returns the value of the animationIds record component.
    int
    animationIndex(net.minecraft.resources.Identifier id)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    static StyleTable
    from(RuleEngine engine)
     
    final int
    Returns a hash code value for this object.
    net.minecraft.resources.Identifier
    skinAt(int index)
     
    List<net.minecraft.resources.Identifier>
    Returns the value of the skinIds record component.
    int
    skinIndex(net.minecraft.resources.Identifier id)
     
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • StyleTable

      public StyleTable(List<net.minecraft.resources.Identifier> skinIds, List<net.minecraft.resources.Identifier> animationIds)
      Creates an instance of a StyleTable record class.
      Parameters:
      skinIds - the value for the skinIds record component
      animationIds - the value for the animationIds record component
  • Method Details

    • from

      public static StyleTable from(RuleEngine engine)
    • skinIndex

      public int skinIndex(net.minecraft.resources.Identifier id)
      Returns:
      index of the id, or -1 if absent/null (meaning "no opinion").
    • animationIndex

      public int animationIndex(net.minecraft.resources.Identifier id)
      See Also:
    • skinAt

      public net.minecraft.resources.Identifier skinAt(int index)
      Returns:
      the id at the index, or null if out of range.
    • animationAt

      public net.minecraft.resources.Identifier animationAt(int index)
      See Also:
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • skinIds

      public List<net.minecraft.resources.Identifier> skinIds()
      Returns the value of the skinIds record component.
      Returns:
      the value of the skinIds record component
    • animationIds

      public List<net.minecraft.resources.Identifier> animationIds()
      Returns the value of the animationIds record component.
      Returns:
      the value of the animationIds record component