java.lang.Object
net.buildtheearth.terraminusminus.substitutes.Identifier
All Implemented Interfaces:
Comparable<Identifier>

public final class Identifier extends Object implements Comparable<Identifier>
A unique identifier for a namespaced game resource. Also known as a resource location or namespaced key.

An identifier is made of two parts:
  1. a namespace, identifying whatever owns the object (e.g. "minecraft", "myplugin", "custommod", ...)
  2. a path, identifying the object itself (e.g. "my_block_name", "textures/my/custom/texture.png", "my_biome", ...)
A valid namespace matches the following regular expression: [a-z0-9_.-]+. A valid path matches the following regular expression: [a-z0-9_./-]+.

Identifier as represented as text in the following format: namespace:path.

This class is immutable and thread safe.
This implementation of the resource location concept is more restrictive than vanilla Minecraft's with the values it accepts for the namespace and path.
See Also:
  • Field Details

    • namespace

      @NonNull public final @NonNull String namespace
      The namespace of this identifier. Is never null and always matches [a-z0-9_.-]+.
    • path

      @NonNull public final @NonNull String path
      The path of this identifier. Is never null and always matches [a-z0-9_./-]+.
  • Constructor Details

  • Method Details

    • parse

      @NotNull public static @NotNull Identifier parse(@NonNull @NonNull String identifier)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(Identifier other)
      Specified by:
      compareTo in interface Comparable<Identifier>
    • namespace

      @NonNull public @NonNull String namespace()
      The namespace of this identifier. Is never null and always matches [a-z0-9_.-]+.
    • path

      @NonNull public @NonNull String path()
      The path of this identifier. Is never null and always matches [a-z0-9_./-]+.
    • withNamespace

      public Identifier withNamespace(@NonNull @NonNull String namespace)
      The namespace of this identifier. Is never null and always matches [a-z0-9_.-]+.
      Returns:
      this.
    • withPath

      public Identifier withPath(@NonNull @NonNull String path)
      The path of this identifier. Is never null and always matches [a-z0-9_./-]+.
      Returns:
      this.