Interface ResourcePath

All Superinterfaces:
Comparable<ResourcePath>

public interface ResourcePath extends Comparable<ResourcePath>
A namespaced path object used to get Resources from a resource manager or a pack contents
See Also:
  • Method Details

    • of

      static ResourcePath of(String namespace, String path)
      Creates a resource path.
      Parameters:
      namespace - The namespace
      path - The path within the supplied namespace
      Returns:
      A new resource path
      See Also:
    • of

      static ResourcePath of(org.spongepowered.plugin.PluginContainer container, String path)
      Creates a resource path from a plugin container.
      Parameters:
      container - The plugin container
      path - The path within the supplied namespace
      Returns:
      A new resource path
      See Also:
    • parse

      static ResourcePath parse(String value)
      Parses a path from a string, generally formatted "namespace:path".

      If no namespace is found in value then minecraft will be the namespace.

      Parameters:
      value - The value
      Returns:
      A new resource path
      See Also:
    • of

      static ResourcePath of(ResourceKey key)
      Creates a new path using the given ResourceKey.
      Parameters:
      key - The key object
      Returns:
      A new path
    • key

      Gets the backing ResourceKey for this path object.
      Returns:
      The key object
    • namespace

      default String namespace()
      Gets the namespace portion of this resource path.
      Returns:
      The namespace
      See Also:
    • path

      default String path()
      Gets the path portion of this resource path.
      Returns:
      The path
      See Also:
    • parent

      Returns:
      The parent path or Optional.empty() if there is none
    • resolve

      ResourcePath resolve(String first, String... children)
      Resolves a path from the current location using the specified children.
      Parameters:
      first - The first child
      children - The rest of the children
      Returns:
      The resolvedIllegalArgumentException path
      Throws:
      IllegalArgumentException - If the path is invalid
    • resolveSibling

      ResourcePath resolveSibling(String sibling, String... children)
      Resolves a sibling of this path.
      Parameters:
      sibling - The sibling's name
      children - The optional children of the sibling
      Returns:
      The sibling resource path
      Throws:
      IllegalArgumentException - If the path is invalid
    • name

      String name()
      Gets the name of the file without any parent elements.
      Returns:
      The file name
    • baseName

      String baseName()
      Gets the base name of the file without any parent elements or extensions.
      Returns:
      The base file name
    • extension

      String extension()
      Gets the extension of the file if any. If the file has no extension, an empty string is returned.
      Returns:
      The file extension