Class ItemStats
java.lang.Object
com.thecsdev.commonmc.api.stats.util.SubjectStats<net.minecraft.world.item.Item>
com.thecsdev.commonmc.api.stats.util.ItemStats
SubjectStats utility implementation for reading statistics
about a given Item.-
Constructor Summary
ConstructorsConstructorDescriptionItemStats(@NotNull net.minecraft.world.item.Item subject, @NotNull IStatsProvider statsProvider) -
Method Summary
Modifier and TypeMethodDescriptionfinal @NotNull BlockStatsstatic final Collection<ItemStats> getItemStats(@NotNull IStatsProvider statsProvider, @Nullable Predicate<ItemStats> predicate, @Nullable Comparator<ItemStats> comparator) Obtains a list of allItemStats.final @NotNull net.minecraft.network.chat.ComponentReturns the in-game display name of theSubjectStats.getSubject().final intReturns the value ofStats.ITEM_BROKEN.final intReturns the value ofStats.ITEM_CRAFTED.final intReturns the value ofStats.ITEM_DROPPED.final intReturns the value ofStats.ITEM_PICKED_UP.final intReturns the value ofStats.ITEM_USED.final @NotNull LinkedHashMap<net.minecraft.stats.Stat<net.minecraft.world.item.Item>, Integer> Returns all the statistics about theSubjectStats.getSubject().Methods inherited from class SubjectStats
equals, getStatsProvider, getSubject, getSubjectID, getValuesF, getValuesF, hashCode, isEmpty, isSearchMatch
-
Constructor Details
-
ItemStats
public ItemStats(@NotNull @NotNull net.minecraft.world.item.Item 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
-
getSubjectDisplayName
@NotNull public final @NotNull net.minecraft.network.chat.Component getSubjectDisplayName()Description copied from class:SubjectStatsReturns the in-game display name of theSubjectStats.getSubject().- Specified by:
getSubjectDisplayNamein classSubjectStats<net.minecraft.world.item.Item>
-
getValues
@NotNull public final @NotNull LinkedHashMap<net.minecraft.stats.Stat<net.minecraft.world.item.Item>, Integer> getValues()Description copied from class:SubjectStatsReturns all the statistics about theSubjectStats.getSubject().- Specified by:
getValuesin classSubjectStats<net.minecraft.world.item.Item>
-
getBlockStats
-
getTimesBroken
public final int getTimesBroken()Returns the value ofStats.ITEM_BROKEN. -
getTimesCrafted
public final int getTimesCrafted()Returns the value ofStats.ITEM_CRAFTED. -
getTimesDropped
public final int getTimesDropped()Returns the value ofStats.ITEM_DROPPED. -
getTimesUsed
public final int getTimesUsed()Returns the value ofStats.ITEM_USED. -
getTimesPickedUp
public final int getTimesPickedUp()Returns the value ofStats.ITEM_PICKED_UP. -
getItemStats
public static final Collection<ItemStats> getItemStats(@NotNull @NotNull IStatsProvider statsProvider, @Nullable @Nullable Predicate<ItemStats> predicate, @Nullable @Nullable Comparator<ItemStats> comparator) throws NullPointerException Obtains a list of allItemStats.- Parameters:
statsProvider- TheIStatsProviderinstance.predicate- An optionalPredicatefor filtering the stats.comparator- An optionalComparatorfor sorting the list.- Throws:
NullPointerException- If aNotNullargument isnull.
-