fix: Add operator tab to common group list and filter for visible tabs in getPageCount. ()

(cherry picked from commit 6823f7cd48)
This commit is contained in:
Reece Mackie 2024-10-21 09:38:25 +01:00 committed by modmuss50
parent 56ec7ac6d8
commit e7c9ab6617

View file

@ -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 {