Class ResourceLocation

java.lang.Object
net.minheur.potoflux.utils.ressourcelocation.ResourceLocation

public class ResourceLocation extends Object
The ResourceLocation is used to have a unique identifier from the mod's namespace and the item id
  • Constructor Details

    • ResourceLocation

      public ResourceLocation(String namespace, String path)
      Creates a ResourceLocation from a namespace and an ID
      Parameters:
      namespace - the ID of the mod registering
      path - the ID of the item registered
    • ResourceLocation

      public ResourceLocation(String location)
      Creates a resourceLocation with a unique string, that gets decomposed
      Parameters:
      location - loc to decompose
  • Method Details

    • getPath

      public String getPath()
      Get the ID of the loc
      Returns:
      the loc's ID
    • getNamespace

      public String getNamespace()
      Get the namespace (modID) of the loc
      Returns:
      the loc's namespace
    • toString

      public String toString()
      Merge correctly the loc together
      Overrides:
      toString in class Object
      Returns:
      the full ID
    • decompose

      protected static String[] decompose(String pLocation, char pSeparator)
      Decompose a single string into an array containing the modId and the ID
      Parameters:
      pLocation - full loc to decompose
      pSeparator - char to search in the loc to separate the modId and the ID
      Returns:
      an array containing the namespace and the ID
    • isValidPath

      public static boolean isValidPath(String pPath)
      Checks if the path is correct
      Parameters:
      pPath - ID of the loc
      Returns:
      if the ID is correct
    • isValidNamespace

      public static boolean isValidNamespace(String pNamespace)
      Checks if the namespace is valid
      Parameters:
      pNamespace - namespace of the loc
      Returns:
      if the namespace is correct
    • validPathChar

      public static boolean validPathChar(char pPathChar)
      Checks a char of the ID
      Parameters:
      pPathChar - the char to check
      Returns:
      if char is valid
    • validNamespaceChar

      public static boolean validNamespaceChar(char pNamespaceChar)
      Checks a char of the namespace
      Parameters:
      pNamespaceChar - the char to check
      Returns:
      if char is valid