Package net.darkhax.bookshelf.api.util
Class TextHelper
java.lang.Object
net.darkhax.bookshelf.api.util.TextHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocationstatic final net.minecraft.resources.ResourceLocation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.network.chat.ComponentapplyFont(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.MutableComponentgetFormatedTime(int ticks, boolean includeHover) static Set<net.minecraft.resources.ResourceLocation>static net.minecraft.network.chat.MutableComponentjoin(net.minecraft.network.chat.Component separator, Collection<net.minecraft.network.chat.Component> toJoin) static net.minecraft.network.chat.MutableComponentjoin(net.minecraft.network.chat.Component separator, Iterator<net.minecraft.network.chat.Component> toJoin) static net.minecraft.network.chat.MutableComponentjoin(net.minecraft.network.chat.Component separator, net.minecraft.network.chat.Component... toJoin) static net.minecraft.network.chat.MutableComponentlookupTranslation(String key, Object... args) static net.minecraft.network.chat.MutableComponentlookupTranslation(String key, BiFunction<String, Object[], net.minecraft.network.chat.MutableComponent> fallback, Object... args) static net.minecraft.network.chat.MutableComponentlookupTranslation(String key, net.minecraft.network.chat.MutableComponent fallback, Object... args) static net.minecraft.network.chat.MutableComponentlookupTranslationWithAlias(String[] keys, Object... params) static net.minecraft.network.chat.MutableComponentlookupTranslationWithAlias(net.minecraft.resources.ResourceLocation id, String... keys) static net.minecraft.network.chat.MutableComponentsetCopyText(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>>
TsetHover(T component, A action, AT arg) static <T extends net.minecraft.network.chat.Component>
TsetHover(T component, net.minecraft.network.chat.Component hoverInfo) static <T extends net.minecraft.network.chat.Component>
TsetHover(T component, net.minecraft.network.chat.HoverEvent hoverInfo) static <T extends net.minecraft.network.chat.Component>
TsetHover(T component, net.minecraft.world.entity.Entity hoverInfo) static <T extends net.minecraft.network.chat.Component>
TsetHover(T component, net.minecraft.world.item.ItemStack hoverInfo) static net.minecraft.network.chat.MutableComponenttextWithCopy(String text)
-
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, T setHoverA extends net.minecraft.network.chat.HoverEvent.Action<AT>> (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
-
lookupTranslationWithAlias
@Nullable public static net.minecraft.network.chat.MutableComponent lookupTranslationWithAlias(net.minecraft.resources.ResourceLocation id, String... keys) -
lookupTranslationWithAlias
-
lookupTranslation
-
lookupTranslation
-
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
-
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)
-