Class TextHelper

java.lang.Object
net.darkhax.bookshelf.api.util.TextHelper

public final class TextHelper extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.resources.ResourceLocation
     
    static final net.minecraft.resources.ResourceLocation
     
    static final net.minecraft.resources.ResourceLocation
     
    static final net.minecraft.resources.ResourceLocation
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.network.chat.Component
    applyFont(net.minecraft.network.chat.Component text, net.minecraft.resources.ResourceLocation font)
    Recursively applies a custom font to a text component and all of it's children components.
    static net.minecraft.network.chat.MutableComponent
    getFormatedTime(int ticks, boolean includeHover)
     
    static Set<net.minecraft.resources.ResourceLocation>
     
    static net.minecraft.network.chat.MutableComponent
    join(net.minecraft.network.chat.Component separator, Collection<net.minecraft.network.chat.Component> toJoin)
     
    static net.minecraft.network.chat.MutableComponent
    join(net.minecraft.network.chat.Component separator, Iterator<net.minecraft.network.chat.Component> toJoin)
     
    static net.minecraft.network.chat.MutableComponent
    join(net.minecraft.network.chat.Component separator, net.minecraft.network.chat.Component... toJoin)
     
    static net.minecraft.network.chat.MutableComponent
     
    static net.minecraft.network.chat.MutableComponent
    lookupTranslation(String key, BiFunction<String,Object[],net.minecraft.network.chat.MutableComponent> fallback, Object... args)
     
    static net.minecraft.network.chat.MutableComponent
    lookupTranslation(String key, net.minecraft.network.chat.MutableComponent fallback, Object... args)
     
    static net.minecraft.network.chat.MutableComponent
     
    static net.minecraft.network.chat.MutableComponent
    lookupTranslationWithAlias(net.minecraft.resources.ResourceLocation id, String... keys)
     
    static net.minecraft.network.chat.MutableComponent
    setCopyText(net.minecraft.network.chat.MutableComponent component, String copy)
     
    static <T extends net.minecraft.network.chat.Component, AT, A extends net.minecraft.network.chat.HoverEvent.Action<AT>>
    T
    setHover(T component, A action, AT arg)
     
    static <T extends net.minecraft.network.chat.Component>
    T
    setHover(T component, net.minecraft.network.chat.Component hoverInfo)
     
    static <T extends net.minecraft.network.chat.Component>
    T
    setHover(T component, net.minecraft.network.chat.HoverEvent hoverInfo)
     
    static <T extends net.minecraft.network.chat.Component>
    T
    setHover(T component, net.minecraft.world.entity.Entity hoverInfo)
     
    static <T extends net.minecraft.network.chat.Component>
    T
    setHover(T component, net.minecraft.world.item.ItemStack hoverInfo)
     
    static net.minecraft.network.chat.MutableComponent
     

    Methods inherited from class java.lang.Object

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

    • FONT_ALT

      public static final net.minecraft.resources.ResourceLocation FONT_ALT
    • FONT_DEFAULT

      public static final net.minecraft.resources.ResourceLocation FONT_DEFAULT
    • FONT_ILLAGER

      public static final net.minecraft.resources.ResourceLocation FONT_ILLAGER
    • FONT_UNIFORM

      public static final net.minecraft.resources.ResourceLocation FONT_UNIFORM
  • Constructor Details

    • TextHelper

      public TextHelper()
  • Method Details

    • getFormatedTime

      public static net.minecraft.network.chat.MutableComponent getFormatedTime(int ticks, boolean includeHover)
    • setHover

      public static <T extends net.minecraft.network.chat.Component> T setHover(T component, net.minecraft.network.chat.Component hoverInfo)
    • setHover

      public static <T extends net.minecraft.network.chat.Component> T setHover(T component, net.minecraft.world.item.ItemStack hoverInfo)
    • setHover

      public static <T extends net.minecraft.network.chat.Component> T setHover(T component, net.minecraft.world.entity.Entity hoverInfo)
    • setHover

      public static <T extends net.minecraft.network.chat.Component, AT, A extends net.minecraft.network.chat.HoverEvent.Action<AT>> T setHover(T component, A action, AT arg)
    • setHover

      public static <T extends net.minecraft.network.chat.Component> T setHover(T component, net.minecraft.network.chat.HoverEvent hoverInfo)
    • applyFont

      public static net.minecraft.network.chat.Component applyFont(net.minecraft.network.chat.Component text, net.minecraft.resources.ResourceLocation font)
      Recursively applies a custom font to a text component and all of it's children components.
      Parameters:
      text - The text to apply the font to.
      font - The ID of the font to apply.
      Returns:
      A modified text component that has had the font applied.
    • getRegisteredFonts

      public static Set<net.minecraft.resources.ResourceLocation> getRegisteredFonts()
    • lookupTranslationWithAlias

      @Nullable public static net.minecraft.network.chat.MutableComponent lookupTranslationWithAlias(net.minecraft.resources.ResourceLocation id, String... keys)
    • lookupTranslationWithAlias

      @Nullable public static net.minecraft.network.chat.MutableComponent lookupTranslationWithAlias(String[] keys, Object... params)
    • lookupTranslation

      @Nullable public static net.minecraft.network.chat.MutableComponent lookupTranslation(String key, Object... args)
    • lookupTranslation

      @Nullable public static net.minecraft.network.chat.MutableComponent lookupTranslation(String key, net.minecraft.network.chat.MutableComponent fallback, Object... args)
    • lookupTranslation

      @Nullable public static net.minecraft.network.chat.MutableComponent lookupTranslation(String key, BiFunction<String,Object[],net.minecraft.network.chat.MutableComponent> fallback, Object... args)
    • setCopyText

      public static net.minecraft.network.chat.MutableComponent setCopyText(net.minecraft.network.chat.MutableComponent component, String copy)
    • textWithCopy

      public static net.minecraft.network.chat.MutableComponent textWithCopy(String text)
    • join

      public static net.minecraft.network.chat.MutableComponent join(net.minecraft.network.chat.Component separator, net.minecraft.network.chat.Component... toJoin)
    • join

      public static net.minecraft.network.chat.MutableComponent join(net.minecraft.network.chat.Component separator, Collection<net.minecraft.network.chat.Component> toJoin)
    • join

      public static net.minecraft.network.chat.MutableComponent join(net.minecraft.network.chat.Component separator, Iterator<net.minecraft.network.chat.Component> toJoin)