Interface RegistryBacked
- All Known Subinterfaces:
BattleController
- All Known Implementing Classes:
MultiLaneBattleController,StandardBattleController
RegistryAccess.
This interface is intended for objects that need to resolve registry entries,
holders, or registry lookups without directly carrying individual registry references.
Implementations expose their RegistryAccess, while the default helper methods
provide convenient typed access to registries and registry-backed values.
The helper methods throw if the requested registry or entry is not present, making this most suitable for code paths where the referenced registry data is expected to exist.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> net.minecraft.core.Holder<T> holder(net.minecraft.resources.ResourceKey<T> key) Returns the holder for the given registry entry key.default <T> net.minecraft.core.HolderLookup.RegistryLookup<T> registry(net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> key) Returns a registry lookup for the given registry key.net.minecraft.core.RegistryAccessReturns the backing registry access used to resolve registries and entries.default <T> TregistryValue(net.minecraft.resources.ResourceKey<T> key) Returns the value for the given registry entry key.
-
Method Details
-
registryAccess
net.minecraft.core.RegistryAccess registryAccess()Returns the backing registry access used to resolve registries and entries.- Returns:
- the registry access for this object
-
registry
default <T> net.minecraft.core.HolderLookup.RegistryLookup<T> registry(net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<T>> key) Returns a registry lookup for the given registry key.The returned lookup can be used to resolve holders from the requested registry.
- Type Parameters:
T- the type of entries in the registry- Parameters:
key- the key of the registry to look up- Returns:
- a registry lookup for the given registry key
- Throws:
IllegalStateException- if the requested registry is not available
-
holder
default <T> net.minecraft.core.Holder<T> holder(net.minecraft.resources.ResourceKey<T> key) Returns the holder for the given registry entry key.The registry is inferred from
ResourceKey.registryKey(), then the entry is resolved from that registry.- Type Parameters:
T- the type of the registry entry- Parameters:
key- the key of the registry entry to resolve- Returns:
- the holder for the given registry entry
- Throws:
IllegalStateException- if the requested registry is not availableIllegalStateException- if the requested entry is not present in the registry
-
registryValue
default <T> T registryValue(net.minecraft.resources.ResourceKey<T> key) Returns the value for the given registry entry key.The registry is inferred from
ResourceKey.registryKey(), then the raw entry value is resolved from that registry.- Type Parameters:
T- the type of the registry entry- Parameters:
key- the key of the registry entry to resolve- Returns:
- the value for the given registry entry
- Throws:
IllegalStateException- if the requested registry is not availableIllegalStateException- if the requested entry is not present in the registry
-