Class DatMessageFormatter
java.lang.Object
com.datdeveloper.datmoddingapi.util.DatMessageFormatter
A class for formatting
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.network.chat.Component
formatChatString
(String formatString, Object... args) Format the given chat string into a chat component using objects passed as argumentsnet.minecraft.network.chat.Component
parse()
Parse the given formatString using the arguments
-
Constructor Details
-
DatMessageFormatter
- Parameters:
formatString
- The string to be formattedargs
- Arguments to be used to format the string
-
-
Method Details
-
formatChatString
public static net.minecraft.network.chat.Component formatChatString(String formatString, Object... args) Format the given chat string into a chat component using objects passed as argumentsA shortcut function for
DatMessageFormatter(java.lang.String, java.lang.Object...)
When an error is encountered in the
DatMessageFormatter(java.lang.String, java.lang.Object...)
, it is caught and dumped in the chat message.DatMessageFormatter(java.lang.String, java.lang.Object...)
should be used directly if you desire handling the error yourself.- Parameters:
formatString
- The string that is processedargs
- The arguments to use to format the string- Returns:
- A chat component containing the formatted text
- See Also:
-
parse
Parse the given formatString using the arguments- Returns:
- The processed message
- Throws:
ChatParseException
- Thrown when an exception is encountered whilst parsing the string
-