Class TUtils
java.lang.Object
io.github.thecsdev.tcdcommons.api.util.TUtils
Contains miscellaneous functions that provide extra utility.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getModName
(String modId) Returns the name of a given mod by it's mod id.static UUID
getOfflinePlayerUuid
(String nickname) static <T> List
<T> safeSubList
(List<T> list, int fromIndex, int toIndex) A safer implementation ofList.subList(int, int)
.
Credit: https://stackoverflow.com/a/31003453static void
throwCrash
(String message, Throwable cause) Throws aCrashException
.
-
Method Details
-
throwCrash
public static void throwCrash(String message, Throwable cause) throws net.minecraft.util.crash.CrashException Throws aCrashException
.- Parameters:
message
- The message to include alongside the crash, in the crash report.cause
- TheThrowable
that caused whatever issue took place.- Throws:
net.minecraft.util.crash.CrashException
- Always.
-
getOfflinePlayerUuid
Returns the offlineUUID
for a given player nickname.
ThisUUID
will not work for referencing "online" players.- Parameters:
nickname
- The player nickname.
-
getModName
Returns the name of a given mod by it's mod id.- Parameters:
modId
- The unique ID of the mod.- Returns:
- The name of the mod, or "*" if the argument is
null
.
-
safeSubList
A safer implementation ofList.subList(int, int)
.
Credit: https://stackoverflow.com/a/31003453- Parameters:
list
- TheList
to sub-list from.fromIndex
- Low endpoint (inclusive) of the subList.toIndex
- High endpoint (exclusive) of the subList.
-