Package com.wdiscute.libtooltips
Class Tooltips
java.lang.Object
com.wdiscute.libtooltips.Tooltips
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic interfaceImplement this interface if you wish your item to have tooltips without requiring translation keys or data components -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.neoforged.neoforge.registries.DeferredRegister<net.minecraft.core.component.DataComponentType<?>> Adding these data components to an ItemStack will display the tooltipsstatic final Stringstatic final net.neoforged.neoforge.registries.DeferredHolder<net.minecraft.core.component.DataComponentType<?>, net.minecraft.core.component.DataComponentType<List<String>>> static final net.neoforged.neoforge.registries.DeferredHolder<net.minecraft.core.component.DataComponentType<?>, net.minecraft.core.component.DataComponentType<List<String>>> -
Constructor Summary
ConstructorsConstructorDescriptionTooltips(net.neoforged.bus.api.IEventBus eventBus, net.neoforged.fml.ModContainer modContainer) -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanstatic voidmodifyItemTooltip(net.neoforged.neoforge.event.entity.player.ItemTooltipEvent event) Handles all the logic related to applying tooltips to the description of an ItemStack when hovering it.static voidregisterProcessor(String tag, org.apache.commons.lang3.function.TriFunction<String, net.minecraft.world.item.ItemStack, net.minecraft.world.entity.Entity, net.minecraft.network.chat.MutableComponent> processor) static net.minecraft.network.chat.MutableComponentresolveTagsToComponent(String input) static net.minecraft.network.chat.MutableComponentresolveTagsToComponent(String input, net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.Entity entity) Resolves the input string into its tags and passes each tag to the respective processor.static net.minecraft.network.chat.MutableComponentresolveTagsToComponentFromTranslationKey(String translationKey) static net.minecraft.network.chat.MutableComponentresolveTagsToComponentFromTranslationKey(String translationKey, net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.Entity entity)
-
Field Details
-
MOD_ID
- See Also:
-
DATA_COMPONENT_TYPES
public static final net.neoforged.neoforge.registries.DeferredRegister<net.minecraft.core.component.DataComponentType<?>> DATA_COMPONENT_TYPESAdding these data components to an ItemStack will display the tooltips -
TOOLTIP_SHIFT
-
TOOLTIP_ALWAYS
-
-
Constructor Details
-
Tooltips
public Tooltips(net.neoforged.bus.api.IEventBus eventBus, net.neoforged.fml.ModContainer modContainer)
-
-
Method Details
-
registerProcessor
-
hasTags
-
resolveTagsToComponentFromTranslationKey
public static net.minecraft.network.chat.MutableComponent resolveTagsToComponentFromTranslationKey(String translationKey, @Nullable net.minecraft.world.item.ItemStack stack, @Nullable net.minecraft.world.entity.Entity entity) -
resolveTagsToComponentFromTranslationKey
public static net.minecraft.network.chat.MutableComponent resolveTagsToComponentFromTranslationKey(String translationKey) -
resolveTagsToComponent
-
resolveTagsToComponent
public static net.minecraft.network.chat.MutableComponent resolveTagsToComponent(String input, @Nullable net.minecraft.world.item.ItemStack stack, @Nullable net.minecraft.world.entity.Entity entity) Resolves the input string into its tags and passes each tag to the respective processor. Returns a MutableComponent with all the tags resolved into subcomponents -
modifyItemTooltip
public static void modifyItemTooltip(net.neoforged.neoforge.event.entity.player.ItemTooltipEvent event) Handles all the logic related to applying tooltips to the description of an ItemStack when hovering it.
-