Interface IStatsProvider
- All Known Implementing Classes:
EmptyStatsProvider, LocalPlayerStatsProvider, PlayerStatsProvider, RandomStatsProvider, ServerPlayerStatsProvider
public interface IStatsProvider
An abstraction layer over the game's native
StatsCounter mechanism,
for reading statistics data, primarily about players.-
Method Summary
Modifier and TypeMethodDescriptionstatic List<net.minecraft.stats.StatType<net.minecraft.world.level.block.Block>> static net.minecraft.network.chat.MutableComponentgetCustomStatName(net.minecraft.resources.Identifier customStat) Returns the display name of a given "custom stat", also known as "general stat" in the GUI statistics menu.static List<net.minecraft.stats.StatType<net.minecraft.world.entity.EntityType<?>>> default <T> intgetIntValue(@NotNull net.minecraft.stats.StatType<T> type, T subject) <T> intgetIntValue(net.minecraft.stats.Stat<T> stat) Returns theIntegervalue of a givenStat.static List<net.minecraft.stats.StatType<net.minecraft.world.item.Item>> static net.minecraft.network.chat.ComponentgetStatTypeName(net.minecraft.stats.StatType<?> statType) Returns the display name of a givenStatType.
-
Method Details
-
getIntValue
<T> int getIntValue(net.minecraft.stats.Stat<T> stat) Returns theIntegervalue of a givenStat.- Parameters:
stat- TheStatwhose value is to be obtained.- See Also:
-
getIntValue
@Virtual default <T> int getIntValue(@NotNull @NotNull net.minecraft.stats.StatType<T> type, @NotNull T subject) throws NullPointerException - Parameters:
type- TheStatType.subject- The subject about whom stat value is to be obtained.- Throws:
NullPointerException- See Also:
- API Note:
- You should not override this, as it calls
getIntValue(Stat)by default.
-
getItemStatTypes
-
getBlockStatTypes
-
getEntityStatTypes
-
getStatTypeName
static net.minecraft.network.chat.Component getStatTypeName(net.minecraft.stats.StatType<?> statType) throws NullPointerException Returns the display name of a givenStatType.- Throws:
NullPointerException- If theStatTypeis not registered.
-
getCustomStatName
static net.minecraft.network.chat.MutableComponent getCustomStatName(net.minecraft.resources.Identifier customStat) throws NullPointerException Returns the display name of a given "custom stat", also known as "general stat" in the GUI statistics menu.- Parameters:
customStat- The custom/general stat.- Throws:
NullPointerException- If the argument isnull.
-