Class StatsViewUtils
java.lang.Object
com.thecsdev.betterstats.api.mcbs.view.statsview.StatsViewUtils
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.IdentifierStatsView.Filterskey for the "Show empty stats" filter.static final net.minecraft.resources.IdentifierStatsView.Filterskey for the "Search..." filter.static final net.minecraft.resources.IdentifierStatsView.Filterskey for the "CurrentStatsView" filter.static final intThe default horizontal and vertical margin that is commonly used for various GUI elements onMcbsEditorGUIs. -
Method Summary
Modifier and TypeMethodDescriptionstatic final voidinitBlockStats(@NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.BlockStats> blockStats) Initializes a collection of "Block" statistics in a given "group".static final voidinitBlockStats(@NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.BlockStats> blockStats, @Nullable Consumer<com.thecsdev.commonmc.api.client.gui.widget.stats.TBlockStatsWidget> widgetPostProcessor) Initializes a collection of "Block" statistics in a given "group".static final voidinitBooleanFilter(StatsView.FiltersInitContext context, @NotNull net.minecraft.resources.Identifier filterId, boolean defaultValue, @NotNull net.minecraft.network.chat.Component labelText) Initializes aTCheckboxWidgetfor a givenbooleantype filter.static voidInitializes the default user-interface for aStatsView's "Filters" panel.static final voidinitGeneralStats(@NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.CustomStat> customStats) Initializes a collection of "General" statistics in a given "group".static final voidinitGeneralStats(@NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.CustomStat> customStats, @Nullable Consumer<com.thecsdev.commonmc.api.client.gui.widget.stats.TCustomStatWidget> widgetPostProcessor) Initializes a collection of "General" statistics in a given "group".static final @NotNull com.thecsdev.commonmc.api.client.gui.label.TLabelElementinitGroupLabel(@NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @NotNull net.minecraft.network.chat.Component text) Creates and adds aTLabelElementto theTPanelElement, positioned at the bottom of the panel'sTElement.getContentBounds(), and taking up full panel width.static final Map.Entry<com.thecsdev.commonmc.api.client.gui.misc.TFillColorElement, com.thecsdev.commonmc.api.client.gui.label.TLabelElement> initGroupLabelFramed(@NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @NotNull net.minecraft.network.chat.Component text, double textScale) Creates and adds a "framed" label to theTPanelElement, positioned at the bottom of the panel'sTElement.getContentBounds(), and taking up full panel width.static final voidinitItemStats(@NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.ItemStats> itemStats) Initializes a collection of "Item" statistics in a given "group".static final voidinitItemStats(@NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.ItemStats> itemStats, @Nullable Consumer<com.thecsdev.commonmc.api.client.gui.widget.stats.TItemStatsWidget> widgetPostProcessor) Initializes a collection of "Item" statistics in a given "group".static final voidinitMobStats(@NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.EntityStats> mobStats) Initializes a collection of "Mob" statistics in a given "group".static final voidinitMobStats(@NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.EntityStats> mobStats, @Nullable Consumer<com.thecsdev.commonmc.api.client.gui.widget.stats.TEntityStatsWidget> widgetPostProcessor) Initializes a collection of "Mob" statistics in a given "group".static final voidInitializes theTSimpleTextFieldWidget"Search" filter that filters statistics based on their names.static final voidInitializes theTCheckboxWidget"Show all stats" filter that shows statistics whose values are "0".static final voidInitializes theStatsViewselection dropdown widget.
-
Field Details
-
GAP
public static final int GAPThe default horizontal and vertical margin that is commonly used for various GUI elements onMcbsEditorGUIs.- See Also:
-
FID_STATSVIEW
public static final net.minecraft.resources.Identifier FID_STATSVIEW -
FID_SEARCH
public static final net.minecraft.resources.Identifier FID_SEARCHStatsView.Filterskey for the "Search..." filter.Filter value type:
String -
FID_EMPTYSTATS
public static final net.minecraft.resources.Identifier FID_EMPTYSTATSStatsView.Filterskey for the "Show empty stats" filter.Filter value type:
Boolean
-
-
Method Details
-
initGroupLabel
@Contract("_, _ -> new") @NotNull public static final @NotNull com.thecsdev.commonmc.api.client.gui.label.TLabelElement initGroupLabel(@NotNull @NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @NotNull @NotNull net.minecraft.network.chat.Component text) throws NullPointerException Creates and adds aTLabelElementto theTPanelElement, positioned at the bottom of the panel'sTElement.getContentBounds(), and taking up full panel width.- Parameters:
panel- The targetTPanelElement.text- The label's text.- Throws:
NullPointerException- If an argument isnull.
-
initGroupLabelFramed
@Internal @Experimental @NotNull public static final Map.Entry<com.thecsdev.commonmc.api.client.gui.misc.TFillColorElement, com.thecsdev.commonmc.api.client.gui.label.TLabelElement> initGroupLabelFramed(@NotNull @NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @NotNull @NotNull net.minecraft.network.chat.Component text, double textScale) throws NullPointerException Creates and adds a "framed" label to theTPanelElement, positioned at the bottom of the panel'sTElement.getContentBounds(), and taking up full panel width.The "frame" is a
TFillColorElementwith theTLabelElementas its child.- Parameters:
panel- The targetTPanelElement.text- The label's text.textScale- The label's text scale.- Throws:
NullPointerException- If an argument isnull.- See Also:
-
initDefaultFilters
Initializes the default user-interface for aStatsView's "Filters" panel.- Parameters:
context- TheStatsView.FiltersInitContext.- Throws:
NullPointerException- If the argument isnull.
-
initStatsViewFilter
public static final void initStatsViewFilter(@NotNull StatsView.FiltersInitContext context) throws NullPointerException Initializes theStatsViewselection dropdown widget.- Parameters:
context- TheStatsView.FiltersInitContext.- Throws:
NullPointerException- If the argument isnull.
-
initSearchFilter
public static final void initSearchFilter(@NotNull StatsView.FiltersInitContext context) throws NullPointerException Initializes theTSimpleTextFieldWidget"Search" filter that filters statistics based on their names.- Parameters:
context- TheStatsView.FiltersInitContext.- Throws:
NullPointerException- If the argument isnull.
-
initShowAllStatsFilter
public static final void initShowAllStatsFilter(@NotNull StatsView.FiltersInitContext context) throws NullPointerException Initializes theTCheckboxWidget"Show all stats" filter that shows statistics whose values are "0".- Parameters:
context- TheStatsView.FiltersInitContext.- Throws:
NullPointerException- If the argument isnull.
-
initBooleanFilter
public static final void initBooleanFilter(@NotNull StatsView.FiltersInitContext context, @NotNull @NotNull net.minecraft.resources.Identifier filterId, boolean defaultValue, @NotNull @NotNull net.minecraft.network.chat.Component labelText) throws NullPointerException Initializes aTCheckboxWidgetfor a givenbooleantype filter.- Parameters:
context- TheStatsView.FiltersInitContext.filterId- The uniqueIdentifierfor the filter.defaultValue- The filter's default value.labelText- The checkbox label text.- Throws:
NullPointerException- If an argument isnull.
-
initGeneralStats
public static final void initGeneralStats(@NotNull @NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.CustomStat> customStats) throws NullPointerException Initializes a collection of "General" statistics in a given "group".- Parameters:
panel- TheTPanelElementwhere the stats initialize.groupLabel- The display name of the group of statistics.customStats- The "General" statistics collection.- Throws:
NullPointerException- If aNotNullargument isnull.
-
initGeneralStats
public static final void initGeneralStats(@NotNull @NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.CustomStat> customStats, @Nullable @Nullable Consumer<com.thecsdev.commonmc.api.client.gui.widget.stats.TCustomStatWidget> widgetPostProcessor) throws NullPointerException Initializes a collection of "General" statistics in a given "group".- Parameters:
panel- TheTPanelElementwhere the stats initialize.groupLabel- The display name of the group of statistics.customStats- The "General" statistics collection.widgetPostProcessor- An optional post-processor for each createdTCustomStatWidget.- Throws:
NullPointerException- If aNotNullargument isnull.
-
initItemStats
public static final void initItemStats(@NotNull @NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.ItemStats> itemStats) throws NullPointerException Initializes a collection of "Item" statistics in a given "group".- Parameters:
panel- TheTPanelElementwhere the stats initialize.groupLabel- The display name of the group of statistics.itemStats- The "Item" statistics collection.- Throws:
NullPointerException- If aNotNullargument isnull.
-
initItemStats
public static final void initItemStats(@NotNull @NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.ItemStats> itemStats, @Nullable @Nullable Consumer<com.thecsdev.commonmc.api.client.gui.widget.stats.TItemStatsWidget> widgetPostProcessor) throws NullPointerException Initializes a collection of "Item" statistics in a given "group".- Parameters:
panel- TheTPanelElementwhere the stats initialize.groupLabel- The display name of the group of statistics.itemStats- The "Item" statistics collection.widgetPostProcessor- An optional post-processor for each createdTItemStatsWidget.- Throws:
NullPointerException- If aNotNullargument isnull.
-
initBlockStats
public static final void initBlockStats(@NotNull @NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.BlockStats> blockStats) throws NullPointerException Initializes a collection of "Block" statistics in a given "group".- Parameters:
panel- TheTPanelElementwhere the stats initialize.groupLabel- The display name of the group of statistics.blockStats- The "Block" statistics collection.- Throws:
NullPointerException- If aNotNullargument isnull.
-
initBlockStats
public static final void initBlockStats(@NotNull @NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.BlockStats> blockStats, @Nullable @Nullable Consumer<com.thecsdev.commonmc.api.client.gui.widget.stats.TBlockStatsWidget> widgetPostProcessor) throws NullPointerException Initializes a collection of "Block" statistics in a given "group".- Parameters:
panel- TheTPanelElementwhere the stats initialize.groupLabel- The display name of the group of statistics.blockStats- The "Block" statistics collection.widgetPostProcessor- An optional post-processor for each createdTBlockStatsWidget.- Throws:
NullPointerException- If aNotNullargument isnull.
-
initMobStats
public static final void initMobStats(@NotNull @NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.EntityStats> mobStats) throws NullPointerException Initializes a collection of "Mob" statistics in a given "group".- Parameters:
panel- TheTPanelElementwhere the stats initialize.groupLabel- The display name of the group of statistics.mobStats- The "Mob" statistics collection.- Throws:
NullPointerException- If aNotNullargument isnull.
-
initMobStats
public static final void initMobStats(@NotNull @NotNull com.thecsdev.commonmc.api.client.gui.panel.TPanelElement panel, @Nullable @Nullable net.minecraft.network.chat.Component groupLabel, @NotNull @NotNull Iterable<com.thecsdev.commonmc.api.stats.util.EntityStats> mobStats, @Nullable @Nullable Consumer<com.thecsdev.commonmc.api.client.gui.widget.stats.TEntityStatsWidget> widgetPostProcessor) throws NullPointerException Initializes a collection of "Mob" statistics in a given "group".- Parameters:
panel- TheTPanelElementwhere the stats initialize.groupLabel- The display name of the group of statistics.mobStats- The "Mob" statistics collection.widgetPostProcessor- An optional post-processor for each createdTEntityStatsWidget.- Throws:
NullPointerException- If aNotNullargument isnull.
-