Class StateTrackedStorage

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

public class StateTrackedStorage extends Object implements TrackedStorage, LimitedStorage
  • Constructor Details

  • Method Details

    • getDelegate

      public Storage getDelegate()
    • getState

      public StorageState getState()
    • computeState

      public static StorageState computeState(long capacity, long stored)
    • 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
    • findTrackedResourceByActorType

      public Optional<TrackedResource> findTrackedResourceByActorType(ResourceKey resource, Class<? extends Actor> actorType)
      Description copied from interface: TrackedStorage
      Finds the tracked resource by actor type.
      Specified by:
      findTrackedResourceByActorType in interface TrackedStorage
      Parameters:
      resource - the resource
      actorType - the actor type
      Returns:
      the tracked resource modified by the given actor type, if present
    • getCapacity

      public long getCapacity()
      Specified by:
      getCapacity in interface LimitedStorage