Class StateTrackedStorage
java.lang.Object
com.refinedmods.refinedstorage.api.storage.StateTrackedStorage
- All Implemented Interfaces:
ExtractableStorage
,InsertableStorage
,LimitedStorage
,Storage
,StorageView
,TrackedStorage
-
Nested Class Summary
-
Constructor Summary
ConstructorDescriptionStateTrackedStorage
(Storage delegate, StateTrackedStorage.Listener listener) -
Method Summary
Modifier and TypeMethodDescriptionstatic StorageState
computeState
(long capacity, long stored) long
extract
(ResourceKey resource, long amount, Action action, Actor actor) Extracts a resource from a storage.findTrackedResourceByActorType
(ResourceKey resource, Class<? extends Actor> actorType) Finds the tracked resource by actor type.getAll()
long
getState()
long
long
insert
(ResourceKey resource, long amount, Action action, Actor actor) Inserts a resource into a storage.
-
Constructor Details
-
StateTrackedStorage
-
-
Method Details
-
getDelegate
-
getState
-
computeState
-
extract
Description copied from interface:ExtractableStorage
Extracts a resource from a storage.- Specified by:
extract
in interfaceExtractableStorage
- Parameters:
resource
- the resource, may not be nullamount
- the amount, must be larger than 0action
- the mode of extractionactor
- the source- Returns:
- the amount extracted
-
insert
Description copied from interface:InsertableStorage
Inserts a resource into a storage.- Specified by:
insert
in interfaceInsertableStorage
- Parameters:
resource
- the resource, may not be nullamount
- the amount, must be larger than 0action
- the mode of insertionactor
- the source- Returns:
- the amount inserted
-
getAll
- Specified by:
getAll
in interfaceStorageView
- Returns:
- a list of resource amounts
-
getStored
public long getStored()- Specified by:
getStored
in interfaceStorageView
- 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 interfaceTrackedStorage
- Parameters:
resource
- the resourceactorType
- the actor type- Returns:
- the tracked resource modified by the given actor type, if present
-
getCapacity
public long getCapacity()- Specified by:
getCapacity
in interfaceLimitedStorage
-