Class SubjectStats<S>
java.lang.Object
com.thecsdev.commonmc.api.stats.util.SubjectStats<S>
- Type Parameters:
S- The "thing" about which the statistics are. This could be something like a general-stat/item/mob.
- Direct Known Subclasses:
BlockStats, CustomStat, EntityStats, ItemStats
public abstract sealed class SubjectStats<S>
extends Object
permits CustomStat, ItemStats, BlockStats, EntityStats
Utility for reading statistics about a given thing (aka subject).
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSubjectStats(@NotNull net.minecraft.core.Registry<S> subjectRegistry, S subject, @NotNull IStatsProvider statsProvider) -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanfinal @NotNull IStatsProviderTheIStatsProviderinstance used by thisSubjectStatsinstance.final SThe "thing" thisSubjectStatsinstance is about.abstract @NotNull net.minecraft.network.chat.ComponentReturns the in-game display name of thegetSubject().final @NotNull net.minecraft.resources.IdentifierReturns theIdentifierthat is associated with the givengetSubject()in the game's registry system.abstract @NotNull LinkedHashMap<net.minecraft.stats.Stat<S>, Integer> Returns all the statistics about thegetSubject().final @NotNull LinkedHashMap<net.minecraft.stats.Stat<S>, String> Returns all the statistics about thegetSubject(), with their values formatted usingStat.format(int).final @NotNull LinkedHashMap<net.minecraft.stats.Stat<S>, String> getValuesF(@NotNull StatFormatterOverride formatter) Returns all the statistics about thegetSubject(), with their values formatted using a custom formatter.final inthashCode()booleanisEmpty()booleanisSearchMatch(@NotNull String query) Returnstrueif thisgetSubject()matches a given search query.
-
Constructor Details
-
SubjectStats
protected SubjectStats(@NotNull @NotNull net.minecraft.core.Registry<S> subjectRegistry, @NotNull S subject, @NotNull @NotNull IStatsProvider statsProvider) throws NullPointerException, IllegalStateException - Throws:
NullPointerException- If an argument isnull.IllegalStateException- If the subject is not properly registered in the game's registries.
-
-
Method Details
-
hashCode
-
equals
-
getStatsProvider
TheIStatsProviderinstance used by thisSubjectStatsinstance. -
getSubject
The "thing" thisSubjectStatsinstance is about. This could be something like a custom-id/item/mob. -
getSubjectID
@NotNull public final @NotNull net.minecraft.resources.Identifier getSubjectID()Returns theIdentifierthat is associated with the givengetSubject()in the game's registry system.- See Also:
-
getSubjectDisplayName
@NotNull public abstract @NotNull net.minecraft.network.chat.Component getSubjectDisplayName()Returns the in-game display name of thegetSubject(). -
getValues
Returns all the statistics about thegetSubject(). -
getValuesF
Returns all the statistics about thegetSubject(), with their values formatted usingStat.format(int). -
getValuesF
@NotNull public final @NotNull LinkedHashMap<net.minecraft.stats.Stat<S>, String> getValuesF(@NotNull @NotNull StatFormatterOverride formatter) throws NullPointerException Returns all the statistics about thegetSubject(), with their values formatted using a custom formatter.- Parameters:
formatter- The custom formatter to use.- Throws:
NullPointerException- If the argument isnull.
-
isEmpty
-
isSearchMatch
Returnstrueif thisgetSubject()matches a given search query.- Parameters:
query- The search query.- Throws:
NullPointerException
-