Class StorageImpl

java.lang.Object
com.refinedmods.refinedstorage.api.storage.StorageImpl
All Implemented Interfaces:
ExtractableStorage, InsertableStorage, Storage, StorageView

@API(status=STABLE, since="2.0.0-milestone.1.0") public class StorageImpl extends Object implements Storage
An implementation of a Storage which has a resource list as a backing list.
  • Constructor Details

    • StorageImpl

      public StorageImpl(ResourceList list)
    • StorageImpl

      public StorageImpl()
  • 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