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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears the map.
    Set<Map.Entry<net.minecraft.util.Identifier,T>>
    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>
    getId(T value)
    Finds and returns the identifier of the provided value.
    boolean
    Returns whether the map is empty.
    Set<net.minecraft.util.Identifier>
    Returns a set containing the identifiers within this map.
    int
    load(Map<net.minecraft.util.Identifier,T> values)
    Loads the given values into this map.
    int
    set(Map<net.minecraft.util.Identifier,T> values)
    Sets the values at the given identifiers.
    int
    set(net.minecraft.util.Identifier identifier, T value)
    Sets the value at the given identifier.
    int
    Returns the total number of entries within the map.
    Returns a collection containing the values within this map.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CurrencyMap

      public CurrencyMap()
  • Method Details

    • set

      public int set(net.minecraft.util.Identifier identifier, T value)
      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

      public int set(Map<net.minecraft.util.Identifier,T> values)
      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

      public int load(Map<net.minecraft.util.Identifier,T> values)
      Loads the given values into this map.
      Parameters:
      values - The value map.
      Returns:
      The new size of the map.
      Since:
      2.0.0
    • find

      public Optional<T> find(net.minecraft.util.Identifier identifier)
      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

      public Optional<T> find(net.minecraft.item.Item item)
      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

      public Optional<T> find(net.minecraft.item.ItemStack stack)
      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

      public Optional<net.minecraft.util.Identifier> getId(T value)
      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

      public Set<Map.Entry<net.minecraft.util.Identifier,T>> 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

      public Set<net.minecraft.util.Identifier> keySet()
      Returns a set containing the identifiers within this map.
      Returns:
      A set containing the identifiers within this map.
      Since:
      2.0.0
    • values

      public Collection<T> values()
      Returns a collection containing the values within this map.
      Returns:
      A collection containing the values within this map.
      Since:
      2.0.0