Package org.spongepowered.api.registry
Interface RegistryHolder
-
- All Known Subinterfaces:
Client
,ClientWorld
,Engine
,Game
,LocalServer
,Server
,ServerWorld
,World<W,L>
public interface RegistryHolder
A holder ofregistries
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Optional<Registry<T>>
findRegistry(RegistryType<T> type)
<T> Registry<T>
registry(RegistryType<T> type)
Stream<Registry<?>>
streamRegistries(ResourceKey root)
Gets aStream
of theregistries
in this holder within a root.
-
-
-
Method Detail
-
registry
<T> Registry<T> registry(RegistryType<T> type)
Gets theRegistry
by akey
.Great care needs to be made in calling this method with any uncertainty as to if the key will exist in the holder. Should the key lack a value, a
ValueNotFoundException
will be thrown. Therefore, it is advised to callfindRegistry(RegistryType)
instead.- Type Parameters:
T
- The type- Parameters:
type
- The type- Returns:
- The registry
-
findRegistry
<T> Optional<Registry<T>> findRegistry(RegistryType<T> type)
- Type Parameters:
T
- The type- Parameters:
type
- The type- Returns:
- The registry or
Optional.empty()
-
streamRegistries
Stream<Registry<?>> streamRegistries(ResourceKey root)
Gets aStream
of theregistries
in this holder within a root.- Parameters:
root
- The root to stream registries of- Returns:
- The stream
-
-