Interface EnchantmentTooltipFormatter

All Known Implementing Classes:
DebugTooltipFormatter

public interface EnchantmentTooltipFormatter
Pluggable strategy contract for formatting enchantment lines and descriptions on item tooltips.

Implementations are registered in TooltipFormatterRegistry and evaluated in descending order of getPriority() whenever an item's applied or stored enchantments are rendered.

  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<List<net.minecraft.network.chat.Component>>
    format(net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment, int level, net.minecraft.world.item.ItemStack itemStack)
    Formats the tooltip lines for a single enchantment entry on the given ItemStack.
    int
    Returns the execution priority of this formatter.
    default boolean
    Determines whether this formatter is currently active and eligible to format tooltips.
  • Method Details

    • format

      Optional<List<net.minecraft.network.chat.Component>> format(net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment, int level, net.minecraft.world.item.ItemStack itemStack)
      Formats the tooltip lines for a single enchantment entry on the given ItemStack.
      Parameters:
      enchantment - The registry Holder of the enchantment being rendered.
      level - The active level of the enchantment on the item.
      itemStack - The ItemStack hosting the enchantment.
      Returns:
      An Optional containing the list of formatted Component lines to append to the tooltip, or Optional.empty() to pass evaluation to the next lower-priority formatter.
    • getPriority

      int getPriority()
      Returns the execution priority of this formatter. Formatters with higher priority values are queried first by TooltipFormatterRegistry.
      Returns:
      The integer priority value.
    • isEnabled

      default boolean isEnabled()
      Determines whether this formatter is currently active and eligible to format tooltips.
      Returns:
      true if enabled, false to skip this formatter.