Class Stat<T>

Type Parameters:
T - the type of the registry entry for this statistic

public class Stat<T> extends ObjectiveCriteria
An immutable statistic to be counted for a particular entry in the type's registry. This is used as a key in a StatsCounter for a corresponding count.

By default, the statistic's name is formatted <stat type namespace>.<stat type path>:<value namespace>.<value path>, as created by buildName(StatType, Object).

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • buildName

      public static <T> String buildName(StatType<T> pType, T pValue)
      Returns:
      the name for the specified type and value in the form <stat type namespace>.<stat type path>:<value namespace>.<value path>
    • locationToKey

      private static <T> String locationToKey(@Nullable ResourceLocation pLocation)
      Returns:
      the specified location as a string with . as the separator character
    • getType

      public StatType<T> getType()
    • getValue

      public T getValue()
    • format

      public String format(int pValue)
    • equals

      public boolean equals(Object pOther)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object