T
- the type of the valuepublic class RegistryKey<T> extends Object
Registry.ROOT
Modifier and Type | Field and Description |
---|---|
private static Map<String,RegistryKey<?>> |
INSTANCES
A cache of all registry keys ever created.
|
private Identifier |
registry
The identifier of the registry in the root registry.
|
private Identifier |
value
The identifier of the value in the registry specified by
registry . |
Modifier | Constructor and Description |
---|---|
private |
RegistryKey(Identifier registry,
Identifier value) |
Modifier and Type | Method and Description |
---|---|
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 that
registry refers to in the root registry. |
Identifier |
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).
|
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.
|
String |
toString() |
private static final Map<String,RegistryKey<?>> INSTANCES
private final Identifier registry
private final Identifier value
registry
.private RegistryKey(Identifier registry, Identifier value)
public static <T> RegistryKey<T> of(RegistryKey<? extends Registry<T>> registry, Identifier value)
You can call it like RegistryKey.of(Registry.ITEM_KEY, new Identifier("iron_ingot"))
to create a registry key for iron ingot.
T
- the type of the valueregistry
- the registry key of the registry in the root registryvalue
- the identifier of the valuepublic static <T> RegistryKey<Registry<T>> ofRegistry(Identifier registry)
You can call it like RegistryKey.of(new Identifier("block"))
to create a registry key for the block registry.
T
- the element type of the registryregistry
- the identifier of the registryprivate static <T> RegistryKey<T> of(Identifier registry, Identifier value)
public boolean isOf(RegistryKey<? extends Registry<?>> registry)
registry
- the key of the registry that this registry key should be insidepublic Identifier getValue()
public static <T> Function<Identifier,RegistryKey<T>> createKeyFactory(RegistryKey<? extends Registry<T>> registry)
registry
refers to in the root registry.registry
- the reference to the value-holding registry in the root registry