Class Tooltips

java.lang.Object
com.wdiscute.libtooltips.Tooltips

public class Tooltips extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
    static class 
     
    static interface 
    Implement this interface if you wish your item to have tooltips without requiring translation keys or data components
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.neoforged.neoforge.registries.DeferredRegister<net.minecraft.core.component.DataComponentType<?>>
    Adding these data components to an ItemStack will display the tooltips
    static final String
     
    static 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

    Constructors
    Constructor
    Description
    Tooltips(net.neoforged.bus.api.IEventBus eventBus, net.neoforged.fml.ModContainer modContainer)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    hasTags(String input)
     
    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.
    static void
    registerProcessor(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.MutableComponent
     
    static net.minecraft.network.chat.MutableComponent
    resolveTagsToComponent(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.MutableComponent
     
    static net.minecraft.network.chat.MutableComponent
    resolveTagsToComponentFromTranslationKey(String translationKey, net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.Entity entity)
     

    Methods inherited from class java.lang.Object

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

    • MOD_ID

      public static final String MOD_ID
      See Also:
    • DATA_COMPONENT_TYPES

      public static final net.neoforged.neoforge.registries.DeferredRegister<net.minecraft.core.component.DataComponentType<?>> DATA_COMPONENT_TYPES
      Adding these data components to an ItemStack will display the tooltips
    • TOOLTIP_SHIFT

      public static final net.neoforged.neoforge.registries.DeferredHolder<net.minecraft.core.component.DataComponentType<?>,net.minecraft.core.component.DataComponentType<List<String>>> TOOLTIP_SHIFT
    • TOOLTIP_ALWAYS

      public static final net.neoforged.neoforge.registries.DeferredHolder<net.minecraft.core.component.DataComponentType<?>,net.minecraft.core.component.DataComponentType<List<String>>> TOOLTIP_ALWAYS
  • Constructor Details

    • Tooltips

      public Tooltips(net.neoforged.bus.api.IEventBus eventBus, net.neoforged.fml.ModContainer modContainer)
  • Method Details

    • registerProcessor

      public static void registerProcessor(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)
    • hasTags

      public static boolean hasTags(String input)
    • 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

      public static net.minecraft.network.chat.MutableComponent resolveTagsToComponent(String input)
    • 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.