Interface RegisteredResource<T>

Type Parameters:
T - The type of the backing registry entry.
All Superinterfaces:
Resource
All Known Subinterfaces:
DataComponentHolderResource<T>
All Known Implementing Classes:
FluidResource, ItemResource

public interface RegisteredResource<T> extends Resource
Helper interface for resources backed by a registry entry.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns The registered holder of the backing resource.
    default boolean
    is(Predicate<Holder<T>> predicate)
     
    default boolean
    is(Holder<T> holder)
     
    default boolean
    is(HolderSet<T> holders)
     
    default boolean
    is(TagKey<T> tag)
     
    default boolean
    is(T instance)
     
    Returns the backing instance of the resource.

    Methods inherited from interface net.neoforged.neoforge.transfer.resource.Resource

    isEmpty
  • Method Details

    • value

      T value()
      Returns the backing instance of the resource.
      Returns:
      the backing instance of the resource
    • getHolder

      Holder<T> getHolder()
      Returns The registered holder of the backing resource.
      Returns:
      The registered holder of the backing resource
    • is

      @NonExtendable default boolean is(TagKey<T> tag)
      Parameters:
      tag - Tag to check
      Returns:
      true if the holder from getHolder() is in the specified tag
    • is

      @NonExtendable default boolean is(T instance)
      Parameters:
      instance - the instance to compare
      Returns:
      true if an exact equality comparison ('==') between the instance provided and the value from value() is true
    • is

      @NonExtendable default boolean is(Predicate<Holder<T>> predicate)
      Parameters:
      predicate - The predicate to perform the test.
      Returns:
      true if the predicate's test returns true for the holder from getHolder().
    • is

      @NonExtendable default boolean is(Holder<T> holder)
      Parameters:
      holder - the holder to check
      Returns:
      true if the holder's value is the instance value from value()
    • is

      @NonExtendable default boolean is(HolderSet<T> holders)
      Parameters:
      holders - Set of holders to check
      Returns:
      true if the holder set contains the holder provided from getHolder()