Stat indicators

Stat indicators are used to show additional information on statbars, but they're handled as separate resources to make it easier to add indicators to existing stat bars. JSON definitions for the indicators are loaded from resources/tetra/stat_indicators/ in a resourcepack (not a datapack!), and they're typically organized into folders depending on the stat bar they belong to.

Stat indicator

Stat indicators are typically small glyphs displayed above stat bars to indicate that something related to the stat is being modified. Indicators present for a stat bar also add to the tooltip of the stat bar.

Format:
typeoptionalstring

There's only one type registered in vanilla tetra, but this can be set if some other mod has registered other indicator types.

keystring

The localization key for the indicator, the localized value will be used as a header and a body in the tooltip. The key for the body is this key suffixed with ".tooltip". Tetra uses keys like this: 'tetra.stats.sharpness'.

textureResource location

A resource location referencing a texture. The glyph used by the indicator is 8x8 px. The texture probably has to be 256x256.

textureXnumber

The x coordinate of the glyphs within the texture sheet.

textureYnumber

The y coordinate of the glyphs within the texture sheet.

statStat getter

The stat that the indicator represents. The indicator will be displayed if the getter "should show" (which typically means its stat is not 0). The indicator receives a change highlight when the getter value changes.

tooltipTooltip getter

The tooltip for the indicator, this is appended to the tooltip of the stat bar.

Example:
{
  "key": "tetra.stats.sharpness",
  "texture": "tetra:textures/gui/glyphs.png",
  "textureX": 136,
  "textureY": 160,
  "stat": {
    "type": "tetra:sum",
    "stats": [
      {
        "type": "tetra:multiply",
        "stats": [
          {
            "type": "tetra:enchantment",
            "enchantment": "minecraft:sharpness"
          }
        ],
        "factor": 0.5
      }
    ],
    "offset": 0.5
  },
  "tooltip": {
    "type": "tetra:default",
    "key": "tetra.stats.sharpness.tooltip",
    "stats": [
      {
        "type": "tetra:sum",
        "stats": [
          {
            "type": "tetra:multiply",
            "stats": [
              {
                "type": "tetra:enchantment",
                "enchantment": "minecraft:sharpness"
              }
            ],
            "factor": 0.5
          }
        ],
        "offset": 0.5
      }
    ],
    "formatters": [
      {
        "type": "tetra:basic",
        "format": "single_decimal"
      }
    ]
  }
}