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

    • referenced

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

      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

      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