Class AbstractProxyResourceList
java.lang.Object
com.refinedmods.refinedstorage.api.resource.list.AbstractProxyResourceList
- All Implemented Interfaces:
ResourceList
- Direct Known Subclasses:
FuzzyResourceListImpl
,ListenableResourceList
@API(status=STABLE,
since="2.0.0-milestone.1.2")
public abstract class AbstractProxyResourceList
extends Object
implements ResourceList
This is a utility class to easily decorate a
ResourceList
.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.refinedmods.refinedstorage.api.resource.list.ResourceList
ResourceList.OperationResult
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(ResourceKey resource, long amount) Adds a given resource to the list.void
clear()
Clears the list.boolean
contains
(ResourceKey resource) copy()
Copies the list.Retrieves all resources and their amounts from the list.long
get
(ResourceKey resource) getAll()
remove
(ResourceKey resource, long amount) Removes an amount of a certain resource in the list.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.resource.list.ResourceList
add, remove
-
Constructor Details
-
AbstractProxyResourceList
-
-
Method Details
-
add
Description copied from interface:ResourceList
Adds a given resource to the list.- Specified by:
add
in interfaceResourceList
- Parameters:
resource
- the resource, may not be nullamount
- the amount, must be larger than 0- Returns:
- the result of the operation
-
remove
Description copied from interface:ResourceList
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.- Specified by:
remove
in interfaceResourceList
- 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
-
copyState
Description copied from interface:ResourceList
Retrieves all resources and their amounts from the list.- Specified by:
copyState
in interfaceResourceList
- Returns:
- a list of resource amounts
-
get
- Specified by:
get
in interfaceResourceList
- Parameters:
resource
- the resource- Returns:
- the amount stored, or zero if not stored
-
contains
- Specified by:
contains
in interfaceResourceList
- Parameters:
resource
- the resource- Returns:
- whether the list contains this resource
-
getAll
- Specified by:
getAll
in interfaceResourceList
- Returns:
- set of resources contained in this list
-
copy
Description copied from interface:ResourceList
Copies the list.- Specified by:
copy
in interfaceResourceList
-
clear
public void clear()Description copied from interface:ResourceList
Clears the list.- Specified by:
clear
in interfaceResourceList
-