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 aStorageImplstorage.LimitedStorageImpl(Storage delegate, long capacity) -
Method Summary
Modifier and TypeMethodDescriptionlonglonginsert(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, getStoredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.refinedmods.refinedstorage.api.storage.ExtractableStorage
extractMethods 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 aStorageImplstorage.- Parameters:
capacity- the capacity, must be 0 or larger than 0
-
-
Method Details
-
insert
Description copied from interface:InsertableStorageInserts a resource into a storage.- Specified by:
insertin interfaceInsertableStorage- Overrides:
insertin 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:
getCapacityin interfaceLimitedStorage
-