Interface RegistryReference<T>

Type Parameters:
T - The type
All Superinterfaces:
RegistryKey<T>
All Known Subinterfaces:
DefaultedRegistryReference<T>

public interface RegistryReference<T> extends RegistryKey<T>
A utility key with handy methods to make retrieval of values from a holder easier.
  • Method Details Link icon

    • referenced Link icon

      static <T> RegistryReference<T> referenced(RegistryHolder holder, RegistryType<T> registry, T value)
    • get Link icon

      T get(RegistryHolder... holders)
      Gets the value from the holders.

      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 ValueNotFoundException

      will be thrown. Therefore, it is advised to call find(RegistryHolder...) instead.
      Parameters:
      holders - The holders to look against
      Returns:
      The value
    • find Link icon

      Optional<T> find(RegistryHolder... holders)
      Gets the value from the holders.

      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