Package net.minecraft.util.registry
Class RegistryKey<T>
java.lang.Object
net.minecraft.util.registry.RegistryKey<T>
- Type Parameters:
T- the type of the value
Represents a key for a value in a registry in a context where a
root registry is available.
- See Also:
Registry.ROOT- Mappings:
Namespace Name official wvintermediary net/minecraft/class_5321named net/minecraft/util/registry/RegistryKey
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Map<String,RegistryKey<?>>A cache of all registry keys ever created.private IdentifierThe identifier of the registry in the root registry.private IdentifierThe identifier of the value in the registry specified byregistry. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Function<Identifier,RegistryKey<T>>createKeyFactory(RegistryKey<? extends Registry<T>> registry)Creates a function that converts an identifier to a registry key for the registry thatregistryrefers to in the root registry.getValue()booleanisOf(RegistryKey<? extends Registry<?>> registry)Returns whether this registry key belongs to the given registry (according to its type, not whether the registry actually contains this key).private static <T> RegistryKey<T>of(Identifier registry, Identifier value)static <T> RegistryKey<T>of(RegistryKey<? extends Registry<T>> registry, Identifier value)Creates a registry key for a value in a registry with a registry key for the value-holding registry in the root registry and an identifier of the value.static <T> RegistryKey<Registry<T>>ofRegistry(Identifier registry)Creates a registry key for a registry in the root registry (registry of all registries) with an identifier for the registry.toString()
-
Field Details
-
INSTANCES
A cache of all registry keys ever created.- Mappings:
Namespace Name Mixin selector official aLwv;a:Ljava/util/Map;intermediary field_25136Lnet/minecraft/class_5321;field_25136:Ljava/util/Map;named INSTANCESLnet/minecraft/util/registry/RegistryKey;INSTANCES:Ljava/util/Map;
-
registry
The identifier of the registry in the root registry.- Mappings:
Namespace Name Mixin selector official bLwv;b:Lww;intermediary field_25137Lnet/minecraft/class_5321;field_25137:Lnet/minecraft/class_2960;named registryLnet/minecraft/util/registry/RegistryKey;registry:Lnet/minecraft/util/Identifier;
-
value
The identifier of the value in the registry specified byregistry.- Mappings:
Namespace Name Mixin selector official cLwv;c:Lww;intermediary field_25138Lnet/minecraft/class_5321;field_25138:Lnet/minecraft/class_2960;named valueLnet/minecraft/util/registry/RegistryKey;value:Lnet/minecraft/util/Identifier;
-
-
Constructor Details
-
RegistryKey
- Mappings:
Namespace Name Mixin selector official <init>Lwv;<init>(Lww;Lww;)Vintermediary <init>Lnet/minecraft/class_5321;<init>(Lnet/minecraft/class_2960;Lnet/minecraft/class_2960;)Vnamed <init>Lnet/minecraft/util/registry/RegistryKey;<init>(Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)V
-
-
Method Details
-
of
Creates a registry key for a value in a registry with a registry key for the value-holding registry in the root registry and an identifier of the value.You can call it like
RegistryKey.of(Registry.ITEM_KEY, new Identifier("iron_ingot"))to create a registry key for iron ingot.- Type Parameters:
T- the type of the value- Parameters:
registry- the registry key of the registry in the root registryvalue- the identifier of the value- Mappings:
Namespace Name Mixin selector official aLwv;a(Lwv;Lww;)Lwv;intermediary method_29179Lnet/minecraft/class_5321;method_29179(Lnet/minecraft/class_5321;Lnet/minecraft/class_2960;)Lnet/minecraft/class_5321;named ofLnet/minecraft/util/registry/RegistryKey;of(Lnet/minecraft/util/registry/RegistryKey;Lnet/minecraft/util/Identifier;)Lnet/minecraft/util/registry/RegistryKey;
-
ofRegistry
Creates a registry key for a registry in the root registry (registry of all registries) with an identifier for the registry.You can call it like
RegistryKey.of(new Identifier("block"))to create a registry key for the block registry.- Type Parameters:
T- the element type of the registry- Parameters:
registry- the identifier of the registry- Mappings:
Namespace Name Mixin selector official aLwv;a(Lww;)Lwv;intermediary method_29180Lnet/minecraft/class_5321;method_29180(Lnet/minecraft/class_2960;)Lnet/minecraft/class_5321;named ofRegistryLnet/minecraft/util/registry/RegistryKey;ofRegistry(Lnet/minecraft/util/Identifier;)Lnet/minecraft/util/registry/RegistryKey;
-
of
- Mappings:
Namespace Name Mixin selector official aLwv;a(Lww;Lww;)Lwv;intermediary method_29181Lnet/minecraft/class_5321;method_29181(Lnet/minecraft/class_2960;Lnet/minecraft/class_2960;)Lnet/minecraft/class_5321;named ofLnet/minecraft/util/registry/RegistryKey;of(Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/util/registry/RegistryKey;
-
toString
-
isOf
Returns whether this registry key belongs to the given registry (according to its type, not whether the registry actually contains this key).- Parameters:
registry- the key of the registry that this registry key should be inside- Mappings:
Namespace Name Mixin selector official aLwv;a(Lwv;)Zintermediary method_31163Lnet/minecraft/class_5321;method_31163(Lnet/minecraft/class_5321;)Znamed isOfLnet/minecraft/util/registry/RegistryKey;isOf(Lnet/minecraft/util/registry/RegistryKey;)Z
-
getValue
- Mappings:
Namespace Name Mixin selector official aLwv;a()Lww;intermediary method_29177Lnet/minecraft/class_5321;method_29177()Lnet/minecraft/class_2960;named getValueLnet/minecraft/util/registry/RegistryKey;getValue()Lnet/minecraft/util/Identifier;
-
createKeyFactory
public static <T> Function<Identifier,RegistryKey<T>> createKeyFactory(RegistryKey<? extends Registry<T>> registry)Creates a function that converts an identifier to a registry key for the registry thatregistryrefers to in the root registry.- Parameters:
registry- the reference to the value-holding registry in the root registry- Mappings:
Namespace Name Mixin selector official bLwv;b(Lwv;)Ljava/util/function/Function;intermediary method_29178Lnet/minecraft/class_5321;method_29178(Lnet/minecraft/class_5321;)Ljava/util/function/Function;named createKeyFactoryLnet/minecraft/util/registry/RegistryKey;createKeyFactory(Lnet/minecraft/util/registry/RegistryKey;)Ljava/util/function/Function;
-