Interface DynamicRegistryView
@NonExtendable
public interface DynamicRegistryView
A view providing access to the registries that are currently being loaded. This is passed to
the
DynamicRegistrySetupCallback event.- API Note:
- This might not contain all the registry, as the event is invoked for each layer of
the combined registry manager, and each layer holds different registries. For example, the biome
registry is not loaded in the
RegistryLayer.DIMENSIONSlayer.
-
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.core.RegistryAccess<T> Optional<net.minecraft.core.Registry<T>> getOptional(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<? extends T>> registryRef) Returns the registry identified by the resource key.<T> voidregisterEntryAdded(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<? extends T>> registryRef, RegistryEntryAddedCallback<T> callback) A shortcut to registerRegistryEntryAddedCallback.Stream<net.minecraft.core.Registry<?>> stream()
-
Method Details
-
asRegistryAccess
net.minecraft.core.RegistryAccess asRegistryAccess()- Returns:
- an
RegistryAccessinstance representing the registry view
-
stream
Stream<net.minecraft.core.Registry<?>> stream()- Returns:
- the stream of registries that are currently being loaded
-
getOptional
<T> Optional<net.minecraft.core.Registry<T>> getOptional(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<? extends T>> registryRef) Returns the registry identified by the resource key. This returns an empty optional if the key does not refer to a registry, or if the current combined registry layer being loaded does not contain the registry.- Parameters:
registryRef- the key of the registry to get- Returns:
- the registry, or
Optional.empty()if the registry is not currently being loaded
-
registerEntryAdded
<T> void registerEntryAdded(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<? extends T>> registryRef, RegistryEntryAddedCallback<T> callback) A shortcut to registerRegistryEntryAddedCallback.- Parameters:
registryRef- the resource key of the registry to register the event tocallback- the callback of the event
-