Package net.minecraft.registry
Class RegistryKey<T>
java.lang.Object
net.minecraft.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:
- Mappings:
Namespace Name named net/minecraft/registry/RegistryKey
intermediary net/minecraft/class_5321
official akp
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final ConcurrentMap
<RegistryKey.RegistryIdPair, RegistryKey<?>> A cache of all registry keys ever created.private final Identifier
The identifier of the registry in the root registry.private final Identifier
The identifier of the value in the registry specified byregistry
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> com.mojang.serialization.Codec
<RegistryKey<T>> createCodec
(RegistryKey<? extends Registry<T>> registry) static <T> PacketCodec
<ByteBuf, RegistryKey<T>> createPacketCodec
(RegistryKey<? extends Registry<T>> registry) getValue()
boolean
isOf
(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).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.private static <T> RegistryKey
<T> of
(Identifier registry, Identifier 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()
<E> Optional
<RegistryKey<E>> tryCast
(RegistryKey<? extends Registry<E>> registryRef)
-
Field Details
-
INSTANCES
A cache of all registry keys ever created.- Mappings:
Namespace Name Mixin selector named INSTANCES
Lnet/minecraft/registry/RegistryKey;INSTANCES:Ljava/util/concurrent/ConcurrentMap;
intermediary field_25136
Lnet/minecraft/class_5321;field_25136:Ljava/util/concurrent/ConcurrentMap;
official a
Lakp;a:Ljava/util/concurrent/ConcurrentMap;
-
registry
The identifier of the registry in the root registry.- Mappings:
Namespace Name Mixin selector named registry
Lnet/minecraft/registry/RegistryKey;registry:Lnet/minecraft/util/Identifier;
intermediary field_25137
Lnet/minecraft/class_5321;field_25137:Lnet/minecraft/class_2960;
official b
Lakp;b:Lakq;
-
value
The identifier of the value in the registry specified byregistry
.- Mappings:
Namespace Name Mixin selector named value
Lnet/minecraft/registry/RegistryKey;value:Lnet/minecraft/util/Identifier;
intermediary field_25138
Lnet/minecraft/class_5321;field_25138:Lnet/minecraft/class_2960;
official c
Lakp;c:Lakq;
-
-
Constructor Details
-
RegistryKey
- Mappings:
Namespace Name Mixin selector named <init>
Lnet/minecraft/registry/RegistryKey;<init>(Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)V
intermediary <init>
Lnet/minecraft/class_5321;<init>(Lnet/minecraft/class_2960;Lnet/minecraft/class_2960;)V
official <init>
Lakp;<init>(Lakq;Lakq;)V
-
-
Method Details
-
createCodec
public static <T> com.mojang.serialization.Codec<RegistryKey<T>> createCodec(RegistryKey<? extends Registry<T>> registry) - Mappings:
Namespace Name Mixin selector named createCodec
Lnet/minecraft/registry/RegistryKey;createCodec(Lnet/minecraft/registry/RegistryKey;)Lcom/mojang/serialization/Codec;
intermediary method_39154
Lnet/minecraft/class_5321;method_39154(Lnet/minecraft/class_5321;)Lcom/mojang/serialization/Codec;
official a
Lakp;a(Lakp;)Lcom/mojang/serialization/Codec;
-
createPacketCodec
public static <T> PacketCodec<ByteBuf,RegistryKey<T>> createPacketCodec(RegistryKey<? extends Registry<T>> registry) - Mappings:
Namespace Name Mixin selector named createPacketCodec
Lnet/minecraft/registry/RegistryKey;createPacketCodec(Lnet/minecraft/registry/RegistryKey;)Lnet/minecraft/network/codec/PacketCodec;
intermediary method_56038
Lnet/minecraft/class_5321;method_56038(Lnet/minecraft/class_5321;)Lnet/minecraft/class_9139;
official b
Lakp;b(Lakp;)Lyw;
-
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 named of
Lnet/minecraft/registry/RegistryKey;of(Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/util/Identifier;)Lnet/minecraft/registry/RegistryKey;
intermediary method_29179
Lnet/minecraft/class_5321;method_29179(Lnet/minecraft/class_5321;Lnet/minecraft/class_2960;)Lnet/minecraft/class_5321;
official a
Lakp;a(Lakp;Lakq;)Lakp;
-
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 named ofRegistry
Lnet/minecraft/registry/RegistryKey;ofRegistry(Lnet/minecraft/util/Identifier;)Lnet/minecraft/registry/RegistryKey;
intermediary method_29180
Lnet/minecraft/class_5321;method_29180(Lnet/minecraft/class_2960;)Lnet/minecraft/class_5321;
official a
Lakp;a(Lakq;)Lakp;
-
of
- Mappings:
Namespace Name Mixin selector named of
Lnet/minecraft/registry/RegistryKey;of(Lnet/minecraft/util/Identifier;Lnet/minecraft/util/Identifier;)Lnet/minecraft/registry/RegistryKey;
intermediary method_29181
Lnet/minecraft/class_5321;method_29181(Lnet/minecraft/class_2960;Lnet/minecraft/class_2960;)Lnet/minecraft/class_5321;
official a
Lakp;a(Lakq;Lakq;)Lakp;
-
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 named isOf
Lnet/minecraft/registry/RegistryKey;isOf(Lnet/minecraft/registry/RegistryKey;)Z
intermediary method_31163
Lnet/minecraft/class_5321;method_31163(Lnet/minecraft/class_5321;)Z
official c
Lakp;c(Lakp;)Z
-
tryCast
- Returns:
Optional.of(this)
if the key is ofregistryRef
, otherwiseOptional.empty()
- API Note:
- This can be used to safely cast an unknown key to
RegistryKey<E>
by passing the registryE
. - Mappings:
Namespace Name Mixin selector named tryCast
Lnet/minecraft/registry/RegistryKey;tryCast(Lnet/minecraft/registry/RegistryKey;)Ljava/util/Optional;
intermediary method_39752
Lnet/minecraft/class_5321;method_39752(Lnet/minecraft/class_5321;)Ljava/util/Optional;
official d
Lakp;d(Lakp;)Ljava/util/Optional;
-
getValue
- Mappings:
Namespace Name Mixin selector named getValue
Lnet/minecraft/registry/RegistryKey;getValue()Lnet/minecraft/util/Identifier;
intermediary method_29177
Lnet/minecraft/class_5321;method_29177()Lnet/minecraft/class_2960;
official a
Lakp;a()Lakq;
-
getRegistry
- Mappings:
Namespace Name Mixin selector named getRegistry
Lnet/minecraft/registry/RegistryKey;getRegistry()Lnet/minecraft/util/Identifier;
intermediary method_41185
Lnet/minecraft/class_5321;method_41185()Lnet/minecraft/class_2960;
official b
Lakp;b()Lakq;
-
getRegistryRef
- Mappings:
Namespace Name Mixin selector named getRegistryRef
Lnet/minecraft/registry/RegistryKey;getRegistryRef()Lnet/minecraft/registry/RegistryKey;
intermediary method_58273
Lnet/minecraft/class_5321;method_58273()Lnet/minecraft/class_5321;
official c
Lakp;c()Lakp;
-