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 TypeMethodDescriptionformat(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 givenItemStack.intReturns the execution priority of this formatter.default booleanDetermines 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 givenItemStack.- Parameters:
enchantment- The registryHolderof the enchantment being rendered.level- The active level of the enchantment on the item.itemStack- TheItemStackhosting the enchantment.- Returns:
- An
Optionalcontaining the list of formattedComponentlines to append to the tooltip, orOptional.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 byTooltipFormatterRegistry.- Returns:
- The integer priority value.
-
isEnabled
default boolean isEnabled()Determines whether this formatter is currently active and eligible to format tooltips.- Returns:
trueif enabled,falseto skip this formatter.
-