Class TextHelper
java.lang.Object
com.mrbysco.enhancedanvils.util.TextHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.network.chat.ComponentchangeFont(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.ItemLorecreateLore(net.minecraft.world.item.component.ItemLore originalLore, String itemName) Creates a new ItemLore based on the original lore and the provided item name.static booleanloreChanged(net.minecraft.world.item.component.ItemLore originalLore, String itemName) Checks if the lore has changed based on the provided item name.static voidSets the lore of an ItemStack based on the provided item name.
-
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 itemitemName- 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 itemitemName- The item name containing potential lore formatting codes- Returns:
- A new ItemLore with the updated lore, or null if no changes were made
-
setLore
Sets the lore of an ItemStack based on the provided item name.- Parameters:
stack- The ItemStack to set the lore foritemName- The item name containing potential lore formatting codes
-