Class DynamicRegistryViewImpl
java.lang.Object
net.fabricmc.fabric.impl.registry.sync.DynamicRegistryViewImpl
- All Implemented Interfaces:
DynamicRegistryView
-
Constructor Summary
ConstructorsConstructorDescriptionDynamicRegistryViewImpl(Map<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>, net.minecraft.core.Registry<?>> registries) -
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()
-
Constructor Details
-
DynamicRegistryViewImpl
public DynamicRegistryViewImpl(Map<net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>, net.minecraft.core.Registry<?>> registries)
-
-
Method Details
-
asRegistryAccess
public net.minecraft.core.RegistryAccess asRegistryAccess()- Specified by:
asRegistryAccessin interfaceDynamicRegistryView- Returns:
- an
RegistryAccessinstance representing the registry view
-
stream
- Specified by:
streamin interfaceDynamicRegistryView- Returns:
- the stream of registries that are currently being loaded
-
getOptional
public <T> Optional<net.minecraft.core.Registry<T>> getOptional(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<? extends T>> registryRef) Description copied from interface:DynamicRegistryViewReturns 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.- Specified by:
getOptionalin interfaceDynamicRegistryView- Parameters:
registryRef- the key of the registry to get- Returns:
- the registry, or
Optional.empty()if the registry is not currently being loaded
-
registerEntryAdded
public <T> void registerEntryAdded(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<? extends T>> registryRef, RegistryEntryAddedCallback<T> callback) Description copied from interface:DynamicRegistryViewA shortcut to registerRegistryEntryAddedCallback.- Specified by:
registerEntryAddedin interfaceDynamicRegistryView- Parameters:
registryRef- the resource key of the registry to register the event tocallback- the callback of the event
-