Class LimitedStorageImpl
java.lang.Object
com.refinedmods.refinedstorage.api.storage.AbstractProxyStorage
com.refinedmods.refinedstorage.api.storage.limited.LimitedStorageImpl
- All Implemented Interfaces:
ExtractableStorage
,InsertableStorage
,LimitedStorage
,Storage
,StorageView
@API(status=STABLE,
since="2.0.0-milestone.1.2")
public class LimitedStorageImpl
extends AbstractProxyStorage
implements LimitedStorage
This class can decorate any other
Storage
to add a capacity to it.
InsertableStorage.insert(com.refinedmods.refinedstorage.api.resource.ResourceKey, long, Action, Actor)
operations will respect this capacity.-
Field Summary
Fields inherited from class com.refinedmods.refinedstorage.api.storage.AbstractProxyStorage
delegate
-
Constructor Summary
ConstructorsConstructorDescriptionLimitedStorageImpl
(long capacity) Constructs the limited storage with aStorageImpl
storage.LimitedStorageImpl
(Storage delegate, long capacity) -
Method Summary
Modifier and TypeMethodDescriptionlong
long
insert
(ResourceKey resource, long amount, Action action, Actor actor) Inserts a resource into a storage.Methods inherited from class com.refinedmods.refinedstorage.api.storage.AbstractProxyStorage
extract, getAll, getStored
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.refinedmods.refinedstorage.api.storage.ExtractableStorage
extract
Methods inherited from interface com.refinedmods.refinedstorage.api.storage.StorageView
getAll, getStored
-
Constructor Details
-
LimitedStorageImpl
- Parameters:
delegate
- the storage that is being decoratedcapacity
- the capacity, must be 0 or larger than 0
-
LimitedStorageImpl
public LimitedStorageImpl(long capacity) Constructs the limited storage with aStorageImpl
storage.- Parameters:
capacity
- the capacity, must be 0 or larger than 0
-
-
Method Details
-
insert
Description copied from interface:InsertableStorage
Inserts a resource into a storage.- Specified by:
insert
in interfaceInsertableStorage
- Overrides:
insert
in classAbstractProxyStorage
- 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
-
getCapacity
public long getCapacity()- Specified by:
getCapacity
in interfaceLimitedStorage
-