Interface CompositeAwareChild
- All Superinterfaces:
ExtractableStorage,InsertableStorage,Storage,StorageView
- All Known Implementing Classes:
CompositeStorageImpl,ExternalStorage
@API(status=STABLE,
since="2.0.0-milestone.1.4")
public interface CompositeAwareChild
extends Storage
Implement this on storages that need to be aware of the fact that they are contained in a
CompositeStorage.
Typically, this is needed so that storages that dynamically modify their underlying storage sources, can propagate
the changes to the parent composite list.
Another reason to be aware of the parent composite is to be able to override the amount modified into the composite
cache list.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncompositeExtract(ResourceKey resource, long amount, Action action, Actor actor) Extracts a resource from a storage.compositeInsert(ResourceKey resource, long amount, Action action, Actor actor) Inserts a resource into a storage.default booleanvoidonAddedIntoComposite(ParentComposite parentComposite) Called by aCompositeStoragewhen thisCompositeAwareChildis added into the composite storage.voidonRemovedFromComposite(ParentComposite parentComposite) Called by aCompositeStoragewhen thisCompositeAwareChildis removed from the composite storage.Methods inherited from interface com.refinedmods.refinedstorage.api.storage.ExtractableStorage
extractMethods inherited from interface com.refinedmods.refinedstorage.api.storage.InsertableStorage
insertMethods inherited from interface com.refinedmods.refinedstorage.api.storage.StorageView
getAll, getStored
-
Method Details
-
onAddedIntoComposite
Called by aCompositeStoragewhen thisCompositeAwareChildis added into the composite storage.- Parameters:
parentComposite- the composite storage that thisCompositeAwareChildis contained in
-
onRemovedFromComposite
Called by aCompositeStoragewhen thisCompositeAwareChildis removed from the composite storage.- Parameters:
parentComposite- the composite storage that thisCompositeAwareChildis/was contained in
-
compositeInsert
CompositeAwareChild.Amount compositeInsert(ResourceKey resource, long amount, Action action, Actor actor) Inserts a resource into a storage.- 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
-
compositeExtract
CompositeAwareChild.Amount compositeExtract(ResourceKey resource, long amount, Action action, Actor actor) Extracts a resource from a storage.- 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
-
contains
-