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 boolean
void
onAddedIntoComposite
(ParentComposite parentComposite) Called by aCompositeStorage
when thisCompositeAwareChild
is added into the composite storage.void
onRemovedFromComposite
(ParentComposite parentComposite) Called by aCompositeStorage
when thisCompositeAwareChild
is removed from the composite storage.Methods inherited from interface com.refinedmods.refinedstorage.api.storage.ExtractableStorage
extract
Methods inherited from interface com.refinedmods.refinedstorage.api.storage.InsertableStorage
insert
Methods inherited from interface com.refinedmods.refinedstorage.api.storage.StorageView
getAll, getStored
-
Method Details
-
onAddedIntoComposite
Called by aCompositeStorage
when thisCompositeAwareChild
is added into the composite storage.- Parameters:
parentComposite
- the composite storage that thisCompositeAwareChild
is contained in
-
onRemovedFromComposite
Called by aCompositeStorage
when thisCompositeAwareChild
is removed from the composite storage.- Parameters:
parentComposite
- the composite storage that thisCompositeAwareChild
is/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
-