Class Identifier
java.lang.Object
net.buildtheearth.terraminusminus.substitutes.Identifier
- All Implemented Interfaces:
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:
Identifier as represented as text in the following format:
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.
An identifier is made of two parts:
- a namespace, identifying whatever owns the object (e.g. "minecraft", "myplugin", "custommod", ...)
- a path, identifying the object itself (e.g. "my_block_name", "textures/my/custom/texture.png", "my_biome", ...)
[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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIdentifier(@NonNull String path) Creates a newIdentifierwith the given path in the namespaceminecraft.Identifier(@NonNull String namespace, @NonNull String path) Creates a newIdentifierwith the given namespace and path. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(Identifier other) booleaninthashCode()@NonNull StringThe namespace of this identifier.static @NotNull Identifier@NonNull Stringpath()The path of this identifier.toString()withNamespace(@NonNull String namespace) The namespace of this identifier.The path of this identifier.
-
Field Details
-
namespace
The namespace of this identifier. Is nevernulland always matches[a-z0-9_.-]+. -
path
The path of this identifier. Is nevernulland always matches[a-z0-9_./-]+.
-
-
Constructor Details
-
Identifier
Creates a newIdentifierwith the given namespace and path.- Parameters:
namespace- the namespace for the newIdentifier(must match[a-z0-9_.-]+)path- the path for the newIdentifier(must match[a-z0-9_./-]+)- Throws:
NullPointerException- if either the namespace or path arenullIllegalArgumentException- if either the namespace or path are not valid
-
Identifier
Creates a newIdentifierwith the given path in the namespaceminecraft.- Parameters:
path- the path for the newIdentifier- Throws:
NullPointerException- if path isnullIllegalArgumentException- if the path is not valid
-
-
Method Details
-
parse
-
toString
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<Identifier>
-
namespace
The namespace of this identifier. Is nevernulland always matches[a-z0-9_.-]+. -
path
The path of this identifier. Is nevernulland always matches[a-z0-9_./-]+. -
withNamespace
The namespace of this identifier. Is nevernulland always matches[a-z0-9_.-]+.- Returns:
this.
-
withPath
The path of this identifier. Is nevernulland always matches[a-z0-9_./-]+.- Returns:
this.
-