Class McbsStats

java.lang.Object
com.thecsdev.betterstats.api.mcbs.model.McbsStats
All Implemented Interfaces:
com.thecsdev.commonmc.api.stats.IStatsProvider

public final class McbsStats extends Object implements com.thecsdev.commonmc.api.stats.IStatsProvider
Container for holding statistics values, used by McbsFile.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    FunctionalInterface for consuming integer values stored in an McbsStats instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    addAll(@NotNull com.thecsdev.commonmc.api.stats.IStatsProvider statsProvider)
    Adds Stat entries from another IStatsProvider into this one, summing up values where applicable.
    final void
    Clears all statistics data.
    final void
    clearAndAddAll(@NotNull com.thecsdev.commonmc.api.stats.IStatsProvider statsProvider)
    Clears all existing Stat entries and adds all entries from another IStatsProvider.
    final void
    Iterates all integer values stored in this McbsStats instance.
    final int
    getIntValue(@NotNull net.minecraft.resources.Identifier type, @NotNull net.minecraft.resources.Identifier subject)
    Returns the value of a given integer-based statistic.
    final <T> int
    getIntValue(@NotNull net.minecraft.stats.Stat<T> stat)
    Returns the value of a given integer-based statistic.
    final <T> int
    getIntValue(@NotNull net.minecraft.stats.StatType<T> type, T subject)
    Returns the value of a given integer-based statistic.
    final @NotNull ConcurrentHashMap<net.minecraft.resources.Identifier, ConcurrentHashMap<net.minecraft.resources.Identifier, Integer>>
    Returns raw direct access to the main Map that holds all integer-based statistics values.
    final @NotNull ConcurrentHashMap<net.minecraft.resources.Identifier, Integer>
    getIntValues(@NotNull net.minecraft.resources.Identifier type)
    Returns the Map that contains integer-based statistics values for a given StatType.
    final void
    setIntValue(@NotNull net.minecraft.resources.Identifier type, @NotNull net.minecraft.resources.Identifier subject, int value)
    Sets the value of a given integer-based statistic.
    final <T> void
    setIntValue(@NotNull net.minecraft.stats.Stat<T> stat, int value)
    Sets the value of a given integer-based statistic.
    final <T> void
    setIntValue(@NotNull net.minecraft.stats.StatType<T> type, T subject, int value)
    Sets the value of a given integer-based statistic.

    Methods inherited from class Object

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

    • getIntValues

      @NotNull public final @NotNull ConcurrentHashMap<net.minecraft.resources.Identifier, ConcurrentHashMap<net.minecraft.resources.Identifier, Integer>> getIntValues()
      Returns raw direct access to the main Map that holds all integer-based statistics values.
    • getIntValues

      @NotNull public final @NotNull ConcurrentHashMap<net.minecraft.resources.Identifier, Integer> getIntValues(@NotNull @NotNull net.minecraft.resources.Identifier type) throws NullPointerException
      Returns the Map that contains integer-based statistics values for a given StatType.
      Parameters:
      type - The StatType's unique identifier.
      Throws:
      NullPointerException - If the argument is null.
    • getIntValue

      public final <T> int getIntValue(@NotNull @NotNull net.minecraft.stats.Stat<T> stat) throws NullPointerException
      Returns the value of a given integer-based statistic.
      Specified by:
      getIntValue in interface com.thecsdev.commonmc.api.stats.IStatsProvider
      Parameters:
      stat - The Stat whose value is to be returned.
      Throws:
      NullPointerException - If the argument is null.
      IllegalStateException - If a corresponding feature is not registered.
    • getIntValue

      public final <T> int getIntValue(@NotNull @NotNull net.minecraft.stats.StatType<T> type, @NotNull T subject) throws NullPointerException, IllegalStateException
      Returns the value of a given integer-based statistic.
      Specified by:
      getIntValue in interface com.thecsdev.commonmc.api.stats.IStatsProvider
      Parameters:
      type - The StatType.
      subject - The statistic subject.
      Throws:
      NullPointerException - If an argument is null.
      IllegalStateException - If a corresponding feature is not registered.
    • getIntValue

      public final int getIntValue(@NotNull @NotNull net.minecraft.resources.Identifier type, @NotNull @NotNull net.minecraft.resources.Identifier subject) throws NullPointerException
      Returns the value of a given integer-based statistic.
      Parameters:
      type - The StatType's unique identifier.
      subject - The statistic subject's unique identifier.
      Throws:
      NullPointerException - If an argument is null.
    • setIntValue

      public final <T> void setIntValue(@NotNull @NotNull net.minecraft.stats.Stat<T> stat, int value) throws NullPointerException
      Sets the value of a given integer-based statistic.
      Parameters:
      stat - The Stat whose value is to be set.
      value - The value to set.
      Throws:
      NullPointerException - If the argument is null.
    • setIntValue

      public final <T> void setIntValue(@NotNull @NotNull net.minecraft.stats.StatType<T> type, @NotNull T subject, int value) throws NullPointerException, IllegalStateException
      Sets the value of a given integer-based statistic.
      Parameters:
      type - The StatType.
      subject - The statistic subject.
      value - The value to set.
      Throws:
      NullPointerException - If an argument is null.
      IllegalStateException - If a corresponding feature is not registered.
    • setIntValue

      public final void setIntValue(@NotNull @NotNull net.minecraft.resources.Identifier type, @NotNull @NotNull net.minecraft.resources.Identifier subject, int value) throws NullPointerException
      Sets the value of a given integer-based statistic.
      Parameters:
      type - The StatType's unique identifier.
      subject - The statistic subject's unique identifier.
      value - The value to set.
      Throws:
      NullPointerException - If an argument is null.
    • addAll

      public final void addAll(@NotNull @NotNull com.thecsdev.commonmc.api.stats.IStatsProvider statsProvider)
      Adds Stat entries from another IStatsProvider into this one, summing up values where applicable. Supports McbsStats instances as argument.
      Parameters:
      statsProvider - The other IStatsProvider.
      Throws:
      NullPointerException - If the argument is null.
    • clearAndAddAll

      public final void clearAndAddAll(@NotNull @NotNull com.thecsdev.commonmc.api.stats.IStatsProvider statsProvider) throws NullPointerException
      Clears all existing Stat entries and adds all entries from another IStatsProvider.
      Parameters:
      statsProvider - The other IStatsProvider.
      Throws:
      NullPointerException - If the argument is null.
    • clear

      public final void clear()
      Clears all statistics data.
    • forEach

      public final void forEach(@NotNull McbsStats.IntValueConsumer consumer) throws NullPointerException
      Iterates all integer values stored in this McbsStats instance. Note that this does not offer value manipulation capabilities.
      Parameters:
      consumer - The consumer that will consume each value.
      Throws:
      NullPointerException - If the argument is null.