Package dev.jaxydog.astral.utility
Class CurrencyHelper.CurrencyMap<T extends CurrencyHelper.ItemRepresentable>
java.lang.Object
dev.jaxydog.astral.utility.CurrencyHelper.CurrencyMap<T>
- Type Parameters:
T- The currency type.
- Enclosing interface:
CurrencyHelper
public static final class CurrencyHelper.CurrencyMap<T extends CurrencyHelper.ItemRepresentable>
extends Object
A map containing values of a specified currency type.
- Since:
- 2.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the map.entrySet()Returns a set containing the registered values and their identifiers.find(net.minecraft.item.Item item) Finds and returns the value associated with the provided item.find(net.minecraft.item.ItemStack stack) Finds and returns the value associated with the provided item stack.find(net.minecraft.util.Identifier identifier) Finds and returns the value associated with the provided item identifier.Optional<net.minecraft.util.Identifier> Finds and returns the identifier of the provided value.booleanisEmpty()Returns whether the map is empty.Set<net.minecraft.util.Identifier> keySet()Returns a set containing the identifiers within this map.intLoads the given values into this map.intSets the values at the given identifiers.intSets the value at the given identifier.intsize()Returns the total number of entries within the map.values()Returns a collection containing the values within this map.
-
Constructor Details
-
CurrencyMap
public CurrencyMap()
-
-
Method Details
-
set
Sets the value at the given identifier.- Parameters:
identifier- The identifier.value- The currency value.- Returns:
- The new size of the map.
- Since:
- 2.0.0
-
set
Sets the values at the given identifiers.- Parameters:
values- The value map.- Returns:
- The new size of the map.
- Since:
- 2.0.0
-
clear
public void clear()Clears the map.- Since:
- 2.0.0
-
load
Loads the given values into this map.- Parameters:
values- The value map.- Returns:
- The new size of the map.
- Since:
- 2.0.0
-
find
Finds and returns the value associated with the provided item identifier.- Parameters:
identifier- The item's identifier.- Returns:
- The value associated with the provided item identifier.
- Since:
- 2.0.0
-
find
Finds and returns the value associated with the provided item.- Parameters:
item- The item.- Returns:
- The value associated with the provided item.
- Since:
- 2.0.0
-
find
Finds and returns the value associated with the provided item stack.- Parameters:
stack- The item stack.- Returns:
- The value associated with the provided item stack.
- Since:
- 2.0.0
-
getId
Finds and returns the identifier of the provided value.- Parameters:
value- The value.- Returns:
- The identifier of the provided value.
- Since:
- 2.0.0
-
size
public int size()Returns the total number of entries within the map.- Returns:
- The total number of entries within the map.
- Since:
- 2.0.0
-
isEmpty
public boolean isEmpty()Returns whether the map is empty.- Returns:
- Whether the map is empty.
- Since:
- 2.0.0
-
entrySet
Returns a set containing the registered values and their identifiers.- Returns:
- A set containing the registered values and their identifiers.
- Since:
- 2.0.0
-
keySet
Returns a set containing the identifiers within this map.- Returns:
- A set containing the identifiers within this map.
- Since:
- 2.0.0
-
values
Returns a collection containing the values within this map.- Returns:
- A collection containing the values within this map.
- Since:
- 2.0.0
-