Package org.spongepowered.api.registry
Interface RegistryReference<T>
-
- Type Parameters:
T
- The type
- All Superinterfaces:
RegistryKey<T>
- All Known Subinterfaces:
DefaultedRegistryReference<T>
public interface RegistryReference<T> extends RegistryKey<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
RegistryReference.Factory
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<T>
find(RegistryHolder... holders)
Gets the value from theholders
.T
get(RegistryHolder... holders)
Gets the value from theholders
.static <T> RegistryReference<T>
referenced(RegistryHolder holder, RegistryType<T> registry, T value)
-
Methods inherited from interface org.spongepowered.api.registry.RegistryKey
asDefaultedReference, asReference, location, registry
-
-
-
-
Method Detail
-
referenced
static <T> RegistryReference<T> referenced(RegistryHolder holder, RegistryType<T> registry, T value)
-
get
T get(RegistryHolder... holders)
Gets the value from theholders
.Behavior wise, the first holder that has a type of
registry
within will be queried for this reference. If the registry is present, no additional holders will be queried.Great care needs to be made in calling this method with any uncertainty as to if this reference will exist in the holders. Should this reference lack a value, a
will be thrown. Therefore, it is advised to callValueNotFoundException
find(RegistryHolder...)
instead.- Parameters:
holders
- The holders to look against- Returns:
- The value
-
find
Optional<T> find(RegistryHolder... holders)
Gets the value from theholders
.Behavior wise, the first holder that has a type of
registry
within will be queried for this reference. If the registry is present, no additional holders will be queried.- Parameters:
holders
- The holders to look against- Returns:
- The value
-
-