Fabric API

Fabric API

106M Downloads

Page turning buttons in creative inventory don't appear in 22w45a

Iunius118 opened this issue ยท 3 comments

commented
  • Fabric version: 0.66.1+1.19.3

I'm trying to add an item group, but the page turning buttons don't appear in the creative inventory and I can't see the tab I added.

FabricItemGroup.builder(new Identifier("modid", "test_group_0"))
		.displayName(Text.literal("Test Item Group: 0"))
		.icon(() -> new ItemStack(Registries.BLOCK.get(1)))
		.entries((enabledFeatures, entries, operatorEnabled) -> {
			entries.add(new ItemStack(Registries.ITEM.get(1)));
		})
		.build();

Screenshot 1: one item group

Curiously, when two item groups are added, the buttons show up.

for (int i = 0; i < 2; i++) {
	final int index = i + 1;
	FabricItemGroup.builder(new Identifier("modid", "test_group_" + i))
			.displayName(Text.literal("Test Item Group: " + i))
			.icon(() -> new ItemStack(Registries.BLOCK.get(index)))
			.entries((enabledFeatures, entries, operatorEnabled) -> {
				entries.add(new ItemStack(Registries.ITEM.get(index)));
			})
			.build();
}

Screenshot 2: two item groups

commented

It seems like the buttons are visible when there are more than 14 item groups:

@Override
public boolean fabric_isButtonVisible(FabricCreativeGuiComponents.Type type) {
return ItemGroups.getGroupsToDisplay().size() > 14;
}

In vanilla, the operator item group may not be present at all times. What happens if you make the operator item group visible? It seems like Fabric assumes that the operator item group is included in the item group list when determining whether another page is needed.

commented

What happens if you make the operator item group visible?

When operatorItemsTab in options.txt is set to true, the first page has 14 tabs and page turning buttons and I can see my tab on the second page..

Screenshot 3

As you said, these buttons only seem to work well in certain situations.

commented

Fixed with #2653