IStatFormatter - friendlyhj/ZenUtils GitHub Wiki

IStatFormatter

An IStatFormatter describes how to display stat amount to Statistics menu.

Importing the package

You'd better import the package to avoid errors and write script easier.

Class Name: mods.zenutils.IStatFormatter

Parameters

The IStatFormatter is a function interface. It has an int parameter and requires a string return value for display text.

Pre-Registered IStatFormatter

These below are pre-registered IStatFormatters by zenutils. You can call these method to get them. For example: IStatFormatter.time().

  • simple: display an integer with digit group separators. This is the default behavior.
  • time: display as time format
  • distance: display as length units
  • divideByTen: divides the value by ten and displays then

Utility Methods

The following methods can be used in custom formatter.

Formats an integer with digit group separators. Returns a string

IStatFormatter.numberFormat(int amount);

Formats a decimal with 2 decimal digits.

IStatFormatter.decimalFormat(double amount);

⚠️ **GitHub.com Fallback** ⚠️