Class AbstractProxyResourceList

java.lang.Object
com.refinedmods.refinedstorage.api.resource.list.AbstractProxyResourceList
All Implemented Interfaces:
ResourceList
Direct Known Subclasses:
FuzzyResourceListImpl, ListenableResourceList

@API(status=STABLE, since="2.0.0-milestone.1.2") public abstract class AbstractProxyResourceList extends Object implements ResourceList
This is a utility class to easily decorate a ResourceList.
  • Constructor Details

    • AbstractProxyResourceList

      protected AbstractProxyResourceList(ResourceList delegate)
  • Method Details

    • add

      public ResourceList.OperationResult add(ResourceKey resource, long amount)
      Description copied from interface: ResourceList
      Adds a given resource to the list.
      Specified by:
      add in interface ResourceList
      Parameters:
      resource - the resource, may not be null
      amount - the amount, must be larger than 0
      Returns:
      the result of the operation
    • remove

      public Optional<ResourceList.OperationResult> remove(ResourceKey resource, long amount)
      Description copied from interface: ResourceList
      Removes an amount of a certain resource in the list. If the amount reaches 0 due to this removal, the resource is removed from the list.
      Specified by:
      remove in interface ResourceList
      Parameters:
      resource - the resource, may not be null
      amount - the amount, must be larger than 0
      Returns:
      a result if the removal operation was successful, otherwise an empty Optional
    • copyState

      public Collection<ResourceAmount> copyState()
      Description copied from interface: ResourceList
      Retrieves all resources and their amounts from the list.
      Specified by:
      copyState in interface ResourceList
      Returns:
      a list of resource amounts
    • get

      public long get(ResourceKey resource)
      Specified by:
      get in interface ResourceList
      Parameters:
      resource - the resource
      Returns:
      the amount stored, or zero if not stored
    • contains

      public boolean contains(ResourceKey resource)
      Specified by:
      contains in interface ResourceList
      Parameters:
      resource - the resource
      Returns:
      whether the list contains this resource
    • getAll

      public Set<ResourceKey> getAll()
      Specified by:
      getAll in interface ResourceList
      Returns:
      set of resources contained in this list
    • copy

      public ResourceList copy()
      Description copied from interface: ResourceList
      Copies the list.
      Specified by:
      copy in interface ResourceList
    • clear

      public void clear()
      Description copied from interface: ResourceList
      Clears the list.
      Specified by:
      clear in interface ResourceList