mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-01 01:30:00 -04:00
fix: Add operator tab to common group list and filter for visible tabs in getPageCount. (#4172)
(cherry picked from commit 6823f7cd48
)
This commit is contained in:
parent
56ec7ac6d8
commit
e7c9ab6617
1 changed files with 2 additions and 2 deletions
|
@ -37,12 +37,12 @@ import net.fabricmc.fabric.impl.itemgroup.FabricItemGroupImpl;
|
|||
public class FabricCreativeGuiComponents {
|
||||
private static final Identifier BUTTON_TEX = Identifier.of("fabric", "textures/gui/creative_buttons.png");
|
||||
private static final double TABS_PER_PAGE = FabricItemGroupImpl.TABS_PER_PAGE;
|
||||
public static final Set<ItemGroup> COMMON_GROUPS = Set.of(ItemGroups.SEARCH, ItemGroups.INVENTORY, ItemGroups.HOTBAR).stream()
|
||||
public static final Set<ItemGroup> COMMON_GROUPS = Set.of(ItemGroups.SEARCH, ItemGroups.INVENTORY, ItemGroups.HOTBAR, ItemGroups.OPERATOR).stream()
|
||||
.map(Registries.ITEM_GROUP::getValueOrThrow)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
public static int getPageCount() {
|
||||
return (int) Math.ceil((ItemGroups.getGroupsToDisplay().size() - COMMON_GROUPS.size()) / TABS_PER_PAGE);
|
||||
return (int) Math.ceil((ItemGroups.getGroupsToDisplay().size() - COMMON_GROUPS.stream().filter(ItemGroup::shouldDisplay).count()) / TABS_PER_PAGE);
|
||||
}
|
||||
|
||||
public static class ItemGroupButtonWidget extends ButtonWidget {
|
||||
|
|
Loading…
Add table
Reference in a new issue