Class TextHelper

java.lang.Object
com.mrbysco.enhancedanvils.util.TextHelper

public class TextHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.network.chat.Component
    changeFont(net.minecraft.network.chat.Component component)
    Changes the font of a given component if it starts with a known font code.
    static @Nullable net.minecraft.world.item.component.ItemLore
    createLore(net.minecraft.world.item.component.ItemLore originalLore, String itemName)
    Creates a new ItemLore based on the original lore and the provided item name.
    static boolean
    loreChanged(net.minecraft.world.item.component.ItemLore originalLore, String itemName)
    Checks if the lore has changed based on the provided item name.
    static void
    setLore(net.minecraft.world.item.ItemStack stack, String itemName)
    Sets the lore of an ItemStack based on the provided item name.

    Methods inherited from class Object

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

    • TextHelper

      public TextHelper()
  • Method Details

    • changeFont

      public static net.minecraft.network.chat.Component changeFont(net.minecraft.network.chat.Component component)
      Changes the font of a given component if it starts with a known font code.
      Parameters:
      component - The component to change the font of
      Returns:
      A new component with the changed font, or the original component if no font code was found
    • loreChanged

      public static boolean loreChanged(net.minecraft.world.item.component.ItemLore originalLore, String itemName)
      Checks if the lore has changed based on the provided item name.
      Parameters:
      originalLore - The original lore of the item
      itemName - The item name containing potential lore formatting codes
      Returns:
      True if the lore has changed, false otherwise
    • createLore

      @Nullable public static @Nullable net.minecraft.world.item.component.ItemLore createLore(net.minecraft.world.item.component.ItemLore originalLore, String itemName)
      Creates a new ItemLore based on the original lore and the provided item name.
      Parameters:
      originalLore - The original lore of the item
      itemName - The item name containing potential lore formatting codes
      Returns:
      A new ItemLore with the updated lore, or null if no changes were made
    • setLore

      public static void setLore(net.minecraft.world.item.ItemStack stack, String itemName)
      Sets the lore of an ItemStack based on the provided item name.
      Parameters:
      stack - The ItemStack to set the lore for
      itemName - The item name containing potential lore formatting codes