Class LocalPlayerStatsProvider

java.lang.Object
com.thecsdev.commonmc.api.stats.PlayerStatsProvider<@NotNull net.minecraft.client.player.LocalPlayer>
com.thecsdev.commonmc.api.client.stats.LocalPlayerStatsProvider
All Implemented Interfaces:
IStatsProvider

@Environment(CLIENT) public final class LocalPlayerStatsProvider extends PlayerStatsProvider<@NotNull net.minecraft.client.player.LocalPlayer>
A IStatsProvider that provides statistics of a LocalPlayer.
  • Method Details

    • getPlayer

      public final net.minecraft.client.player.LocalPlayer getPlayer()
      Description copied from class: PlayerStatsProvider
      Returns the Player instance this PlayerStatsProvider is related to.
      Specified by:
      getPlayer in class PlayerStatsProvider<@NotNull net.minecraft.client.player.LocalPlayer>
    • getIntValue

      public final <T> int getIntValue(net.minecraft.stats.Stat<T> stat)
      Description copied from interface: IStatsProvider
      Returns the Integer value of a given Stat.
      Parameters:
      stat - The Stat whose value is to be obtained.
      See Also:
      • StatsCounter
    • getIntValue

      public final <T> int getIntValue(@NotNull @NotNull net.minecraft.stats.StatType<T> type, @NotNull T subject)
      Description copied from interface: IStatsProvider
      Returns the Integer value of a given StatType and its corresponding Stat.
      Parameters:
      type - The StatType.
      subject - The subject about whom stat value is to be obtained.
      See Also:
      • StatsCounter
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • of

      public static final LocalPlayerStatsProvider of(@NotNull @NotNull net.minecraft.client.player.LocalPlayer player) throws NullPointerException
      Creates a LocalPlayerStatsProvider instance based on a LocalPlayer.
      Parameters:
      player - The LocalPlayer.
      Throws:
      NullPointerException - If the argument is null.
    • ofCurrentLocalPlayer

      public static final LocalPlayerStatsProvider ofCurrentLocalPlayer() throws NullPointerException
      Creates a LocalPlayerStatsProvider instance using Minecraft.player.
      Throws:
      NullPointerException - If Minecraft.player is null.