Class TooltipFormatterRegistry
java.lang.Object
johnsmith.enchantmentcore.api.tooltip.TooltipFormatterRegistry
Client-side registry and dispatch pipeline for
EnchantmentTooltipFormatter implementations.
Invoked by ItemStackMixin when rendering minecraft:enchantments or
minecraft:stored_enchantments tooltip components. Evaluates enabled formatters in descending
priority order and falls back to Enchantment.getFullname(Holder, int) if no formatter handles the entry.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<net.minecraft.network.chat.Component> getFormatted(net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment, int level, net.minecraft.world.item.ItemStack itemStack) Evaluates registered, enabledEnchantmentTooltipFormatters in descending priority order and returns the first non-empty formatted tooltip component list for the given enchantment.static voidregisterFormatter(EnchantmentTooltipFormatter formatter) Registers anEnchantmentTooltipFormatterand marks the priority order as dirty.
-
Constructor Details
-
TooltipFormatterRegistry
public TooltipFormatterRegistry()
-
-
Method Details
-
registerFormatter
Registers anEnchantmentTooltipFormatterand marks the priority order as dirty.- Parameters:
formatter- The formatter instance to register.
-
getFormatted
public static List<net.minecraft.network.chat.Component> getFormatted(net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment, int level, net.minecraft.world.item.ItemStack itemStack) Evaluates registered, enabledEnchantmentTooltipFormatters in descending priority order and returns the first non-empty formatted tooltip component list for the given enchantment.- Parameters:
enchantment- The target enchantmentHolder.level- The active level of the enchantment.itemStack- TheItemStackhosting the enchantment.- Returns:
- A list of formatted
Componentlines, or a singleton list containingEnchantment.getFullname(Holder, int)if unhandled.
-