public abstract class DynamicRegistryManager extends Object
Each minecraft server has a dynamic registry manager for file-loaded registries, while each client play network handler has a dynamic registry manager for server-sent dynamic registries.
The DynamicRegistryManager.Impl
class serves as an immutable implementation of any particular collection
or configuration of dynamic registries.
Modifier and Type | Class and Description |
---|---|
static class |
DynamicRegistryManager.Impl
An immutable implementation of the dynamic registry manager, representing
a specialized configuration of registries.
|
(package private) static class |
DynamicRegistryManager.Info<E>
Represents the serialization behavior of the registries, including the
id of the registry, the codec for its elements, and whether the registry
should be sent to the client.
|
Modifier and Type | Field and Description |
---|---|
private static DynamicRegistryManager.Impl |
BUILTIN |
private static Map<RegistryKey<? extends Registry<?>>,DynamicRegistryManager.Info<?>> |
INFOS |
private static Logger |
LOGGER |
Constructor and Description |
---|
DynamicRegistryManager() |
Modifier and Type | Method and Description |
---|---|
private static <E> void |
addBuiltinEntries(DynamicRegistryManager.Impl manager,
Registry<E> registry)
Add all entries of the
registry to the corresponding registry
within this manager. |
private static <R extends Registry<?>> |
copyFromBuiltin(DynamicRegistryManager.Impl manager,
RegistryKey<R> registryRef)
Add all entries of the registry referred by
registryRef to the
corresponding registry within this manager. |
static DynamicRegistryManager.Impl |
create()
Creates a default dynamic registry manager.
|
<E> MutableRegistry<E> |
get(RegistryKey<? extends Registry<E>> key)
Retrieves a registry from this manager, or throws an exception when the
registry does not exist.
|
Registry<DimensionType> |
getDimensionTypes() |
abstract <E> Optional<MutableRegistry<E>> |
getOptional(RegistryKey<? extends Registry<E>> key)
Retrieves a registry optionally from this manager.
|
static void |
load(DynamicRegistryManager.Impl impl,
RegistryOps<?> registryOps)
Loads a dynamic registry manager from the resource manager's data files.
|
private static <E> void |
load(RegistryOps<?> ops,
DynamicRegistryManager.Impl manager,
DynamicRegistryManager.Info<E> info)
Loads elements from the
ops into the registry specified by info within the manager . |
private static <E> void |
method_31141(DynamicRegistryManager.Impl impl,
RegistryOps.EntryLoader.Impl impl2,
DynamicRegistryManager.Info<E> info) |
private static <E> void |
register(ImmutableMap.Builder<RegistryKey<? extends Registry<?>>,DynamicRegistryManager.Info<?>> infosBuilder,
RegistryKey<? extends Registry<E>> registryRef,
com.mojang.serialization.Codec<E> entryCodec) |
private static <E> void |
register(ImmutableMap.Builder<RegistryKey<? extends Registry<?>>,DynamicRegistryManager.Info<?>> infosBuilder,
RegistryKey<? extends Registry<E>> registryRef,
com.mojang.serialization.Codec<E> entryCodec,
com.mojang.serialization.Codec<E> networkEntryCodec) |
private static final Logger LOGGER
private static final Map<RegistryKey<? extends Registry<?>>,DynamicRegistryManager.Info<?>> INFOS
private static final DynamicRegistryManager.Impl BUILTIN
public abstract <E> Optional<MutableRegistry<E>> getOptional(RegistryKey<? extends Registry<E>> key)
public <E> MutableRegistry<E> get(RegistryKey<? extends Registry<E>> key)
IllegalStateException
- if the registry does not existpublic Registry<DimensionType> getDimensionTypes()
private static <E> void register(ImmutableMap.Builder<RegistryKey<? extends Registry<?>>,DynamicRegistryManager.Info<?>> infosBuilder, RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Codec<E> entryCodec)
private static <E> void register(ImmutableMap.Builder<RegistryKey<? extends Registry<?>>,DynamicRegistryManager.Info<?>> infosBuilder, RegistryKey<? extends Registry<E>> registryRef, com.mojang.serialization.Codec<E> entryCodec, com.mojang.serialization.Codec<E> networkEntryCodec)
public static DynamicRegistryManager.Impl create()
private static <E> void method_31141(DynamicRegistryManager.Impl impl, RegistryOps.EntryLoader.Impl impl2, DynamicRegistryManager.Info<E> info)
private static <R extends Registry<?>> void copyFromBuiltin(DynamicRegistryManager.Impl manager, RegistryKey<R> registryRef)
registryRef
to the
corresponding registry within this manager.private static <E> void addBuiltinEntries(DynamicRegistryManager.Impl manager, Registry<E> registry)
registry
to the corresponding registry
within this manager.public static void load(DynamicRegistryManager.Impl impl, RegistryOps<?> registryOps)
private static <E> void load(RegistryOps<?> ops, DynamicRegistryManager.Impl manager, DynamicRegistryManager.Info<E> info)
ops
into the registry specified by info
within the manager
. Note that the resource manager instance
is kept within the ops
.