Class Identifier

java.lang.Object
net.minecraft.util.Identifier
All Implemented Interfaces:
Comparable<Identifier>
Direct Known Subclasses:
ModelIdentifier

public class Identifier extends Object implements Comparable<Identifier>
The namespace and path must contain only lowercase letters ([a-z]), digits ([0-9]), or the characters '_', '.', and '-'. The path can also contain the standard path separator '/'.
Mappings:
Namespace Name
official yh
intermediary net/minecraft/class_2960
named net/minecraft/util/Identifier
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<Identifier> CODEC
      Mappings:
      Namespace Name Mixin selector
      official a Lyh;a:Lcom/mojang/serialization/Codec;
      intermediary field_25139 Lnet/minecraft/class_2960;field_25139:Lcom/mojang/serialization/Codec;
      named CODEC Lnet/minecraft/util/Identifier;CODEC:Lcom/mojang/serialization/Codec;
    • COMMAND_EXCEPTION

      private static final com.mojang.brigadier.exceptions.SimpleCommandExceptionType COMMAND_EXCEPTION
      Mappings:
      Namespace Name Mixin selector
      official g Lyh;g:Lcom/mojang/brigadier/exceptions/SimpleCommandExceptionType;
      intermediary field_13354 Lnet/minecraft/class_2960;field_13354:Lcom/mojang/brigadier/exceptions/SimpleCommandExceptionType;
      named COMMAND_EXCEPTION Lnet/minecraft/util/Identifier;COMMAND_EXCEPTION:Lcom/mojang/brigadier/exceptions/SimpleCommandExceptionType;
    • NAMESPACE_SEPARATOR

      public static final char NAMESPACE_SEPARATOR
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official b Lyh;b:C
      intermediary field_33380 Lnet/minecraft/class_2960;field_33380:C
      named NAMESPACE_SEPARATOR Lnet/minecraft/util/Identifier;NAMESPACE_SEPARATOR:C
    • DEFAULT_NAMESPACE

      public static final String DEFAULT_NAMESPACE
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official c Lyh;c:Ljava/lang/String;
      intermediary field_33381 Lnet/minecraft/class_2960;field_33381:Ljava/lang/String;
      named DEFAULT_NAMESPACE Lnet/minecraft/util/Identifier;DEFAULT_NAMESPACE:Ljava/lang/String;
    • REALMS_NAMESPACE

      public static final String REALMS_NAMESPACE
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official d Lyh;d:Ljava/lang/String;
      intermediary field_33382 Lnet/minecraft/class_2960;field_33382:Ljava/lang/String;
      named REALMS_NAMESPACE Lnet/minecraft/util/Identifier;REALMS_NAMESPACE:Ljava/lang/String;
    • namespace

      protected final String namespace
      Mappings:
      Namespace Name Mixin selector
      official e Lyh;e:Ljava/lang/String;
      intermediary field_13353 Lnet/minecraft/class_2960;field_13353:Ljava/lang/String;
      named namespace Lnet/minecraft/util/Identifier;namespace:Ljava/lang/String;
    • path

      protected final String path
      Mappings:
      Namespace Name Mixin selector
      official f Lyh;f:Ljava/lang/String;
      intermediary field_13355 Lnet/minecraft/class_2960;field_13355:Ljava/lang/String;
      named path Lnet/minecraft/util/Identifier;path:Ljava/lang/String;
  • Constructor Details

    • Identifier

      protected Identifier(String[] id)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lyh;<init>([Ljava/lang/String;)V
      intermediary <init> Lnet/minecraft/class_2960;<init>([Ljava/lang/String;)V
      named <init> Lnet/minecraft/util/Identifier;<init>([Ljava/lang/String;)V
    • Identifier

      public Identifier(String id)

      Takes a string of the form <namespace>:<path>, for example minecraft:iron_ingot.

      The string will be split (on the :) into an identifier with the specified path and namespace. Prefer using the Identifier(java.lang.String, java.lang.String) constructor that takes the namespace and path as individual parameters to avoid mistakes.

      Throws:
      InvalidIdentifierException - if the string cannot be parsed as an identifier.
      Mappings:
      Namespace Name Mixin selector
      official <init> Lyh;<init>(Ljava/lang/String;)V
      intermediary <init> Lnet/minecraft/class_2960;<init>(Ljava/lang/String;)V
      named <init> Lnet/minecraft/util/Identifier;<init>(Ljava/lang/String;)V
    • Identifier

      public Identifier(String namespace, String path)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lyh;<init>(Ljava/lang/String;Ljava/lang/String;)V
      intermediary <init> Lnet/minecraft/class_2960;<init>(Ljava/lang/String;Ljava/lang/String;)V
      named <init> Lnet/minecraft/util/Identifier;<init>(Ljava/lang/String;Ljava/lang/String;)V
  • Method Details

    • splitOn

      public static Identifier splitOn(String id, char delimiter)
      Mappings:
      Namespace Name Mixin selector
      official a Lyh;a(Ljava/lang/String;C)Lyh;
      intermediary method_12838 Lnet/minecraft/class_2960;method_12838(Ljava/lang/String;C)Lnet/minecraft/class_2960;
      named splitOn Lnet/minecraft/util/Identifier;splitOn(Ljava/lang/String;C)Lnet/minecraft/util/Identifier;
    • tryParse

      @Nullable public static @Nullable Identifier tryParse(String id)

      Parses a string into an Identifier. Takes a string of the form <namespace>:<path>, for example minecraft:iron_ingot.

      Returns:
      resulting identifier, or null if the string couldn't be parsed as an identifier
      Mappings:
      Namespace Name Mixin selector
      official a Lyh;a(Ljava/lang/String;)Lyh;
      intermediary method_12829 Lnet/minecraft/class_2960;method_12829(Ljava/lang/String;)Lnet/minecraft/class_2960;
      named tryParse Lnet/minecraft/util/Identifier;tryParse(Ljava/lang/String;)Lnet/minecraft/util/Identifier;
    • split

      protected static String[] split(String id, char delimiter)
      Mappings:
      Namespace Name Mixin selector
      official b Lyh;b(Ljava/lang/String;C)[Ljava/lang/String;
      intermediary method_12830 Lnet/minecraft/class_2960;method_12830(Ljava/lang/String;C)[Ljava/lang/String;
      named split Lnet/minecraft/util/Identifier;split(Ljava/lang/String;C)[Ljava/lang/String;
    • validate

      private static com.mojang.serialization.DataResult<Identifier> validate(String id)
      Mappings:
      Namespace Name Mixin selector
      official c Lyh;c(Ljava/lang/String;)Lcom/mojang/serialization/DataResult;
      intermediary method_29186 Lnet/minecraft/class_2960;method_29186(Ljava/lang/String;)Lcom/mojang/serialization/DataResult;
      named validate Lnet/minecraft/util/Identifier;validate(Ljava/lang/String;)Lcom/mojang/serialization/DataResult;
    • getPath

      public String getPath()
      Mappings:
      Namespace Name Mixin selector
      official a Lyh;a()Ljava/lang/String;
      intermediary method_12832 Lnet/minecraft/class_2960;method_12832()Ljava/lang/String;
      named getPath Lnet/minecraft/util/Identifier;getPath()Ljava/lang/String;
    • getNamespace

      public String getNamespace()
      Mappings:
      Namespace Name Mixin selector
      official b Lyh;b()Ljava/lang/String;
      intermediary method_12836 Lnet/minecraft/class_2960;method_12836()Ljava/lang/String;
      named getNamespace Lnet/minecraft/util/Identifier;getNamespace()Ljava/lang/String;
    • toString

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      Mappings:
      Namespace Name Mixin selector
      official equals Lyh;equals(Ljava/lang/Object;)Z
      intermediary equals Lnet/minecraft/class_2960;equals(Ljava/lang/Object;)Z
      named equals Lnet/minecraft/util/Identifier;equals(Ljava/lang/Object;)Z
    • hashCode

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

      public int compareTo(Identifier identifier)
      Specified by:
      compareTo in interface Comparable<Identifier>
      Mappings:
      Namespace Name Mixin selector
      official a Lyh;a(Lyh;)I
      intermediary method_12833 Lnet/minecraft/class_2960;method_12833(Lnet/minecraft/class_2960;)I
      named compareTo Lnet/minecraft/util/Identifier;compareTo(Lnet/minecraft/util/Identifier;)I
    • toUnderscoreSeparatedString

      public String toUnderscoreSeparatedString()
      Mappings:
      Namespace Name Mixin selector
      official c Lyh;c()Ljava/lang/String;
      intermediary method_36181 Lnet/minecraft/class_2960;method_36181()Ljava/lang/String;
      named toUnderscoreSeparatedString Lnet/minecraft/util/Identifier;toUnderscoreSeparatedString()Ljava/lang/String;
    • fromCommandInput

      public static Identifier fromCommandInput(com.mojang.brigadier.StringReader reader) throws com.mojang.brigadier.exceptions.CommandSyntaxException
      Throws:
      com.mojang.brigadier.exceptions.CommandSyntaxException
      Mappings:
      Namespace Name Mixin selector
      official a Lyh;a(Lcom/mojang/brigadier/StringReader;)Lyh;
      intermediary method_12835 Lnet/minecraft/class_2960;method_12835(Lcom/mojang/brigadier/StringReader;)Lnet/minecraft/class_2960;
      named fromCommandInput Lnet/minecraft/util/Identifier;fromCommandInput(Lcom/mojang/brigadier/StringReader;)Lnet/minecraft/util/Identifier;
    • isCharValid

      public static boolean isCharValid(char c)
      Mappings:
      Namespace Name Mixin selector
      official a Lyh;a(C)Z
      intermediary method_12831 Lnet/minecraft/class_2960;method_12831(C)Z
      named isCharValid Lnet/minecraft/util/Identifier;isCharValid(C)Z
    • isPathValid

      private static boolean isPathValid(String path)
      Mappings:
      Namespace Name Mixin selector
      official d Lyh;d(Ljava/lang/String;)Z
      intermediary method_20208 Lnet/minecraft/class_2960;method_20208(Ljava/lang/String;)Z
      named isPathValid Lnet/minecraft/util/Identifier;isPathValid(Ljava/lang/String;)Z
    • isNamespaceValid

      private static boolean isNamespaceValid(String namespace)
      Mappings:
      Namespace Name Mixin selector
      official e Lyh;e(Ljava/lang/String;)Z
      intermediary method_20209 Lnet/minecraft/class_2960;method_20209(Ljava/lang/String;)Z
      named isNamespaceValid Lnet/minecraft/util/Identifier;isNamespaceValid(Ljava/lang/String;)Z
    • isPathCharacterValid

      public static boolean isPathCharacterValid(char character)
      Mappings:
      Namespace Name Mixin selector
      official b Lyh;b(C)Z
      intermediary method_29184 Lnet/minecraft/class_2960;method_29184(C)Z
      named isPathCharacterValid Lnet/minecraft/util/Identifier;isPathCharacterValid(C)Z
    • isNamespaceCharacterValid

      private static boolean isNamespaceCharacterValid(char character)
      Mappings:
      Namespace Name Mixin selector
      official c Lyh;c(C)Z
      intermediary method_29185 Lnet/minecraft/class_2960;method_29185(C)Z
      named isNamespaceCharacterValid Lnet/minecraft/util/Identifier;isNamespaceCharacterValid(C)Z
    • isValid

      public static boolean isValid(String id)
      Mappings:
      Namespace Name Mixin selector
      official b Lyh;b(Ljava/lang/String;)Z
      intermediary method_20207 Lnet/minecraft/class_2960;method_20207(Ljava/lang/String;)Z
      named isValid Lnet/minecraft/util/Identifier;isValid(Ljava/lang/String;)Z