Class DebugTooltipFormatter

java.lang.Object
johnsmith.enchantmentcore.client.tooltip.DebugTooltipFormatter
All Implemented Interfaces:
EnchantmentTooltipFormatter

public class DebugTooltipFormatter extends Object implements EnchantmentTooltipFormatter
A diagnostic formatter used to test the capabilities of the TooltipFormatterRegistry. Demonstrates prepending, appending, and mutating the vanilla target text, alongside utilizing the provided ItemStack context.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • 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.
    boolean
    Determines whether this formatter is currently active and eligible to format tooltips.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DebugTooltipFormatter

      public DebugTooltipFormatter()
  • Method Details

    • format

      public 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)
      Description copied from interface: EnchantmentTooltipFormatter
      Formats the tooltip lines for a single enchantment entry on the given ItemStack.
      Specified by:
      format in interface EnchantmentTooltipFormatter
      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

      public int getPriority()
      Description copied from interface: EnchantmentTooltipFormatter
      Returns the execution priority of this formatter. Formatters with higher priority values are queried first by TooltipFormatterRegistry.
      Specified by:
      getPriority in interface EnchantmentTooltipFormatter
      Returns:
      The integer priority value.
    • isEnabled

      public boolean isEnabled()
      Description copied from interface: EnchantmentTooltipFormatter
      Determines whether this formatter is currently active and eligible to format tooltips.
      Specified by:
      isEnabled in interface EnchantmentTooltipFormatter
      Returns:
      true if enabled, false to skip this formatter.