java.lang.Object
io.github.thecsdev.tcdcommons.api.util.TUtils

public final class TUtils extends Object
Contains miscellaneous functions that provide extra utility.
  • Method Details

    • throwCrash

      public static void throwCrash(String message, Throwable cause) throws net.minecraft.util.crash.CrashException
      Throws a CrashException.
      Parameters:
      message - The message to include alongside the crash, in the crash report.
      cause - The Throwable that caused whatever issue took place.
      Throws:
      net.minecraft.util.crash.CrashException - Always.
    • getOfflinePlayerUuid

      public static UUID getOfflinePlayerUuid(String nickname)
      Returns the offline UUID for a given player nickname.
      This UUID will not work for referencing "online" players.
      Parameters:
      nickname - The player nickname.
    • getModName

      public static String getModName(String modId)
      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

      public static <T> List<T> safeSubList(List<T> list, int fromIndex, int toIndex)
      A safer implementation of List.subList(int, int).
      Credit: https://stackoverflow.com/a/31003453
      Parameters:
      list - The List to sub-list from.
      fromIndex - Low endpoint (inclusive) of the subList.
      toIndex - High endpoint (exclusive) of the subList.