Class AbstractProxyStorage

java.lang.Object
com.refinedmods.refinedstorage.api.storage.AbstractProxyStorage
All Implemented Interfaces:
ExtractableStorage, InsertableStorage, Storage, StorageView
Direct Known Subclasses:
LimitedStorageImpl, PriorityStorage, TrackedStorageImpl

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

    • delegate

      protected final Storage delegate
  • Constructor Details

    • AbstractProxyStorage

      protected AbstractProxyStorage(Storage delegate)
      Parameters:
      delegate - the storage to delegate operations to, may not be null
  • Method Details

    • extract

      public long extract(ResourceKey resource, long amount, Action action, Actor actor)
      Description copied from interface: ExtractableStorage
      Extracts a resource from a storage.
      Specified by:
      extract in interface ExtractableStorage
      Parameters:
      resource - the resource, may not be null
      amount - the amount, must be larger than 0
      action - the mode of extraction
      actor - the source
      Returns:
      the amount extracted
    • insert

      public long insert(ResourceKey resource, long amount, Action action, Actor actor)
      Description copied from interface: InsertableStorage
      Inserts a resource into a storage.
      Specified by:
      insert in interface InsertableStorage
      Parameters:
      resource - the resource, may not be null
      amount - the amount, must be larger than 0
      action - the mode of insertion
      actor - the source
      Returns:
      the amount inserted
    • getAll

      public Collection<ResourceAmount> getAll()
      Specified by:
      getAll in interface StorageView
      Returns:
      a list of resource amounts
    • getStored

      public long getStored()
      Specified by:
      getStored in interface StorageView
      Returns:
      the amount stored