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.
  • Method Details

    • add

      MutableResourceList.OperationResult add(ResourceKey resource, long amount)
      Adds a given resource to the list.
      Parameters:
      resource - the resource, may not be null
      amount - the amount, must be larger than 0
      Returns:
      the result of the operation
    • add

      Adds a given resource to the list. Shorthand for add(ResourceKey, long).
      Parameters:
      resourceAmount - the resource and the amount
      Returns:
      the result of the operation
    • remove

      @Nullable MutableResourceList.OperationResult remove(ResourceKey resource, long amount)
      Removes as much of a certain amount of a 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 null
      amount - the amount, must be larger than 0
      Returns:
      a result if the removal operation was successful, otherwise null
    • remove

      @Nullable default MutableResourceList.OperationResult remove(ResourceAmount resourceAmount)
      Removes as much of a certain amount of a resource in the list. If the amount reaches 0 due to this removal, the resource is removed from the list. Shorthand for remove(ResourceKey, long).
      Parameters:
      resourceAmount - the resource and the amount
      Returns:
      a result if the removal operation was successful, otherwise null
    • clear

      void clear()
      Clears the list.
    • copy

      Copies the list.