Interface MutableResourceList
- All Superinterfaces:
ResourceList
- All Known Implementing Classes:
AbstractProxyMutableResourceList
,FuzzyResourceListImpl
,ListenableResourceList
,MutableResourceListImpl
@API(status=STABLE,
since="2.0.0-milestone.1.2")
public interface MutableResourceList
extends ResourceList
Mutable variant of
ResourceList
.
Implementation can be found in MutableResourceListImpl
.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final record
Represents the result of an operation in aMutableResourceList
. -
Method Summary
Modifier and TypeMethodDescriptionadd
(ResourceAmount resourceAmount) Adds a given resource to the list.add
(ResourceKey resource, long amount) Adds a given resource to the list.void
clear()
Clears the list.copy()
Copies the list.remove
(ResourceAmount resourceAmount) Removes an amount of a certain resource in the list.remove
(ResourceKey resource, long amount) Removes an amount of a certain resource in the list.Methods inherited from interface com.refinedmods.refinedstorage.api.resource.list.ResourceList
contains, copyState, get, getAll
-
Method Details
-
add
Adds a given resource to the list.- Parameters:
resource
- the resource, may not be nullamount
- the amount, must be larger than 0- Returns:
- the result of the operation
-
add
Adds a given resource to the list. Shorthand foradd(ResourceKey, long)
.- Parameters:
resourceAmount
- the resource and the amount- Returns:
- the result of the operation
-
remove
Removes an amount of a certain resource in the list. If the amount reaches 0 due to this removal, the resource is removed from the list.- Parameters:
resource
- the resource, may not be nullamount
- the amount, must be larger than 0- Returns:
- a result if the removal operation was successful, otherwise an empty
Optional
-
remove
Removes an amount of a certain resource in the list. If the amount reaches 0 due to this removal, the resource is removed from the list. Shorthand forremove(ResourceKey, long)
.- Parameters:
resourceAmount
- the resource and the amount- Returns:
- a result if the removal operation was successful, otherwise an empty
Optional
-
clear
void clear()Clears the list. -
copy
MutableResourceList copy()Copies the list.
-