Interface DefaultedRegistryReference<T>

  • Type Parameters:
    T - The type
    All Superinterfaces:
    RegistryKey<T>, RegistryReference<T>, java.util.function.Supplier<T>

    public interface DefaultedRegistryReference<T>
    extends RegistryReference<T>, java.util.function.Supplier<T>
    A reference where the holder is given to us to search within a no-args get() method.

    Purely for convenience so that most default references in the API are not always calling out to the global holder simply by using it.

    • Method Detail

      • get

        T get()
        Gets the value from the default holder given when constructing this reference.

        Great care needs to be made in calling this method with any uncertainty as to if this reference will exist in the holder. Should this reference lack a value, a ValueNotFoundException will be thrown. Therefore, it is advised to call RegistryReference.find(RegistryHolder...) instead.

        Specified by:
        get in interface java.util.function.Supplier<T>
        Returns:
        The value
      • find

        java.util.Optional<T> find()
      • defaultHolder

        java.util.function.Supplier<RegistryHolder> defaultHolder()